mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
crack5opencl: Fix various printf compilation errors when enabling debug macros
This commit is contained in:
parent
4e29dfa2b5
commit
ead228672a
4 changed files with 18 additions and 13 deletions
|
@ -1,3 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#include "ht2crack5opencl.h"
|
||||
#include "hitag2.h"
|
||||
|
||||
|
|
|
@ -1011,7 +1011,7 @@ int main(int argc, char **argv) {
|
|||
// at this point z is the max value, still usefulfor free's
|
||||
|
||||
#if DEBUGME > 0
|
||||
printf("[debug] Lower profile between %u device(s) is: %d\n", selected_devices_cnt, profile);
|
||||
printf("[debug] Lower profile between %zu device(s) is: %d\n", selected_devices_cnt, profile);
|
||||
#endif
|
||||
|
||||
uint32_t max_step = profiles[profile][0];
|
||||
|
@ -1102,9 +1102,9 @@ int main(int argc, char **argv) {
|
|||
if (ctx.thread_sched_type == THREAD_TYPE_ASYNC) {
|
||||
size_t th_status_err = 0;
|
||||
for (z = 0; z < thread_count; z++) {
|
||||
pthread_mutex_lock(&thread_mutexs[z]);
|
||||
pthread_mutex_lock(&th_ctx.thread_mutexs[z]);
|
||||
thread_status_t tmp = t_arg[z].status;
|
||||
pthread_mutex_unlock(&thread_mutexs[z]);
|
||||
pthread_mutex_unlock(&th_ctx.thread_mutexs[z]);
|
||||
|
||||
if (tmp != TH_START) {
|
||||
printf("! Warning: Thread %zu is not in TH_START, found in %s\n", z, thread_status_strdesc(tmp));
|
||||
|
|
|
@ -54,7 +54,7 @@ unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_pla
|
|||
if (!cd_ctx[x].device[y].selected) continue;
|
||||
|
||||
#if DEBUGME > 1
|
||||
printf("[debug] Initial profile for device %zu: %d\n", z, cd_ctx[x].device[y].profile);
|
||||
printf("[debug] Initial profile for device %zu: %d\n", y, cd_ctx[x].device[y].profile);
|
||||
#endif
|
||||
|
||||
// with same devices will be selected the best
|
||||
|
|
|
@ -510,17 +510,17 @@ void *computing_process(void *arg) {
|
|||
a->slice = wu.id + 1;
|
||||
|
||||
if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) {
|
||||
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
|
||||
#if DEBUGME > 0
|
||||
printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
|
||||
printf("[%zu] Slice %5zu (off %6zu), max %5zu, remain %5zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
|
||||
#else
|
||||
printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
|
||||
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
|
||||
printf("\r[%zu] Slice %5zu/%5zu (%5zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
|
||||
#endif // DEBUGME
|
||||
} else {
|
||||
float progress = (((wu.id + 1) * 100.0) / wu.max);
|
||||
#if DEBUGME > 0
|
||||
printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off);
|
||||
#else
|
||||
float progress = (((wu.id + 1) * 100.0) / wu.max);
|
||||
printf("\r[%zu] Slice %zu/%zu ( %2.1f%% )", z, wu.id + 1, wu.max, progress);
|
||||
#endif // DEBUGME
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void *computing_process_async(void *arg) {
|
|||
|
||||
if (status == TH_START) {
|
||||
#if TDEBUG >= 1
|
||||
printf("[%s][%zu] plat id %d, uid %u, aR2 %u, nR1 %u, nR2 %u, Initial status: %s\n", __func__, z, ctx->id_platform, uid, aR2, nR1, nR2, thread_status_strdesc(status));
|
||||
printf("[%s][%zu] uid %u, aR2 %u, nR1 %u, nR2 %u, Initial status: %s\n", __func__, z, uid, aR2, nR1, nR2, thread_status_strdesc(status));
|
||||
#endif
|
||||
status = TH_WAIT;
|
||||
// proceed to next
|
||||
|
@ -665,17 +665,17 @@ void *computing_process_async(void *arg) {
|
|||
a->slice = wu.id + 1;
|
||||
|
||||
if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) {
|
||||
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
|
||||
#if DEBUGME > 0
|
||||
printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
|
||||
printf("[%zu] Slice %5zu (off %6zu), max %5zu, remain %5zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem);
|
||||
#else
|
||||
printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
|
||||
float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max);
|
||||
printf("\r[%zu] Slice %5zu/%5zu (%5zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress);
|
||||
#endif // DEBUGME
|
||||
} else {
|
||||
float progress = (((wu.id + 1) * 100.0) / wu.max);
|
||||
#if DEBUGME > 0
|
||||
printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off);
|
||||
#else
|
||||
float progress = (((wu.id + 1) * 100.0) / wu.max);
|
||||
printf("\r[%zu] Slice %zu/%zu ( %2.1f%% )", z, wu.id + 1, wu.max, progress);
|
||||
#endif // DEBUGME
|
||||
}
|
||||
|
@ -772,7 +772,11 @@ void *computing_process_async(void *arg) {
|
|||
a->quit = true;
|
||||
pthread_mutex_unlock(&a->thread_ctx->thread_mutexs[z]);
|
||||
#if TDEBUG >= 1
|
||||
#ifdef _ISOC99_SOURCE
|
||||
printf("[%s][%zu] master, I found the key ! state %U64x, slice %zu\n", __func__, z, a->s, a->slice + 1);
|
||||
#else
|
||||
printf("[%s][%zu] master, I found the key ! state %" STR(OFF_FORMAT_U) ", slice %zu\n", __func__, z, a->s, a->slice + 1);
|
||||
#endif
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue