/** \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
errno = v;
}
-void yaz_strerror(char *buf, int max)
+void yaz_strerror(char *buf, size_t bufsz)
{
#ifdef WIN32
DWORD err;
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default lang */
(LPTSTR) buf,
- max-1,
+ bufsz-1,
NULL);
}
else
/* 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()));