From: Adam Dickmeiss Date: Thu, 14 Jan 2010 09:03:24 +0000 (+0100) Subject: Update yaz_strerror to use size_t X-Git-Tag: v4.0.0~44 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=14a3ce42903ba830cb2b838f5a6a7dd2afe93bd6;p=yaz-moved-to-github.git Update yaz_strerror to use size_t --- diff --git a/include/yaz/errno.h b/include/yaz/errno.h index d05f3f3..9fe4ecb 100644 --- a/include/yaz/errno.h +++ b/include/yaz/errno.h @@ -48,9 +48,9 @@ YAZ_EXPORT void yaz_set_errno(int v); /** \brief returns system error description string \param buf buffer for result - \param max maximum number of bytes to store + \param bufsz maximum number of bytes to store */ -YAZ_EXPORT void yaz_strerror(char *buf, int max); +YAZ_EXPORT void yaz_strerror(char *buf, size_t bufsz); YAZ_END_CDECL diff --git a/src/errno.c b/src/errno.c index 3beb6dd..404f97c 100644 --- a/src/errno.c +++ b/src/errno.c @@ -38,7 +38,7 @@ void yaz_set_errno(int v) errno = v; } -void yaz_strerror(char *buf, int max) +void yaz_strerror(char *buf, size_t bufsz) { #ifdef WIN32 DWORD err; @@ -54,7 +54,7 @@ void yaz_strerror(char *buf, int max) err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default lang */ (LPTSTR) buf, - max-1, + bufsz-1, NULL); } else @@ -63,7 +63,7 @@ void yaz_strerror(char *buf, int max) /* UNIX */ #if HAVE_STRERROR_R *buf = '\0'; - strerror_r(errno, buf, max); + strerror_r(errno, buf, bufsz); /* if buffer is unset - use strerror anyway (GLIBC bug) */ if (*buf == '\0') strcpy(buf, strerror(yaz_errno()));