mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
make style
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
//#define APP_FW_VER_MAJOR 2
|
||||
//#define APP_FW_VER_MINOR 0
|
||||
#if !(defined APP_FW_VER_MAJOR && defined APP_FW_VER_MINOR)
|
||||
#error You need to define APP_FW_VER_MAJOR and APP_FW_VER_MINOR
|
||||
#error You need to define APP_FW_VER_MAJOR and APP_FW_VER_MINOR
|
||||
#endif
|
||||
|
||||
// Merge major and minor version code to U16 value.
|
||||
|
||||
@@ -487,18 +487,18 @@ uint8_t pcd_14a_reader_bits_transfer(uint8_t *pTx, uint16_t szTxBits, uint8_t *
|
||||
* @param :tag: tag info buffer
|
||||
* @retval : if return STATUS_HF_TAG_OK, the tag is selected.
|
||||
*/
|
||||
uint8_t pcd_14a_reader_fast_select(picc_14a_tag_t *tag) {
|
||||
uint8_t resp[5] = {0}; // theoretically. A usual RATS will be much smaller
|
||||
uint8_t uid_resp[4] = {0};
|
||||
uint8_t pcd_14a_reader_fast_select(picc_14a_tag_t *tag) {
|
||||
uint8_t resp[5] = {0}; // theoretically. A usual RATS will be much smaller
|
||||
uint8_t uid_resp[4] = {0};
|
||||
uint8_t sak = 0x04; // cascade uid
|
||||
uint8_t status = STATUS_HF_TAG_OK;
|
||||
uint8_t cascade_level = 0;
|
||||
uint16_t len;
|
||||
|
||||
// Wakeup
|
||||
uint8_t status = STATUS_HF_TAG_OK;
|
||||
uint8_t cascade_level = 0;
|
||||
uint16_t len;
|
||||
|
||||
// Wakeup
|
||||
if (pcd_14a_reader_atqa_request(resp, NULL, U8ARR_BIT_LEN(resp)) != STATUS_HF_TAG_OK) {
|
||||
return STATUS_HF_TAG_NO;
|
||||
}
|
||||
return STATUS_HF_TAG_NO;
|
||||
}
|
||||
|
||||
// OK we will select at least at cascade 1, lets see if first byte of UID was 0x88 in
|
||||
// which case we need to make a cascade 2 request and select - this is a long UID
|
||||
@@ -520,14 +520,14 @@ uint8_t pcd_14a_reader_fast_select(picc_14a_tag_t *tag) {
|
||||
//sel_uid[1] = 0x70; // transmitting a full UID (1 Byte cmd, 1 Byte NVB, 4 Byte UID, 1 Byte BCC, 2 Bytes CRC)
|
||||
memcpy(sel_uid + 2, uid_resp, 4); // the UID received during anticollision, or the provided UID
|
||||
sel_uid[6] = sel_uid[2] ^ sel_uid[3] ^ sel_uid[4] ^ sel_uid[5]; // calculate and add BCC
|
||||
crc_14a_append(sel_uid, 7); // calculate and add CRC
|
||||
status = pcd_14a_reader_bytes_transfer(PCD_TRANSCEIVE, sel_uid, sizeof(sel_uid), resp, &len, U8ARR_BIT_LEN(resp));
|
||||
crc_14a_append(sel_uid, 7); // calculate and add CRC
|
||||
status = pcd_14a_reader_bytes_transfer(PCD_TRANSCEIVE, sel_uid, sizeof(sel_uid), resp, &len, U8ARR_BIT_LEN(resp));
|
||||
// Receive the SAK
|
||||
if (status != STATUS_HF_TAG_OK || !len) {
|
||||
// printf("SAK Err: %d, %d\r\n", status, recv_len);
|
||||
return STATUS_HF_TAG_NO;
|
||||
}
|
||||
|
||||
// printf("SAK Err: %d, %d\r\n", status, recv_len);
|
||||
return STATUS_HF_TAG_NO;
|
||||
}
|
||||
|
||||
sak = resp[0];
|
||||
|
||||
// Test if more parts of the uid are coming
|
||||
|
||||
@@ -194,11 +194,11 @@ static bool is_peer_manager_record(uint16_t id_or_key) {
|
||||
static void fds_evt_handler(fds_evt_t const *p_evt) {
|
||||
// Skip peermanager event
|
||||
if (fds_operation_info.ignore_pm && (
|
||||
is_peer_manager_record(p_evt->write.record_key)
|
||||
|| is_peer_manager_record(p_evt->write.file_id)
|
||||
|| is_peer_manager_record(p_evt->del.record_key)
|
||||
|| is_peer_manager_record(p_evt->del.file_id)
|
||||
)
|
||||
is_peer_manager_record(p_evt->write.record_key)
|
||||
|| is_peer_manager_record(p_evt->write.file_id)
|
||||
|| is_peer_manager_record(p_evt->del.record_key)
|
||||
|| is_peer_manager_record(p_evt->del.file_id)
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,6 +388,7 @@ lf = root.subgroup('lf', 'Low Frequency commands')
|
||||
lf_em = lf.subgroup('em', 'EM commands')
|
||||
lf_em_410x = lf_em.subgroup('410x', 'EM410x commands')
|
||||
|
||||
|
||||
@root.command('clear')
|
||||
class RootClear(BaseCLIUnit):
|
||||
def args_parser(self) -> ArgumentParserNoExit:
|
||||
@@ -1124,11 +1125,11 @@ class HFMFEConfig(SlotIndexArgsAndGoUnit, HF14AAntiCollArgsUnit, DeviceRequiredU
|
||||
fwslot = SlotNumber.to_fw(self.slot_num)
|
||||
hf_tag_type = TagSpecificType(slotinfo[fwslot]['hf'])
|
||||
if hf_tag_type not in [
|
||||
TagSpecificType.MIFARE_Mini,
|
||||
TagSpecificType.MIFARE_1024,
|
||||
TagSpecificType.MIFARE_2048,
|
||||
TagSpecificType.MIFARE_4096,
|
||||
]:
|
||||
TagSpecificType.MIFARE_Mini,
|
||||
TagSpecificType.MIFARE_1024,
|
||||
TagSpecificType.MIFARE_2048,
|
||||
TagSpecificType.MIFARE_4096,
|
||||
]:
|
||||
print(f"{CR}Slot {self.slot_num} not configured as MIFARE Classic{C0}")
|
||||
return
|
||||
mfc_config = self.cmd.mf1_get_emulator_config()
|
||||
@@ -1310,7 +1311,7 @@ class HFMFUDUMP(MFUAuthArgsUnit):
|
||||
}
|
||||
for i in range(param.start_page, param.stop_page):
|
||||
resp = self.cmd.hf14a_raw(options=options, resp_timeout_ms=200, data=struct.pack('!BB', 0x30, i))
|
||||
# TODO: can be optimized as we get 4 pages at once but beware of wrapping
|
||||
# TODO: can be optimized as we get 4 pages at once but beware of wrapping
|
||||
# in case of end of memory or LOCK on ULC and no key provided
|
||||
data = resp[:4]
|
||||
print(f" - Page {i:2}: {data.hex()}")
|
||||
@@ -1347,10 +1348,10 @@ class HFMFUEConfig(SlotIndexArgsAndGoUnit, HF14AAntiCollArgsUnit, DeviceRequired
|
||||
fwslot = SlotNumber.to_fw(self.slot_num)
|
||||
hf_tag_type = TagSpecificType(slotinfo[fwslot]['hf'])
|
||||
if hf_tag_type not in [
|
||||
TagSpecificType.NTAG_213,
|
||||
TagSpecificType.NTAG_215,
|
||||
TagSpecificType.NTAG_216,
|
||||
]:
|
||||
TagSpecificType.NTAG_213,
|
||||
TagSpecificType.NTAG_215,
|
||||
TagSpecificType.NTAG_216,
|
||||
]:
|
||||
print(f"{CR}Slot {self.slot_num} not configured as MIFARE Ultralight / NTAG{C0}")
|
||||
return
|
||||
change_requested, change_done, uid, atqa, sak, ats = self.update_hf14a_anticoll(args, uid, atqa, sak, ats)
|
||||
@@ -1462,11 +1463,11 @@ class HWSlotList(DeviceRequiredUnit):
|
||||
if len(ats) > 0:
|
||||
print(f' {"ATS:":40}{CY}{ats.hex().upper()}{C0}')
|
||||
if hf_tag_type in [
|
||||
TagSpecificType.MIFARE_Mini,
|
||||
TagSpecificType.MIFARE_1024,
|
||||
TagSpecificType.MIFARE_2048,
|
||||
TagSpecificType.MIFARE_4096,
|
||||
]:
|
||||
TagSpecificType.MIFARE_Mini,
|
||||
TagSpecificType.MIFARE_1024,
|
||||
TagSpecificType.MIFARE_2048,
|
||||
TagSpecificType.MIFARE_4096,
|
||||
]:
|
||||
config = self.cmd.mf1_get_emulator_config()
|
||||
# print(' - Mifare Classic emulator settings:')
|
||||
print(
|
||||
@@ -1480,7 +1481,7 @@ class HWSlotList(DeviceRequiredUnit):
|
||||
f'{f"{CG}enabled{C0}" if config["block_anti_coll_mode"] else f"{CR}disabled{C0}"}')
|
||||
try:
|
||||
print(f' {"Write mode:":40}{CY}'
|
||||
f'{MifareClassicWriteMode(config["write_mode"])}{C0}')
|
||||
f'{MifareClassicWriteMode(config["write_mode"])}{C0}')
|
||||
except ValueError:
|
||||
print(f' {"Write mode:":40}{CR}invalid value!{C0}')
|
||||
print(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import enum
|
||||
|
||||
|
||||
@enum.unique
|
||||
class Command(enum.IntEnum):
|
||||
GET_APP_VERSION = 1000
|
||||
@@ -430,5 +431,3 @@ class ButtonPressFunction(enum.IntEnum):
|
||||
elif self == ButtonPressFunction.BATTERY:
|
||||
return "Show Battery Level"
|
||||
return "None"
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Purpose:
|
||||
* Provides an implementation of POSIX realtime extensions
|
||||
* as defined in
|
||||
* as defined in
|
||||
*
|
||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
||||
*
|
||||
@@ -12,25 +12,25 @@
|
||||
* Pthreads-win32 - POSIX Threads Library for Win32
|
||||
* Copyright(C) 1998 John E. Bossom
|
||||
* Copyright(C) 1999,2005 Pthreads-win32 contributors
|
||||
*
|
||||
*
|
||||
* Contact Email: rpj@callisto.canberra.edu.au
|
||||
*
|
||||
*
|
||||
* The current list of contributors is contained
|
||||
* in the file CONTRIBUTORS included with the source
|
||||
* code distribution. The list can also be seen at the
|
||||
* following World Wide Web location:
|
||||
* http://sources.redhat.com/pthreads-win32/contributors.html
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library in the file COPYING.LIB;
|
||||
* if not, write to the Free Software Foundation, Inc.,
|
||||
@@ -123,24 +123,24 @@
|
||||
/* Required by Unix 98 */
|
||||
# include <time.h>
|
||||
# else
|
||||
typedef int pid_t;
|
||||
typedef int pid_t;
|
||||
# endif
|
||||
#else
|
||||
typedef int pid_t;
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
|
||||
/* Thread scheduling policies */
|
||||
|
||||
enum {
|
||||
SCHED_OTHER = 0,
|
||||
SCHED_FIFO,
|
||||
SCHED_RR,
|
||||
SCHED_MIN = SCHED_OTHER,
|
||||
SCHED_MAX = SCHED_RR
|
||||
SCHED_OTHER = 0,
|
||||
SCHED_FIFO,
|
||||
SCHED_RR,
|
||||
SCHED_MIN = SCHED_OTHER,
|
||||
SCHED_MAX = SCHED_RR
|
||||
};
|
||||
|
||||
struct sched_param {
|
||||
int sched_priority;
|
||||
int sched_priority;
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -148,15 +148,15 @@ extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
PTW32_DLLPORT int __cdecl sched_yield (void);
|
||||
PTW32_DLLPORT int __cdecl sched_yield(void);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
|
||||
PTW32_DLLPORT int __cdecl sched_get_priority_min(int policy);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
|
||||
PTW32_DLLPORT int __cdecl sched_get_priority_max(int policy);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
|
||||
PTW32_DLLPORT int __cdecl sched_setscheduler(pid_t pid, int policy);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
|
||||
PTW32_DLLPORT int __cdecl sched_getscheduler(pid_t pid);
|
||||
|
||||
/*
|
||||
* Note that this macro returns ENOTSUP rather than
|
||||
|
||||
@@ -2,35 +2,35 @@
|
||||
* Module: semaphore.h
|
||||
*
|
||||
* Purpose:
|
||||
* Semaphores aren't actually part of the PThreads standard.
|
||||
* They are defined by the POSIX Standard:
|
||||
* Semaphores aren't actually part of the PThreads standard.
|
||||
* They are defined by the POSIX Standard:
|
||||
*
|
||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
||||
* POSIX 1003.1b-1993 (POSIX.1b)
|
||||
*
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Pthreads-win32 - POSIX Threads Library for Win32
|
||||
* Copyright(C) 1998 John E. Bossom
|
||||
* Copyright(C) 1999,2005 Pthreads-win32 contributors
|
||||
*
|
||||
*
|
||||
* Contact Email: rpj@callisto.canberra.edu.au
|
||||
*
|
||||
*
|
||||
* The current list of contributors is contained
|
||||
* in the file CONTRIBUTORS included with the source
|
||||
* code distribution. The list can also be seen at the
|
||||
* following World Wide Web location:
|
||||
* http://sources.redhat.com/pthreads-win32/contributors.html
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library in the file COPYING.LIB;
|
||||
* if not, write to the Free Software Foundation, Inc.,
|
||||
@@ -120,50 +120,50 @@
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if !defined(HAVE_MODE_T)
|
||||
typedef unsigned int mode_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct sem_t_ * sem_t;
|
||||
typedef struct sem_t_ *sem_t;
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
|
||||
int pshared,
|
||||
unsigned int value);
|
||||
PTW32_DLLPORT int __cdecl sem_init(sem_t *sem,
|
||||
int pshared,
|
||||
unsigned int value);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
|
||||
PTW32_DLLPORT int __cdecl sem_destroy(sem_t *sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
|
||||
PTW32_DLLPORT int __cdecl sem_trywait(sem_t *sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
|
||||
PTW32_DLLPORT int __cdecl sem_wait(sem_t *sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
|
||||
const struct timespec * abstime);
|
||||
PTW32_DLLPORT int __cdecl sem_timedwait(sem_t *sem,
|
||||
const struct timespec *abstime);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
|
||||
PTW32_DLLPORT int __cdecl sem_post(sem_t *sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
|
||||
int count);
|
||||
PTW32_DLLPORT int __cdecl sem_post_multiple(sem_t *sem,
|
||||
int count);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_open (const char * name,
|
||||
int oflag,
|
||||
mode_t mode,
|
||||
unsigned int value);
|
||||
PTW32_DLLPORT int __cdecl sem_open(const char *name,
|
||||
int oflag,
|
||||
mode_t mode,
|
||||
unsigned int value);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
|
||||
PTW32_DLLPORT int __cdecl sem_close(sem_t *sem);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
|
||||
PTW32_DLLPORT int __cdecl sem_unlink(const char *name);
|
||||
|
||||
PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
|
||||
int * sval);
|
||||
PTW32_DLLPORT int __cdecl sem_getvalue(sem_t *sem,
|
||||
int *sval);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* End of extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
} /* End of extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#undef PTW32_SEMAPHORE_LEVEL
|
||||
#undef PTW32_SEMAPHORE_LEVEL_MAX
|
||||
|
||||
#endif /* !SEMAPHORE_H */
|
||||
#endif /* !SEMAPHORE_H */
|
||||
|
||||
+16
-21
@@ -75,13 +75,13 @@ countKeys *uniqsort(uint64_t *possibleKeys, uint32_t size) {
|
||||
}
|
||||
|
||||
// nested decrypt
|
||||
static void* nested_revover(void *args) {
|
||||
static void *nested_revover(void *args) {
|
||||
struct Crypto1State *revstate, * revstate_start = NULL;
|
||||
uint64_t lfsr = 0;
|
||||
uint32_t i, kcount = 0;
|
||||
bool is_ok = true;
|
||||
|
||||
RecPar* rp = (RecPar*)args;
|
||||
RecPar *rp = (RecPar *)args;
|
||||
|
||||
rp->keyCount = 0;
|
||||
rp->keys = NULL;
|
||||
@@ -110,14 +110,14 @@ static void* nested_revover(void *args) {
|
||||
if (((kcount % MEM_CHUNK) == 0) || (kcount >= rp->keyCount)) {
|
||||
rp->keyCount += MEM_CHUNK;
|
||||
// printf("New chunk by %d, sizeof %lu\n", kcount, rp->keyCount * sizeof(uint64_t));
|
||||
void* tmp = realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
void *tmp = realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
if (tmp == NULL) {
|
||||
printf("Memory allocation error for pk->possibleKeys");
|
||||
rp->keyCount = 0;
|
||||
is_ok = false;
|
||||
break;
|
||||
}
|
||||
rp->keys = (uint64_t*)tmp;
|
||||
rp->keys = (uint64_t *)tmp;
|
||||
}
|
||||
rp->keys[kcount] = lfsr;
|
||||
kcount++;
|
||||
@@ -133,18 +133,16 @@ static void* nested_revover(void *args) {
|
||||
if (is_ok) {
|
||||
if (kcount != 0) {
|
||||
rp->keyCount = kcount;
|
||||
void* tmp = (uint64_t*)realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
void *tmp = (uint64_t *)realloc(rp->keys, rp->keyCount * sizeof(uint64_t));
|
||||
if (tmp == NULL) {
|
||||
printf("Memory allocation error for pk->possibleKeys");
|
||||
rp->keyCount = 0;
|
||||
free(rp->keys);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rp->keys = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rp->keyCount = 0;
|
||||
free(rp->keys);
|
||||
}
|
||||
@@ -156,7 +154,7 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
||||
|
||||
*keyCount = 0;
|
||||
uint32_t i, j, manyThread;
|
||||
uint64_t* keys = (uint64_t*)NULL;
|
||||
uint64_t *keys = (uint64_t *)NULL;
|
||||
|
||||
manyThread = THREAD_MAX;
|
||||
if (manyThread > sizePNK) {
|
||||
@@ -164,11 +162,11 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
||||
}
|
||||
|
||||
// pthread handle
|
||||
pthread_t* threads = calloc(sizePNK, sizeof(pthread_t));
|
||||
pthread_t *threads = calloc(sizePNK, sizeof(pthread_t));
|
||||
if (threads == NULL) return NULL;
|
||||
|
||||
// Param
|
||||
RecPar* pRPs = calloc(sizePNK, sizeof(RecPar));
|
||||
RecPar *pRPs = calloc(sizePNK, sizeof(RecPar));
|
||||
if (pRPs == NULL) {
|
||||
free(threads);
|
||||
return NULL;
|
||||
@@ -216,9 +214,9 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
||||
}
|
||||
}
|
||||
|
||||
countKeys* ck = uniqsort(keys, *keyCount);
|
||||
countKeys *ck = uniqsort(keys, *keyCount);
|
||||
free(keys);
|
||||
keys = (uint64_t*)NULL;
|
||||
keys = (uint64_t *)NULL;
|
||||
*keyCount = 0;
|
||||
|
||||
if (ck != NULL) {
|
||||
@@ -227,24 +225,21 @@ uint64_t *nested(NtpKs1 *pNK, uint32_t sizePNK, uint32_t authuid, uint32_t *keyC
|
||||
// This key can be found here two or more times
|
||||
if (ck[i].count > 0) {
|
||||
*keyCount += 1;
|
||||
void* tmp = realloc(keys, sizeof(uint64_t) * (*keyCount));
|
||||
void *tmp = realloc(keys, sizeof(uint64_t) * (*keyCount));
|
||||
if (tmp != NULL) {
|
||||
keys = tmp;
|
||||
keys[*keyCount - 1] = ck[i].key;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("Cannot allocate memory for keys on merge.");
|
||||
free(keys);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("Cannot allocate memory for ck on uniqsort.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("Cannot allocate memory to merge keys.\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user