diff --git a/3rdParty/LightPcapNg/CMakeLists.txt b/3rdParty/LightPcapNg/CMakeLists.txt index cc79a42b33..2f10732f09 100644 --- a/3rdParty/LightPcapNg/CMakeLists.txt +++ b/3rdParty/LightPcapNg/CMakeLists.txt @@ -24,13 +24,6 @@ add_library( target_compile_definitions(light_pcapng PUBLIC -DUNIVERSAL) -# FIXME: https://github.com/seladb/PcapPlusPlus/issues/1347 -include(CheckCCompilerFlag) -check_c_compiler_flag(-Wincompatible-pointer-types HAVE_W_INCOMPATIBLE_POINTER_TYPES) -if(HAVE_W_INCOMPATIBLE_POINTER_TYPES) - target_compile_options(light_pcapng PRIVATE -Wno-incompatible-pointer-types) -endif() - if(BUILD_SHARED_LIBS) set_property(TARGET light_pcapng PROPERTY POSITION_INDEPENDENT_CODE ON) endif() diff --git a/3rdParty/LightPcapNg/LightPcapNg/include/light_internal.h b/3rdParty/LightPcapNg/LightPcapNg/include/light_internal.h index ada7bed5a6..6ccd434eed 100644 --- a/3rdParty/LightPcapNg/LightPcapNg/include/light_internal.h +++ b/3rdParty/LightPcapNg/LightPcapNg/include/light_internal.h @@ -33,10 +33,7 @@ #include struct _light_pcapng_stream { - union { - FILE* fd; - void *reserved; - } stream; + struct light_file_t *file; // PCPP patch struct _light_pcapng *current_block; int valid; }; diff --git a/3rdParty/LightPcapNg/LightPcapNg/src/light_io.c b/3rdParty/LightPcapNg/LightPcapNg/src/light_io.c index 49d177ef7b..fef527785a 100644 --- a/3rdParty/LightPcapNg/LightPcapNg/src/light_io.c +++ b/3rdParty/LightPcapNg/LightPcapNg/src/light_io.c @@ -88,9 +88,9 @@ int light_pcapng_to_compressed_file(const char *file_name, const light_pcapng pc light_pcapng_stream light_open_stream(const char *file_name) { light_pcapng_stream pcapng = calloc(1, sizeof(struct _light_pcapng_stream)); - pcapng->stream.fd = light_open(file_name, LIGHT_OREAD); + pcapng->file = light_open(file_name, LIGHT_OREAD); // PCPP patch - if (pcapng->stream.fd == NULL) { + if (pcapng->file == NULL) { // PCPP patch free(pcapng); return NULL; } @@ -114,8 +114,9 @@ light_pcapng light_read_stream(light_pcapng_stream pcapng) pcapng->current_block = NULL; } - if (light_read(pcapng->stream.fd, &block_type, sizeof(block_type)) == -1 || - light_read(pcapng->stream.fd, &block_total_length, sizeof(block_total_length)) == -1) { + // PCPP patch + if (light_read(pcapng->file, &block_type, sizeof(block_type)) == -1 || + light_read(pcapng->file, &block_total_length, sizeof(block_total_length)) == -1) { pcapng->valid = 0; return NULL; } @@ -129,7 +130,8 @@ light_pcapng light_read_stream(light_pcapng_stream pcapng) block_data[0] = block_type; block_data[1] = block_total_length; - if (light_read(pcapng->stream.fd, &block_data[2], block_total_length - 2 * sizeof(uint32_t)) == -1) { + // PCPP patch + if (light_read(pcapng->file, &block_data[2], block_total_length - 2 * sizeof(uint32_t)) == -1) { free(block_data); pcapng->valid = 0; return NULL; @@ -152,7 +154,7 @@ int light_close_stream(light_pcapng_stream pcapng) pcapng->current_block = NULL; } - light_close(pcapng->stream.fd); + light_close(pcapng->file); // PCPP patch pcapng->valid = 0; free(pcapng); diff --git a/Packet++/src/Asn1Codec.cpp b/Packet++/src/Asn1Codec.cpp index e1c07d61b3..555b829861 100644 --- a/Packet++/src/Asn1Codec.cpp +++ b/Packet++/src/Asn1Codec.cpp @@ -621,7 +621,10 @@ namespace pcpp std::vector Asn1IntegerRecord::encodeValue() const { std::vector result; + + #if !(defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW32_MAJOR_VERSION)) result.reserve(m_ValueLength); + #endif switch (m_ValueLength) {