CHG: use FillFileNameByUID() for filename generation for 'hf mf dump' and 'hf mf chk * ? d'

This commit is contained in:
Brian Pow 2018-02-05 18:59:24 +08:00
commit d050e473b7
3 changed files with 18 additions and 18 deletions

View file

@ -101,17 +101,19 @@ void AddLogCurrentDT(char *fn) {
// param *uid - pointer to uid byte array
// param *ext - ".log"
// param uidlen - length of uid array.
void FillFileNameByUID(char *fn, uint8_t *uid, char *ext, int uidlen) {
if ( fn == NULL || uid == NULL || ext == NULL ){
void FillFileNameByUID(char *filenamePrefix, uint8_t *uid, const char *ext, int uidlen) {
if ( filenamePrefix == NULL || uid == NULL || ext == NULL ){
printf("[!] error parameter is NULL\n");
return;
}
char *fnameptr = fn;
memset(fn, 0x00, FILE_PATH_SIZE);
for (int j = 0; j < uidlen; j++, fnameptr += 2)
sprintf(fnameptr, "%02X", uid[j]);
sprintf(fnameptr, "%s", ext);
int len=0;
len=strlen(filenamePrefix);
//memset(fn, 0x00, FILE_PATH_SIZE);
for (int j = 0; j < uidlen; j++)
sprintf(filenamePrefix + len + j * 2, "%02X", uid[j]);
strcat(filenamePrefix, ext);
}
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, const size_t hex_max_len,