mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge John Ralls's 'asan' into stable.
This commit is contained in:
@@ -43,6 +43,10 @@ if (WITH_SQL)
|
||||
set_target_properties (gncmod-backend-dbi PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
|
||||
endif()
|
||||
|
||||
if (COVERAGE)
|
||||
add_coverage_target(gncmod-backend-dbi)
|
||||
endif()
|
||||
|
||||
install(TARGETS gncmod-backend-dbi
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
|
||||
|
@@ -1030,7 +1030,7 @@ template<> bool
|
||||
QofDbiBackendProvider<DbType::DBI_SQLITE>::type_check(const char *uri)
|
||||
{
|
||||
FILE* f;
|
||||
gchar buf[50];
|
||||
gchar buf[51]{};
|
||||
G_GNUC_UNUSED size_t chars_read;
|
||||
gint status;
|
||||
gchar* filename;
|
||||
@@ -1050,7 +1050,7 @@ QofDbiBackendProvider<DbType::DBI_SQLITE>::type_check(const char *uri)
|
||||
}
|
||||
|
||||
// OK if file has the correct header
|
||||
chars_read = fread (buf, sizeof (buf), 1, f);
|
||||
chars_read = fread (buf, sizeof (buf) - 1, 1, f);
|
||||
status = fclose (f);
|
||||
if (status < 0)
|
||||
{
|
||||
|
@@ -80,5 +80,9 @@ if(WITH_SQL)
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
if (COVERAGE)
|
||||
add_coverage_target(gnc-backend-sql)
|
||||
endif()
|
||||
|
||||
# No headers to install
|
||||
endif()
|
||||
|
@@ -96,6 +96,10 @@ install(TARGETS gnc-backend-xml-utils
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
# No headers to install
|
||||
if (COVERAGE)
|
||||
add_coverage_target(gnc-backend-xml-utils)
|
||||
endif()
|
||||
|
||||
|
||||
# ----
|
||||
|
||||
@@ -119,6 +123,10 @@ if (APPLE)
|
||||
set_target_properties (gncmod-backend-xml PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
if (COVERAGE)
|
||||
add_coverage_target(gncmod-backend-xml)
|
||||
endif()
|
||||
|
||||
install(TARGETS gncmod-backend-xml
|
||||
LIBRARY DESTINATION ${LIB_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_DIR}
|
||||
|
@@ -234,7 +234,9 @@ GncXmlBackend::load(QofBook* book, QofBackendLoadType loadType)
|
||||
if (loadType != LOAD_TYPE_INITIAL_LOAD) return;
|
||||
|
||||
error = ERR_BACKEND_NO_ERR;
|
||||
m_book = book;
|
||||
if (m_book)
|
||||
g_object_unref(m_book);
|
||||
m_book = QOF_BOOK(g_object_ref(book));
|
||||
|
||||
int rc;
|
||||
switch (determine_file_type (m_fullpath))
|
||||
@@ -306,7 +308,8 @@ GncXmlBackend::sync(QofBook* book)
|
||||
* for multiple books have been removed in the meantime and there is just one
|
||||
* book, no more.
|
||||
*/
|
||||
if (m_book == nullptr) m_book = book;
|
||||
if (m_book == nullptr)
|
||||
m_book = QOF_BOOK(g_object_ref(book));
|
||||
if (book != m_book) return;
|
||||
|
||||
if (qof_book_is_readonly (m_book))
|
||||
|
@@ -13,7 +13,7 @@ set(XML_TEST_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
|
||||
set(XML_TEST_LIBS gnc-engine gnc-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
|
||||
set(XML_TEST_LIBS gnc-backend-xml-utils gnc-engine gnc-test-engine test-core ${LIBXML2_LDFLAGS} -lz)
|
||||
set(XML_GTEST_LIBS ${XML_TEST_LIBS} gtest)
|
||||
|
||||
function(add_xml_test _TARGET _SOURCE_FILES)
|
||||
@@ -26,40 +26,6 @@ function(add_xml_gtest _TARGET _SOURCE_FILES)
|
||||
target_compile_options(${_TARGET} PRIVATE -DU_SHOW_CPLUSPLUS_API=0 -DG_LOG_DOMAIN=\"gnc.backend.xml\")
|
||||
endfunction()
|
||||
|
||||
################################
|
||||
|
||||
set(test_backend_xml_base_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-dom-parsers.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-dom-generators.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-utils.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-stack.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/sixtp-to-dom-parser.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-xml-helper.cpp
|
||||
)
|
||||
|
||||
## the xml backend is now a GModule - this test does
|
||||
## not load it as a module and cannot link to it
|
||||
## and remain portable.
|
||||
|
||||
set(test_backend_xml_module_SOURCES
|
||||
${test_backend_xml_base_SOURCES}
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-example-account.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-gncxml-gen.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-gncxml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/io-utils.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-account-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-budget-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-lot-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-recurrence-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-freqspec-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-transaction-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-commodity-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-book-xml-v2.cpp
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml/gnc-pricedb-xml-v2.cpp
|
||||
)
|
||||
|
||||
set_local_dist(test_backend_xml_DIST_local
|
||||
CMakeLists.txt
|
||||
grab-types.pl
|
||||
@@ -84,8 +50,8 @@ set_local_dist(test_backend_xml_DIST_local
|
||||
)
|
||||
set(test_backend_xml_DIST ${test_backend_xml_DIST_local} ${test_backend_xml_test_files_DIST} PARENT_SCOPE)
|
||||
|
||||
add_xml_test(test-dom-converters1 "${test_backend_xml_base_SOURCES};test-dom-converters1.cpp")
|
||||
add_xml_test(test-kvp-frames "${test_backend_xml_base_SOURCES};test-kvp-frames.cpp")
|
||||
add_xml_test(test-dom-converters1 "test-dom-converters1.cpp")
|
||||
add_xml_test(test-kvp-frames "test-kvp-frames.cpp")
|
||||
add_xml_test(test-load-backend test-load-backend.cpp)
|
||||
add_xml_test(test-load-xml2 test-load-xml2.cpp
|
||||
GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2
|
||||
@@ -96,19 +62,19 @@ add_xml_test(test-load-xml2 test-load-xml2.cpp
|
||||
#)
|
||||
|
||||
add_xml_test(test-load-example-account
|
||||
"${test_backend_xml_module_SOURCES};test-load-example-account.cpp"
|
||||
"test-load-example-account.cpp"
|
||||
GNC_ACCOUNT_PATH=${CMAKE_SOURCE_DIR}/data/accounts/C
|
||||
)
|
||||
target_compile_options(test-load-example-account PRIVATE -DU_SHOW_CPLUSPLUS_API=0)
|
||||
add_xml_gtest(test-load-save-files gtest-load-save-files.cpp
|
||||
GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/load-save
|
||||
)
|
||||
add_xml_test(test-string-converters "${test_backend_xml_base_SOURCES};test-string-converters.cpp")
|
||||
add_xml_test(test-xml-account "${test_backend_xml_module_SOURCES};test-xml-account.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-commodity "${test_backend_xml_module_SOURCES};test-xml-commodity.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-pricedb "${test_backend_xml_module_SOURCES};test-xml-pricedb.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-transaction "${test_backend_xml_module_SOURCES};test-xml-transaction.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml2-is-file "${test_backend_xml_module_SOURCES};test-xml2-is-file.cpp"
|
||||
add_xml_test(test-string-converters "test-string-converters.cpp")
|
||||
add_xml_test(test-xml-account "test-xml-account.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-commodity "test-xml-commodity.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-pricedb "test-xml-pricedb.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml-transaction "test-xml-transaction.cpp;test-file-stuff.cpp")
|
||||
add_xml_test(test-xml2-is-file "test-xml2-is-file.cpp"
|
||||
GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2)
|
||||
|
||||
set(test-real-data-env
|
||||
|
Reference in New Issue
Block a user