fix MSVC compiler warnings
This commit is contained in:
@@ -26,7 +26,7 @@ set_source_files_properties(${SWIG_INTERFACE_FILE} PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
include_directories(
|
||||
"${RESOURCES_SWIG_DIR}/include"
|
||||
"${CORE_SOURCE_DIR}/include"
|
||||
"../core/include"
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
+27
-14
@@ -10,9 +10,21 @@ configure_file(
|
||||
${GENERATED_VERSION_FILE}
|
||||
)
|
||||
|
||||
set(EXTERNAL_FILES
|
||||
../external/cpp_sqlite/src/CppSQLite3.cpp
|
||||
../external/json/include/json.hpp
|
||||
../external/cpp_sqlite/include/CppSQLite3.h
|
||||
)
|
||||
|
||||
set(EXTERNAL_C_FILES
|
||||
../external/cpp_sqlite/src/sqlite3.c
|
||||
../external/cpp_sqlite/include/sqlite3.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w")
|
||||
set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w")
|
||||
|
||||
set(LIB_SRC_FILES
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/src/CppSQLite3.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/src/sqlite3.c"
|
||||
src/DatabaseStorage.cpp
|
||||
src/DefinitionKind.cpp
|
||||
src/EdgeKind.cpp
|
||||
@@ -27,9 +39,6 @@ set(LIB_SRC_FILES
|
||||
)
|
||||
|
||||
set(LIB_HDR_FILES
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include/json.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include/CppSQLite3.h"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include/sqlite3.h"
|
||||
include/DatabaseStorage.h
|
||||
include/DefinitionKind.h
|
||||
include/EdgeKind.h
|
||||
@@ -55,17 +64,21 @@ set(LIB_HDR_FILES
|
||||
${GENERATED_VERSION_FILE}
|
||||
)
|
||||
|
||||
add_library(${LIB_CORE_TARGET_NAME} STATIC ${LIB_SRC_FILES} ${LIB_HDR_FILES})
|
||||
add_library(${LIB_CORE_TARGET_NAME} STATIC ${LIB_SRC_FILES} ${LIB_HDR_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES})
|
||||
|
||||
set_target_properties(${LIB_CORE_TARGET_NAME} PROPERTIES OUTPUT_NAME "sourcetraildb")
|
||||
|
||||
target_include_directories(${LIB_CORE_TARGET_NAME} PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include"
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
set_property(
|
||||
TARGET ${LIB_CORE_TARGET_NAME}
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_CORE_TARGET_NAME} SYSTEM
|
||||
PUBLIC ../external/json/include
|
||||
PUBLIC ../external/cpp_sqlite/include
|
||||
)
|
||||
|
||||
set(TEST_SRC_FILES
|
||||
test/test.cpp
|
||||
@@ -75,9 +88,9 @@ add_executable(${TEST_CORE_TARGET_NAME} ${TEST_SRC_FILES})
|
||||
|
||||
target_include_directories(${TEST_CORE_TARGET_NAME} PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/catch/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/json/include"
|
||||
"${CMAKE_SOURCE_DIR}/external/cpp_sqlite/include"
|
||||
../external/catch/include
|
||||
../external/json/include
|
||||
../external/cpp_sqlite/include
|
||||
"${GENERATED_INCLUDE_DIRECTORY}"
|
||||
)
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ int DatabaseStorage::addElementComponent(const StorageElementComponentData& stor
|
||||
m_insertElementComponentStatement.bind(2, storageElementComponentData.componentKind);
|
||||
m_insertElementComponentStatement.bind(3, storageElementComponentData.data.c_str());
|
||||
executeStatement(m_insertElementComponentStatement);
|
||||
int id = m_database.lastRowId();
|
||||
const int id = static_cast<int>(m_database.lastRowId());
|
||||
m_insertElementComponentStatement.reset();
|
||||
return id;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ int DatabaseStorage::addSourceLocation(const StorageSourceLocationData& storageS
|
||||
m_insertSourceLocationStmt.bind(5, storageSourceLocationData.endColumnNumber);
|
||||
m_insertSourceLocationStmt.bind(6, storageSourceLocationData.locationKind);
|
||||
executeStatement(m_insertSourceLocationStmt);
|
||||
id = m_database.lastRowId();
|
||||
id = static_cast<int>(m_database.lastRowId());
|
||||
m_insertSourceLocationStmt.reset();
|
||||
}
|
||||
return id;
|
||||
@@ -360,7 +360,7 @@ int DatabaseStorage::addError(const StorageErrorData& storageErrorData)
|
||||
m_insertErrorStatement.bind(4, storageErrorData.indexed);
|
||||
m_insertErrorStatement.bind(5, storageErrorData.translationUnit.c_str());
|
||||
executeStatement(m_insertErrorStatement);
|
||||
id = m_database.lastRowId();
|
||||
id = static_cast<int>(m_database.lastRowId());
|
||||
m_insertErrorStatement.reset();
|
||||
}
|
||||
return id;
|
||||
@@ -641,7 +641,7 @@ void DatabaseStorage::clearPrecompiledStatements()
|
||||
int DatabaseStorage::insertElement()
|
||||
{
|
||||
executeStatement(m_insertElementStatement);
|
||||
int id = m_database.lastRowId();
|
||||
const int id = static_cast<int>(m_database.lastRowId());
|
||||
m_insertElementStatement.reset();
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,10 @@ std::string getFileContent(const std::string& filePath)
|
||||
|
||||
std::string getDateTimeString(const time_t& time)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
std::tm* ptm = std::localtime(&time);
|
||||
#pragma warning(pop)
|
||||
char buffer[32];
|
||||
std::strftime(buffer, 32, "%Y-%m-%d %H:%M:%S", ptm);
|
||||
return buffer;
|
||||
@@ -64,7 +67,7 @@ std::string getDateTimeString(const time_t& time)
|
||||
|
||||
int getLineCount(const std::string s)
|
||||
{
|
||||
return std::count(s.begin(), s.end(), '\n');
|
||||
return static_cast<int>(std::count(s.begin(), s.end(), '\n'));
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace sourcetrail
|
||||
|
||||
Reference in New Issue
Block a user