better to just use stb_strncpy inside stb__splitpath_raw, also fixed an indexing bug in stb_strncpy itself.

master
Brian Collins ago%!(EXTRA string=5 years)
parent 7c44b15903
commit 8fca192660
  1. 5
      stb.h

@ -2009,7 +2009,7 @@ char *stb_trimwhite(char *s)
char *stb_strncpy(char *s, char *t, int n)
{
stb_p_strncpy_s(s,n+1,t,n);
s[n-1] = 0;
s[n] = 0;
return s;
}
@ -2457,8 +2457,7 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag)
}
if (len) { stb_p_strcpy_s(buffer, sizeof(buffer), "./"); return buffer; }
stb_p_strncpy_s(buffer, y-x+1, path+x, y-x);
buffer[y-x] = 0;
stb_strncpy(buffer, path+x, y-x);
return buffer;
}

Loading…
Cancel
Save