Convert mju_error and mju_warning to variadic functions, supporting printf-like arguments. The functions mju_error_i, mju_error_s, mju_warning_i, and mju_warning_s are now deprecated.

PiperOrigin-RevId: 515431052
Change-Id: I440de0cb417ce216b6d636a5d86dc9ef6cc1fc06
This commit is contained in:
Kyle Bayes
2023-03-09 13:50:39 -08:00
committed by Copybara-Service
parent 2e6a37e8c5
commit d3d789cf7d
33 changed files with 177 additions and 184 deletions
+5 -5
View File
@@ -30,7 +30,7 @@ void* mju_fileToMemory(const char* filename, int* filesize) {
// find size
if (fseek(fp, 0, SEEK_END) != 0) {
fclose(fp);
mju_warning_s("Failed to calculate size for '%s'", filename);
mju_warning("Failed to calculate size for '%s'", filename);
return NULL;
}
@@ -38,11 +38,11 @@ void* mju_fileToMemory(const char* filename, int* filesize) {
long long_filesize = ftell(fp); // NOLINT(runtime/int)
if (long_filesize > INT_MAX) {
fclose(fp);
mju_warning_s("File size over 2GB is not supported. File: '%s'", filename);
mju_warning("File size over 2GB is not supported. File: '%s'", filename);
return NULL;
} else if (long_filesize < 0) {
fclose(fp);
mju_warning_s("Failed to calculate size for '%s'", filename);
mju_warning("Failed to calculate size for '%s'", filename);
return NULL;
}
*filesize = long_filesize;
@@ -50,7 +50,7 @@ void* mju_fileToMemory(const char* filename, int* filesize) {
// go back to start of file
if (fseek(fp, 0, SEEK_SET) != 0) {
fclose(fp);
mju_warning_s("Read error while reading '%s'", filename);
mju_warning("Read error while reading '%s'", filename);
return NULL;
}
@@ -67,7 +67,7 @@ void* mju_fileToMemory(const char* filename, int* filesize) {
fclose(fp);
mju_free(buffer);
*filesize = 0;
mju_warning_s("Read error while reading '%s'", filename);
mju_warning("Read error while reading '%s'", filename);
return NULL;
} else if (feof(fp)) {
*filesize = bytes_read;