X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Futil.c;h=df813bb90a20e3ed78fa541862cc64101af46b0e;hp=f19f5a58d87a86df1ecb3bd954f8673fede6f766;hb=7acdc3aecd7ce546727ae8239e0d942c2a00db43;hpb=8eaff5673d8e133e72e20cf4409ab4c901831424 diff --git a/src/util.c b/src/util.c index f19f5a58..df813bb9 100644 --- a/src/util.c +++ b/src/util.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2012 Eric Biggers + * Copyright (C) 2012, 2013 Eric Biggers * * This file is part of wimlib, a library for working with WIM files. * @@ -21,6 +21,10 @@ * along with wimlib; if not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#define MINGW_HAS_SECURE_API + #undef _GNU_SOURCE /* Make sure the POSIX-compatible strerror_r() is declared, rather than the GNU * version, which has a different return type. */ @@ -38,6 +42,11 @@ #include /* for getpid() */ +/* Windoze compatibility */ +#ifdef __WIN32__ +# define strerror_r(errnum, buf, bufsize) strerror_s(buf, bufsize, errnum) +#endif + /* True if wimlib is to print an informational message when an error occurs. * This can be turned off by calling wimlib_set_print_errors(false). */ #ifdef ENABLE_ERROR_MESSAGES @@ -54,7 +63,8 @@ static void wimlib_vmsg(const char *tag, const char *format, vfprintf(stderr, format, va); if (perror && errno_save != 0) { char buf[50]; - int res = strerror_r(errno_save, buf, sizeof(buf)); + int res; + res = strerror_r(errno_save, buf, sizeof(buf)); if (res) { snprintf(buf, sizeof(buf), "unknown error (errno=%d)", errno_save); @@ -165,6 +175,8 @@ static const char *error_strings[] = { = "The WIM's integrity table is invalid", [WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY] = "An entry in the WIM's lookup table is invalid", + [WIMLIB_ERR_INVALID_OVERLAY] + = "Conflicting files in overlay when creating a WIM image", [WIMLIB_ERR_INVALID_PARAM] = "An invalid parameter was given", [WIMLIB_ERR_INVALID_PART_NUMBER] @@ -447,7 +459,7 @@ u64 get_wim_timestamp() { struct timeval tv; gettimeofday(&tv, NULL); - return timeval_to_wim_timestamp(&tv); + return timeval_to_wim_timestamp(tv); } void wim_timestamp_to_str(u64 timestamp, char *buf, size_t len)