MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / strlcpy

Function strlcpy

src/Utility/include/OpenLoco/Utility/String.hpp:58–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 inline size_t strlcpy(char* dest, const char* src, size_t size)
59 {
60 if (size == 0 || src == nullptr || dest == nullptr)
61 {
62 return 0;
63 }
64 size_t srcLen = std::strlen(src);
65
66 if (srcLen < size)
67 {
68 std::memcpy(dest, src, srcLen + 1);
69 return srcLen;
70 }
71 else
72 {
73 std::memcpy(dest, src, size);
74 dest[size - 1] = '\0';
75 return size - 1;
76 }
77 }
78
79 inline size_t strlcat(char* dest, const char* src, size_t size)
80 {

Callers 5

setDirectoryFunction · 0.85
openFunction · 0.85
getCurrentExecutablePathFunction · 0.85
TESTFunction · 0.85
strcpy_safeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68