Size matters. Correctly use a size_t so 64-bit hosts can mount SMB FS's

when using character set conversions.
Also include POSIX <string.h> vs. BSD <strings.h> now that we've broken
traditional BSD behavior [and compatibility with our BSD brethren].

PR:		72445
Submitted by:	Vladimir Nechitailo <nechit@lpi.ru>
Patch by:	Stasys Smailys <ssmailys@komvista.lt>
This commit is contained in:
David E. O'Brien 2004-10-19 17:39:15 +00:00
parent 4c2cbf47fb
commit caef65b837

View File

@ -32,6 +32,9 @@
* $Id: nls.c,v 1.10 2002/07/22 08:33:59 bp Exp $ * $Id: nls.c,v 1.10 2002/07/22 08:33:59 bp Exp $
*/ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h> #include <sys/types.h>
#include <sys/iconv.h> #include <sys/iconv.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -41,7 +44,7 @@
#endif #endif
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <locale.h> #include <locale.h>
#include <err.h> #include <err.h>
@ -125,7 +128,7 @@ char *
nls_str_toloc(char *dst, const char *src) nls_str_toloc(char *dst, const char *src)
{ {
char *p = dst; char *p = dst;
int inlen, outlen; size_t inlen, outlen;
if (!iconv_loaded) if (!iconv_loaded)
return strcpy(dst, src); return strcpy(dst, src);
@ -147,7 +150,7 @@ char *
nls_str_toext(char *dst, const char *src) nls_str_toext(char *dst, const char *src)
{ {
char *p = dst; char *p = dst;
int inlen, outlen; size_t inlen, outlen;
if (!iconv_loaded) if (!iconv_loaded)
return strcpy(dst, src); return strcpy(dst, src);
@ -170,7 +173,7 @@ nls_mem_toloc(void *dst, const void *src, int size)
{ {
char *p = dst; char *p = dst;
const char *s = src; const char *s = src;
int inlen, outlen; size_t inlen, outlen;
if (!iconv_loaded) if (!iconv_loaded)
return memcpy(dst, src, size); return memcpy(dst, src, size);
@ -195,7 +198,7 @@ nls_mem_toext(void *dst, const void *src, int size)
{ {
char *p = dst; char *p = dst;
const char *s = src; const char *s = src;
int inlen, outlen; size_t inlen, outlen;
if (size == 0) if (size == 0)
return NULL; return NULL;