X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Futil.c;h=3f8a0b4873c5017c2b004c8e85edc97d14359b0c;hp=d091c3e155fba957bd57d38fd72b1131cba7100d;hb=604aaba2df983e5490ac76f58a8803dc352b85f3;hpb=885632f08c75c1d7bb5d25436231c78f6ad7e0c0 diff --git a/src/util.c b/src/util.c index d091c3e1..3f8a0b48 100644 --- a/src/util.c +++ b/src/util.c @@ -53,6 +53,22 @@ void wimlib_error(const char *format, ...) va_end(va); } } + +void wimlib_warning(const char *format, ...) +{ + if (__wimlib_print_errors) { + va_list va; + int errno_save; + + va_start(va, format); + errno_save = errno; + fputs("WARNING: ", stderr); + vfprintf(stderr, format, va); + errno = errno_save; + va_end(va); + } +} + #endif WIMLIBAPI int wimlib_set_print_errors(bool show_error_messages) @@ -131,8 +147,10 @@ static const char *error_strings[] = { = "Could not read data from a file", [WIMLIB_ERR_RENAME] = "Could not rename a file", - [WIMLIB_ERR_SPLIT] - = "The WIM is part of a split WIM, which Wimlib does not support", + [WIMLIB_ERR_SPLIT_INVALID] + = "The WIM is part of an invalid split WIM", + [WIMLIB_ERR_SPLIT_UNSUPPORTED] + = "The WIM is part of a split WIM, which is not supported for this operation", [WIMLIB_ERR_STAT] = "Could not read the metadata for a file or directory", [WIMLIB_ERR_TIMEOUT] @@ -450,21 +468,3 @@ void print_string(const void *string, size_t len) } } -/* Calculates the SHA1 message digest given the name of a file. - * @buf must point to a buffer of length 20 bytes into which the message digest - * is written. - */ -int sha1sum(const char *filename, void *buf) -{ - FILE *fp; - int ret; - - fp = fopen(filename, "rb"); - if (!fp) { - ERROR("Cannot open the file `%s' for reading: %m\n", filename); - return WIMLIB_ERR_OPEN; - } - ret = sha1_stream(fp, buf); - fclose(fp); - return ret; -}