Keep string syntax in color macros

This commit is contained in:
Philippe Teuwen 2019-03-10 00:56:00 +01:00
commit da6cdf014b
24 changed files with 144 additions and 144 deletions

View file

@ -73,14 +73,14 @@ int saveFile(const char *preferredName, const char *suffix, const void *data, si
/*Opening file for writing in binary mode*/
FILE *f = fopen(fileName, "wb");
if (!f) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_( % s)"'", fileName);
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", fileName);
free(fileName);
return 1;
}
fwrite(data, 1, datalen, f);
fflush(f);
fclose(f);
PrintAndLogDevice(SUCCESS, "saved %u bytes to binary file " _YELLOW_( % s), datalen, fileName);
PrintAndLogDevice(SUCCESS, "saved %u bytes to binary file " _YELLOW_("%s"), datalen, fileName);
free(fileName);
return 0;
}
@ -110,7 +110,7 @@ int saveFileEML(const char *preferredName, const char *suffix, uint8_t *data, si
/*Opening file for writing in text mode*/
FILE *f = fopen(fileName, "w+");
if (!f) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_( % s)"'", fileName);
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", fileName);
retval = 1;
goto out;
}
@ -133,7 +133,7 @@ int saveFileEML(const char *preferredName, const char *suffix, uint8_t *data, si
}
fflush(f);
fclose(f);
PrintAndLogDevice(SUCCESS, "saved %d blocks to text file " _YELLOW_( % s), blocks, fileName);
PrintAndLogDevice(SUCCESS, "saved %d blocks to text file " _YELLOW_("%s"), blocks, fileName);
out:
free(fileName);
@ -244,12 +244,12 @@ int saveFileJSON(const char *preferredName, const char *suffix, JSONFileType fty
int res = json_dump_file(root, fileName, JSON_INDENT(2));
if (res) {
PrintAndLogDevice(FAILED, "error: can't save the file: " _YELLOW_( % s), fileName);
PrintAndLogDevice(FAILED, "error: can't save the file: " _YELLOW_("%s"), fileName);
json_decref(root);
retval = 200;
goto out;
}
PrintAndLogDevice(SUCCESS, "saved to json file " _YELLOW_( % s), fileName);
PrintAndLogDevice(SUCCESS, "saved to json file " _YELLOW_("%s"), fileName);
json_decref(root);
out:
@ -271,7 +271,7 @@ int loadFile(const char *preferredName, const char *suffix, void *data, size_t *
FILE *f = fopen(fileName, "rb");
if (!f) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_( % s)"'", fileName);
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", fileName);
free(fileName);
return 1;
}
@ -306,7 +306,7 @@ int loadFile(const char *preferredName, const char *suffix, void *data, size_t *
memcpy((data), dump, bytes_read);
free(dump);
PrintAndLogDevice(SUCCESS, "loaded %d bytes from binary file " _YELLOW_( % s), bytes_read, fileName);
PrintAndLogDevice(SUCCESS, "loaded %d bytes from binary file " _YELLOW_("%s"), bytes_read, fileName);
*datalen = bytes_read;
@ -332,7 +332,7 @@ int loadFileEML(const char *preferredName, const char *suffix, void *data, size_
FILE *f = fopen(fileName, "r");
if (!f) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_( % s)"'", fileName);
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", fileName);
retval = 1;
goto out;
}
@ -363,7 +363,7 @@ int loadFileEML(const char *preferredName, const char *suffix, void *data, size_
}
}
fclose(f);
PrintAndLogDevice(SUCCESS, "loaded %d bytes from text file " _YELLOW_( % s), counter, fileName);
PrintAndLogDevice(SUCCESS, "loaded %d bytes from text file " _YELLOW_("%s"), counter, fileName);
if (datalen)
*datalen = counter;
@ -391,13 +391,13 @@ int loadFileJSON(const char *preferredName, const char *suffix, void *data, size
root = json_load_file(fileName, 0, &error);
if (!root) {
PrintAndLog("ERROR: json " _YELLOW_( % s) " error on line %d: %s", fileName, error.line, error.text);
PrintAndLog("ERROR: json " _YELLOW_("%s") " error on line %d: %s", fileName, error.line, error.text);
retval = 2;
goto out;
}
if (!json_is_object(root)) {
PrintAndLog("ERROR: Invalid json " _YELLOW_( % s) " format. root must be an object.", fileName);
PrintAndLog("ERROR: Invalid json " _YELLOW_("%s") " format. root must be an object.", fileName);
retval = 3;
goto out;
}
@ -455,7 +455,7 @@ int loadFileJSON(const char *preferredName, const char *suffix, void *data, size
}
PrintAndLog("loaded from JSON file " _YELLOW_( % s), fileName);
PrintAndLog("loaded from JSON file " _YELLOW_("%s"), fileName);
out:
json_decref(root);
free(fileName);
@ -490,7 +490,7 @@ int loadFileDICTIONARY(const char *preferredName, const char *suffix, void *data
FILE *f = fopen(fileName, "r");
if (!f) {
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_( % s)"'", fileName);
PrintAndLogDevice(WARNING, "file not found or locked. '" _YELLOW_("%s")"'", fileName);
retval = 1;
goto out;
}
@ -511,7 +511,7 @@ int loadFileDICTIONARY(const char *preferredName, const char *suffix, void *data
continue;
if (!isxdigit(line[0])) {
PrintAndLogEx(FAILED, "file content error. '%s' must include " _BLUE_( % 2d) "HEX symbols", line, keylen);
PrintAndLogEx(FAILED, "file content error. '%s' must include " _BLUE_("%2d") "HEX symbols", line, keylen);
continue;
}
@ -523,7 +523,7 @@ int loadFileDICTIONARY(const char *preferredName, const char *suffix, void *data
counter += (keylen >> 1);
}
fclose(f);
PrintAndLogDevice(SUCCESS, "loaded " _GREEN_( % 2d) "keys from dictionary file " _YELLOW_( % s), *keycnt, fileName);
PrintAndLogDevice(SUCCESS, "loaded " _GREEN_("%2d") "keys from dictionary file " _YELLOW_("%s"), *keycnt, fileName);
if (datalen)
*datalen = counter;