Issue: #940. Fix compilation warnings.

This commit is contained in:
Robin Mills
2013-12-28 03:41:01 +00:00
parent 716f053b46
commit 89c796a3ab
11 changed files with 31 additions and 27 deletions
+15 -13
View File
@@ -86,23 +86,25 @@ namespace Exiv2 {
} // fileExists
#endif
#define UNUSED(x) (void)(x)
std::string strError()
{
int error = errno;
int error = errno;
std::ostringstream os;
#ifdef EXV_HAVE_STRERROR_R
#ifdef EXV_HAVE_STRERROR_R
const size_t n = 1024;
// _GNU_SOURCE: See Debian bug #485135
# if defined EXV_STRERROR_R_CHAR_P && defined _GNU_SOURCE
char *buf = 0;
char buf2[n];
std::memset(buf2, 0x0, n);
buf = strerror_r(error, buf2, n);
# else
char buf[n];
std::memset(buf, 0x0, n);
strerror_r(error, buf, n);
# endif
char buff[n];
std::memset(buff, 0x0, n);
// _GNU_SOURCE: See Debian bug #485135
#ifdef STRERROR_R_CHAR_P
char* buf = strerror_r(error, buff, n);
#else
char* buf = buff;
int dummy = strerror_r(error, buff, n);
UNUSED(dummy);
#endif
os << buf;
// Issue# 908.
// report strerror() if strerror_r() returns empty