mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
binpac: Add cmake-format and typos pre-commit configs
This commit is contained in:
parent
3297de477b
commit
964817f9bf
8 changed files with 108 additions and 104 deletions
|
@ -7,61 +7,55 @@ check_type_size("unsigned int" SIZEOF_UNSIGNED_INT)
|
|||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/binpac.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/binpac.h)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(binpac_headers
|
||||
${CMAKE_CURRENT_BINARY_DIR}/binpac.h
|
||||
binpac_analyzer.h
|
||||
binpac_buffer.h
|
||||
binpac_bytestring.h
|
||||
binpac_exception.h
|
||||
binpac_regex.h
|
||||
)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/binpac.h binpac_analyzer.h binpac_buffer.h
|
||||
binpac_bytestring.h binpac_exception.h binpac_regex.h)
|
||||
|
||||
set(binpac_lib_SRCS
|
||||
binpac_buffer.cc
|
||||
binpac_bytestring.cc
|
||||
binpac_regex.cc
|
||||
${binpac_headers}
|
||||
)
|
||||
set(binpac_lib_SRCS binpac_buffer.cc binpac_bytestring.cc binpac_regex.cc
|
||||
${binpac_headers})
|
||||
|
||||
if ( ENABLE_SHARED )
|
||||
if(ENABLE_SHARED)
|
||||
add_library(binpac_lib SHARED ${binpac_lib_SRCS})
|
||||
target_compile_features(binpac_lib PRIVATE cxx_std_17)
|
||||
set_target_properties(binpac_lib PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
SOVERSION ${BINPAC_SOVERSION}
|
||||
VERSION ${BINPAC_VERSION_MAJOR}.${BINPAC_VERSION_MINOR}
|
||||
MACOSX_RPATH true
|
||||
OUTPUT_NAME binpac)
|
||||
set_target_properties(
|
||||
binpac_lib
|
||||
PROPERTIES CXX_EXTENSIONS OFF
|
||||
SOVERSION ${BINPAC_SOVERSION}
|
||||
VERSION ${BINPAC_VERSION_MAJOR}.${BINPAC_VERSION_MINOR}
|
||||
MACOSX_RPATH true
|
||||
OUTPUT_NAME binpac)
|
||||
install(TARGETS binpac_lib DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if ( ENABLE_STATIC )
|
||||
if(ENABLE_STATIC)
|
||||
add_library(binpac_static STATIC ${binpac_lib_SRCS})
|
||||
target_compile_features(binpac_static PRIVATE cxx_std_17)
|
||||
set_target_properties(binpac_static PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
OUTPUT_NAME binpac)
|
||||
set_target_properties(binpac_static PROPERTIES CXX_EXTENSIONS OFF OUTPUT_NAME
|
||||
binpac)
|
||||
install(TARGETS binpac_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if ( ZEEK_ROOT_DIR )
|
||||
# Installed in binpac subdir just for organization purposes.
|
||||
install(FILES ${binpac_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/binpac)
|
||||
else ()
|
||||
install(FILES ${binpac_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif ()
|
||||
if(ZEEK_ROOT_DIR)
|
||||
# Installed in binpac subdir just for organization purposes.
|
||||
install(FILES ${binpac_headers}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/binpac)
|
||||
else()
|
||||
install(FILES ${binpac_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
# This is set to assist superprojects that want to build BinPac
|
||||
# from source and rely on it as a target
|
||||
if ( ENABLE_SHARED )
|
||||
set(BinPAC_LIBRARY binpac_lib CACHE STRING "BinPAC library" FORCE)
|
||||
else ()
|
||||
set(BinPAC_LIBRARY binpac_static CACHE STRING "BinPAC library" FORCE)
|
||||
endif ()
|
||||
# This is set to assist superprojects that want to build BinPac from source and
|
||||
# rely on it as a target
|
||||
if(ENABLE_SHARED)
|
||||
set(BinPAC_LIBRARY
|
||||
binpac_lib
|
||||
CACHE STRING "BinPAC library" FORCE)
|
||||
else()
|
||||
set(BinPAC_LIBRARY
|
||||
binpac_static
|
||||
CACHE STRING "BinPAC library" FORCE)
|
||||
endif()
|
||||
|
||||
set(BinPAC_INCLUDE_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
CACHE STRING "BinPAC header directories" FORCE
|
||||
)
|
||||
CACHE STRING "BinPAC header directories" FORCE)
|
||||
|
|
|
@ -72,6 +72,8 @@ inline uint16 pac_swap(const uint16 x)
|
|||
|
||||
inline int16 pac_swap(const int16 x)
|
||||
{
|
||||
// Forward to unsigned version with argument/result casted
|
||||
// appropriately.
|
||||
uint16 (*p)(const uint16) = &pac_swap;
|
||||
return (*p)(x);
|
||||
}
|
||||
|
@ -86,6 +88,8 @@ inline uint32 pac_swap(const uint32 x)
|
|||
|
||||
inline int32 pac_swap(const int32 x)
|
||||
{
|
||||
// Forward to unsigned version with argument/result casted
|
||||
// appropriately.
|
||||
uint32 (*p)(const uint32) = &pac_swap;
|
||||
return (*p)(x);
|
||||
}
|
||||
|
@ -104,6 +108,8 @@ inline uint64 pac_swap(const uint64 x)
|
|||
|
||||
inline int64 pac_swap(const int64 x)
|
||||
{
|
||||
// Forward to unsigned version with argument/result casted
|
||||
// appropriately.
|
||||
uint64 (*p)(const uint64) = &pac_swap;
|
||||
return (*p)(x);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
// Interface for delayed parsing. Sometimes BinPAC doesn't get the
|
||||
// buffering right and then one can use these to feed parts
|
||||
// individually and assemble them internally. After calling
|
||||
// FinishBuffer(), one can send the uppper-layer flow an FlowEOF() to
|
||||
// FinishBuffer(), one can send the upper-layer flow an FlowEOF() to
|
||||
// trigger parsing.
|
||||
void BufferData(const_byteptr data, const_byteptr end);
|
||||
void FinishBuffer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue