MCPcopy Create free account
hub / github.com/defold/defold / dmStrlCpy

Function dmStrlCpy

engine/dlib/src/dlib/dstrings.cpp:161–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 */
160
161size_t dmStrlCpy(char *dst, const char *src, size_t siz)
162{
163 char *d = dst;
164 const char *s = src;
165 size_t n = siz;
166
167 /* Copy as many bytes as will fit */
168 if (n != 0 && --n != 0) {
169 do {
170 if ((*d++ = *s++) == 0)
171 break;
172 } while (--n != 0);
173 }
174
175 /* Not enough room in dst, add NUL and traverse rest of src */
176 if (n == 0) {
177 if (siz != 0)
178 *d = '\0'; /* NUL-terminate dst */
179 while (*s++)
180 ;
181 }
182
183 return(s - src - 1); /* count does not include NUL */
184}
185
186#include <string.h>
187

Callers 15

ConfigGetStringFunction · 0.85
LaunchFunction · 0.85
SetLoadAddrsFunction · 0.85
SetCrashFilenameFunction · 0.85
SetLoadAddrsFunction · 0.85
InitFunction · 0.85
SetFilePathFunction · 0.85
SetUserFieldFunction · 0.85
InstallHandlerFunction · 0.85
AttachCollectionFunction · 0.85
TEST_FFunction · 0.85
BufferResolveUriFunction · 0.85

Calls

no outgoing calls

Tested by 14

TEST_FFunction · 0.68
BufferResolveUriFunction · 0.68
LoadSceneFunction · 0.68
MakeHostPathFunction · 0.68
MakeHostPathfFunction · 0.68
BuildLocalNameFunction · 0.68
BuildFullServiceNameFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68