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

Function dmStrlCat

engine/dlib/src/dlib/dstrings.cpp:194–220  ·  view source on GitHub ↗

* Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(dst) + strlen(src); if retval >= siz, truncation occurred. */

Source from the content-addressed store, hash-verified

192 * Returns strlen(dst) + strlen(src); if retval >= siz, truncation occurred.
193 */
194size_t
195dmStrlCat(char *dst, const char *src, size_t siz)
196{
197 char *d = dst;
198 const char *s = src;
199 size_t n = siz;
200 size_t dlen;
201
202 /* Find the end of dst and adjust bytes left but don't go past end */
203 while (*d != '\0' && n-- != 0)
204 d++;
205 dlen = d - dst;
206 n = siz - dlen;
207
208 if (n == 0)
209 return(dlen + strlen(s));
210 while (*s != '\0') {
211 if (n != 1) {
212 *d++ = *s;
213 n--;
214 }
215 s++;
216 }
217 *d = '\0';
218
219 return(dlen + (s - src)); /* count does not include NUL */
220}
221
222int dmStrCaseCmp(const char *s1, const char *s2)
223{

Callers 15

LaunchFunction · 0.85
SetCrashFilenameFunction · 0.85
InitFunction · 0.85
AttachCollectionFunction · 0.85
BufferResolveUriFunction · 0.85
BufferResolveUriFunction · 0.85
Sys_GetSaveFileFunction · 0.85
UrlToStringFunction · 0.85
LuaPrintFunction · 0.85
HandleRequestFunction · 0.85
MakeHostPathFunction · 0.85
MakeHostPathfFunction · 0.85

Calls

no outgoing calls

Tested by 8

BufferResolveUriFunction · 0.68
MakeHostPathFunction · 0.68
MakeHostPathfFunction · 0.68
BuildLocalNameFunction · 0.68
BuildFullServiceNameFunction · 0.68
LogTextFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68