more bsd tweaks

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32485 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-03-07 15:34:06 +00:00
parent dbaa646d12
commit dbf4119553
19 changed files with 91 additions and 68 deletions

View file

@ -4340,7 +4340,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
to[j++] = '&';
to[j++] = '#';
sprintf(buf, "%u", c);
snprintf(buf, sizeof(buf), "%u", c);
while (*ptr != '\0')
{
to[j++] = *ptr++;

View file

@ -629,7 +629,7 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
/*
* The header is a line of the form 'begin mode filename'
*/
sprintf((char*)buf, "begin %03o ", (int)mode);
snprintf((char*)buf, sizeof(buf), "begin %03o ", (int)mode);
[encoded appendBytes: buf length: strlen((const char*)buf)];
[encoded appendData: [name dataUsingEncoding: NSASCIIStringEncoding]];
[encoded appendBytes: "\n" length: 1];

View file

@ -137,7 +137,7 @@ strerror_r(int eno, char *buf, int len)
domain = NSPOSIXErrorDomain;
if (strerror_r(code, buf, BUFSIZ) < 0)
{
sprintf(buf, "%ld", code);
snprintf(buf, sizeof(buf), "%ld", code);
}
message = [NSString stringWithCString: buf
encoding: [NSString defaultCStringEncoding]];