#else
if (show_error_messages)
return WIMLIB_ERR_UNSUPPORTED;
+ else
+ return 0;
#endif
}
static const char *error_strings[] = {
[WIMLIB_ERR_SUCCESS]
= "Success",
+ [WIMLIB_ERR_ALREADY_LOCKED]
+ = "The WIM is already locked for writing",
+ [WIMLIB_ERR_CHAR_CONVERSION]
+ = "Failed to perform a conversion between UTF-8 and UTF-16LE",
[WIMLIB_ERR_COMPRESSED_LOOKUP_TABLE]
= "Lookup table is compressed",
[WIMLIB_ERR_DECOMPRESSION]
= "An entry in the WIM's lookup table is invalid",
[WIMLIB_ERR_INVALID_PARAM]
= "An invalid parameter was given",
+ [WIMLIB_ERR_INVALID_PART_NUMBER]
+ = "The part number or total parts of the WIM is invalid",
[WIMLIB_ERR_INVALID_RESOURCE_HASH]
= "The SHA1 message digest of a WIM resource did not match the expected value",
[WIMLIB_ERR_INVALID_RESOURCE_SIZE]
= "Could not read the target of a symbolic link",
[WIMLIB_ERR_RENAME]
= "Could not rename a file",
+ [WIMLIB_ERR_REOPEN]
+ = "Could not re-open the WIM after overwriting it",
+ [WIMLIB_ERR_RESOURCE_ORDER]
+ = "The components of the WIM were arranged in an unexpected order",
[WIMLIB_ERR_SPECIAL_FILE]
= "Encountered a special file that cannot be archived",
[WIMLIB_ERR_SPLIT_INVALID]
static bool seeded = false;
+static void seed_random()
+{
+ srand(time(NULL) * getpid());
+ seeded = true;
+}
+
/* Fills @n bytes pointed to by @p with random alphanumeric characters. */
void randomize_char_array_with_alnum(char p[], size_t n)
{
- int r;
-
- if (!seeded) {
- srand(time(NULL));
- seeded = true;
- }
+ if (!seeded)
+ seed_random();
while (n--) {
- r = rand() % 62;
+ int r = rand() % 62;
if (r < 26)
*p++ = r + 'a';
else if (r < 52)
/* Fills @n bytes pointer to by @p with random numbers. */
void randomize_byte_array(u8 *p, size_t n)
{
- if (!seeded) {
- srand(time(NULL));
- seeded = true;
- }
+ if (!seeded)
+ seed_random();
while (n--)
*p++ = rand();
}
return timeval_to_wim_timestamp(&tv);
}
-
+void wim_timestamp_to_str(u64 timestamp, char *buf, size_t len)
+{
+ struct tm tm;
+ time_t t = wim_timestamp_to_unix(timestamp);
+ gmtime_r(&t, &tm);
+ strftime(buf, len, "%a %b %d %H:%M:%S %Y UTC", &tm);
+}