unify text - step 1

This commit is contained in:
iceman1001 committed 2025-03-25 10:12:16 +01:00
1 parent 090f31d0a7
commit 875b3c44b4
40 files changed
+167 -128

No files matched your search

+7 -4
View File
@@ -57,7 +57,7 @@ static int split(char *str, char *arr[MAX_ARGS]) {
int len = endIndex - beginIndex;
char *tmp = calloc(len + 1, sizeof(char));
if (tmp == NULL) {
PrintAndLogEx(WARNING, "Memory allocation failed");
PrintAndLogEx(WARNING, "Failed to allocate memory");
return wordCnt;
}
memcpy(tmp, &str[beginIndex], len);
@@ -101,7 +101,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) {
char *tmp = calloc(size + 1, sizeof(char));
if (tmp == NULL) {
PrintAndLogEx(WARNING, "out of memory?");
PrintAndLogEx(WARNING, "Failed to allocate memory");
return 0;
}
@@ -202,7 +202,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) {
//PrintAndLogEx(NORMAL, "Size: %d, %s, count: %d",size,pset.name, Cnt);
char *tmp = calloc(size + 1, sizeof(char));
if (tmp == NULL) {
PrintAndLogEx(WARNING, "out of memory?");
PrintAndLogEx(WARNING, "Failed to allocate memory");
return 0;
}
@@ -433,9 +433,10 @@ static int CmdrevengTestC(const char *Cmd) {
static char *SwapEndianStr(const char *inStr, const size_t len, const uint8_t blockSize) {
char *tmp = calloc(len + 1, sizeof(char));
if (tmp == NULL) {
PrintAndLogEx(WARNING, "Memory allocation failed");
PrintAndLogEx(WARNING, "Failed to allocate memory");
return NULL;
}
for (uint8_t block = 0; block < (uint8_t)(len / blockSize); block++) {
for (size_t i = 0; i < blockSize; i += 2) {
tmp[i + (blockSize * block)] = inStr[(blockSize - 1 - i - 1) + (blockSize * block)];
@@ -501,6 +502,7 @@ static int CmdrevengSearch(const char *Cmd) {
memset(result, 0, sizeof(result));
char *inCRC = calloc(crcChars + 1, sizeof(char));
if (inCRC == NULL) {
PrintAndLogEx(WARNING, "Failed to allocate memory");
return 0;
}
@@ -508,6 +510,7 @@ static int CmdrevengSearch(const char *Cmd) {
char *outHex = calloc(dataLen - crcChars + 1, sizeof(char));
if (outHex == NULL) {
PrintAndLogEx(WARNING, "Failed to allocate memory");
free(inCRC);
return 0;
}