Using stdint.h types and standard C file functions
Opened this issue · 1 comments
zzMcGee commented
Suggestions so your wonderful utility also works on Windows/Visual Studio compiler:
- Use standard C file functions
fopen()/fclose()/fread()
instead POSIXopen()/close()/read()
. - Update to use stdint.h
uint16_t/uint32_t
instead ofu_int16_t/u_int32_t
- If windows compiler
#if defined(MSC_VER)
then includewinsock2.h
; otherwise, includearpa/inet.h
andunistd.h
.
Suggestion to avoid stack overflow:
- For large arrays (e.g., "hcodeIE/hcodeIO/hcodeQE/hcodeQO/BRCn/THIDXn" in packet_decode.c and "tablo" in read_file.c) put them in global (.data/.bss) section instead of allocating on stack, e.g., :
(suggested update)
static unsigned char tablo[65536];
vs. (original)
unsigned char tablo[65536];
Thanks!