diff --git a/client/src/fileutils.c b/client/src/fileutils.c index 9545753bc..5fa74c4b0 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -747,7 +747,7 @@ out: int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose) { return saveFileJSONrootEx(preferredName, root, flags, verbose, false); } -int saveFileJSONrootEx(const char *preferredName, void *root, size_t flags, bool verbose, bool overwrite) { +int saveFileJSONrootEx(const char *preferredName, const void *root, size_t flags, bool verbose, bool overwrite) { if (root == NULL) return PM3_EINVARG; @@ -863,7 +863,7 @@ out: } // key file dump -int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, sector_t *e_sector) { +int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, const sector_t *e_sector) { if (e_sector == NULL) return PM3_EINVARG; @@ -1743,7 +1743,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz goto out; } - snprintf(blocks, sizeof(blocks), "$.blocks.%d", i); + snprintf(blocks, sizeof(blocks), "$.blocks.%u", i); JsonLoadBufAsHex(root, blocks, &tag->data[sptr], 4, &len); if (load_file_sanity(ctype, tag->bytesPerPage, i, len) == false) { break; @@ -1790,7 +1790,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz goto out; } - snprintf(blocks, sizeof(blocks), "$.blocks.%d", i); + snprintf(blocks, sizeof(blocks), "$.blocks.%u", i); JsonLoadBufAsHex(root, blocks, &tag->data[sptr], 8, &len); if (load_file_sanity(ctype, tag->bytesPerPage, i, len) == false) { break; @@ -2426,7 +2426,7 @@ mfu_df_e detect_mfu_dump_format(uint8_t **dump, bool verbose) { // detect plain if (retval == MFU_DF_UNKNOWN) { - uint8_t *plain = *dump; + const uint8_t *plain = *dump; bcc0 = ct ^ plain[0] ^ plain[1] ^ plain[2]; bcc1 = plain[4] ^ plain[5] ^ plain[6] ^ plain[7]; if ((bcc0 == plain[3]) && (bcc1 == plain[8])) { diff --git a/client/src/fileutils.h b/client/src/fileutils.h index 3eb2a0541..b469eba68 100644 --- a/client/src/fileutils.h +++ b/client/src/fileutils.h @@ -107,8 +107,8 @@ int fileExists(const char *filename); bool setDefaultPath(savePaths_t pathIndex, const char *path); char *newfilenamemcopy(const char *preferredName, const char *suffix); -char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePaths_t save_path); -void truncate_filename(char *fn, uint16_t len); +char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePaths_t e_save_path); +void truncate_filename(char *fn, uint16_t maxlen); /** @@ -138,7 +138,7 @@ int saveFile(const char *preferredName, const char *suffix, const void *data, si int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, void (*callback)(json_t *)); int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, bool verbose, void (*callback)(json_t *), savePaths_t e_save_path); int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose); -int saveFileJSONrootEx(const char *preferredName, void *root, size_t flags, bool verbose, bool overwrite); +int saveFileJSONrootEx(const char *preferredName, const void *root, size_t flags, bool verbose, bool overwrite); /** STUB * @brief Utility function to save WAVE data to a file. This method takes a preferred name, but if that * file already exists, it tries with another name until it finds something suitable. @@ -171,7 +171,7 @@ int saveFilePM3(const char *preferredName, int *data, size_t datalen); * @param e_sector the keys in question * @return 0 for ok, 1 for failz */ -int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, sector_t *e_sector); +int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, const sector_t *e_sector); /** * @brief Utility function to load data from a binary file. This method takes a preferred name.