mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-28 07:56:23 +08:00
silent some bad-function-cast
This commit is contained in:
parent
723503b74e
commit
58f71d97f5
6 changed files with 15 additions and 11 deletions
|
@ -47,9 +47,9 @@ endif
|
|||
|
||||
DEFCFLAGS = -Wall -Werror -O3
|
||||
# Some more warnings we want as errors:
|
||||
DEFCFLAGS += -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations
|
||||
DEFCFLAGS += -Wcast-align -Wbad-function-cast -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations
|
||||
# Some more warnings we need first to eliminate, so temporarely tolerated:
|
||||
DEFCFLAGS += -Wbad-function-cast -Wno-error=bad-function-cast -Wcast-align -Wno-error=cast-align
|
||||
DEFCFLAGS += -Wno-error=cast-align
|
||||
# TODO?:
|
||||
#DEFCFLAGS += -Wextra -Wswitch-enum -Wold-style-definition
|
||||
|
||||
|
|
|
@ -793,7 +793,8 @@ static void update_p_K(void) {
|
|||
}
|
||||
for (uint8_t sum_a8_idx = 0; sum_a8_idx < NUM_SUMS; sum_a8_idx++) {
|
||||
uint16_t sum_a8 = sums[sum_a8_idx];
|
||||
my_p_K[sum_a8_idx] = (float)estimated_num_states_coarse(sum_a0, sum_a8) / total_count;
|
||||
float f = estimated_num_states_coarse(sum_a0, sum_a8);
|
||||
my_p_K[sum_a8_idx] = f / total_count;
|
||||
}
|
||||
// PrintAndLogEx(NORMAL, "my_p_K = [");
|
||||
// for (uint8_t sum_a8_idx = 0; sum_a8_idx < NUM_SUMS; sum_a8_idx++) {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -70,9 +69,9 @@ static uint64_t getJablontronCardId(uint64_t rawcode) {
|
|||
uint64_t id = 0;
|
||||
uint8_t bytes[] = {0, 0, 0, 0, 0};
|
||||
num_to_bytes(rawcode, 5, bytes);
|
||||
for (int i = 4, j = 0; i > -1; --i, j += 2) {
|
||||
id += NIBBLE_LOW(bytes[i]) * (int)pow(10, j);
|
||||
id += NIBBLE_HIGH(bytes[i]) * (int)pow(10, j + 1);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
id *= 100;
|
||||
id += NIBBLE_HIGH(bytes[i]) * 10 + NIBBLE_LOW(bytes[i]);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -203,7 +203,8 @@ static int l_unpack(lua_State *L) { /** unpack(f,s, [init]) */
|
|||
#define PACKNUMBER(OP,T) \
|
||||
case OP: \
|
||||
{ \
|
||||
T a=(T)luaL_checknumber(L,i++); \
|
||||
lua_Number n = luaL_checknumber(L,i++); \
|
||||
T a=(T)n; \
|
||||
doswap(swap,&a,sizeof(a)); \
|
||||
luaL_addlstring(&b,(char*)&a,sizeof(a)); \
|
||||
break; \
|
||||
|
|
|
@ -92,16 +92,18 @@ typedef size_t lua_UInteger;
|
|||
#define LOGICAL_SHIFT(name, op) \
|
||||
static int bit_ ## name(lua_State *L) { \
|
||||
lua_Number f; \
|
||||
lua_Number n = luaL_checknumber(L, 2); \
|
||||
lua_pushinteger(L, BIT_TRUNCATE(BIT_TRUNCATE((lua_UInteger)TOBIT(L, 1, f)) op \
|
||||
(unsigned)luaL_checknumber(L, 2))); \
|
||||
(unsigned)n)); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define ARITHMETIC_SHIFT(name, op) \
|
||||
static int bit_ ## name(lua_State *L) { \
|
||||
lua_Number f; \
|
||||
lua_Number n = luaL_checknumber(L, 2); \
|
||||
lua_pushinteger(L, BIT_TRUNCATE((lua_Integer)TOBIT(L, 1, f) op \
|
||||
(unsigned)luaL_checknumber(L, 2))); \
|
||||
(unsigned)n)); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,8 @@ int WAI_PREFIX(getModulePath)(char *out, int capacity, int *dirname_length) {
|
|||
break;
|
||||
|
||||
if (sscanf(buffer, "%" SCNx64 "-%" SCNx64 " %s %" SCNx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8) {
|
||||
uint64_t addr = (uint64_t)(uintptr_t)WAI_RETURN_ADDRESS();
|
||||
void *addr_tmp = WAI_RETURN_ADDRESS();
|
||||
uint64_t addr = (uint64_t)addr_tmp;
|
||||
if (low <= addr && addr <= high) {
|
||||
char *resolved;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue