cleaning out memory unsafe functions for loading files. Also made the loading of files to honor the preference dump/trace settings. Experimental support, which will need more love. I have been using it for some months now but there are still other save/load file operations scattered in the PM3 client which will not benefit from this yet. They need to be adapted too
This commit is contained in:
1 parent
039937e28a
commit
fe31bd4064
4 files changed
+172
-145
No files matched your search
+2
-16
@@ -60,12 +60,12 @@ typedef enum {
|
||||
} DumpFileType_t;
|
||||
|
||||
int fileExists(const char *filename);
|
||||
//bool create_path(const char *dirname);
|
||||
|
||||
// set a path in the path list g_session.defaultPaths
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Utility function to save data to a binary file. This method takes a preferred name, but if that
|
||||
@@ -105,7 +105,7 @@ int saveFileEML(const char *preferredName, uint8_t *data, size_t datalen, size_t
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
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 *));
|
||||
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);
|
||||
/** STUB
|
||||
@@ -142,20 +142,6 @@ int saveFilePM3(const char *preferredName, int *data, size_t datalen);
|
||||
*/
|
||||
int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, sector_t *e_sector);
|
||||
|
||||
/**
|
||||
* @brief Utility function to load data from a binary file. This method takes a preferred name.
|
||||
* E.g. dumpdata-15.bin
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix the file suffix. Including the ".".
|
||||
* @param data The data array to store the loaded bytes from file
|
||||
* @param maxdatalen the number of bytes that your data array has
|
||||
* @param datalen the number of bytes loaded from file
|
||||
* @return PM3_SUCCESS for ok, PM3_E* for failz
|
||||
*/
|
||||
int loadFile(const char *preferredName, const char *suffix, void *data, size_t maxdatalen, size_t *datalen);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Utility function to load data from a binary file. This method takes a preferred name.
|
||||
* E.g. dumpdata-15.bin, tries to search for it, and allocated memory.
|
||||
|
||||
Reference in new issue
Block a user