-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some XML validation to avoid xmpsdk bugs (backport #1878) #1880
Add some XML validation to avoid xmpsdk bugs (backport #1878) #1880
Conversation
…l?id=37363 Do some basic XML validation before running the xmpsdk library to avoid bugs in xmpsdk.
579d448
to
38022b5
Compare
55ba557
to
9722e03
Compare
Codecov Report
@@ Coverage Diff @@
## 0.27-maintenance #1880 +/- ##
====================================================
+ Coverage 46.21% 46.27% +0.06%
====================================================
Files 146 146
Lines 22874 22950 +76
Branches 11762 11780 +18
====================================================
+ Hits 10572 10621 +49
- Misses 6696 6713 +17
- Partials 5606 5616 +10
Continue to review full report at Codecov.
|
240136b
to
805fd80
Compare
Pull request has been modified.
I'm still fighting with cmake. Can't get it to link with libexpat on all platforms. |
Pull request has been modified.
@kevinbackhouse I use expat directly in samples/geotag.cpp. The CMake code to compile and link geotag is in samples/CMakeLists.txt if( EXPAT_FOUND )
add_executable( geotag geotag.cpp)
list(APPEND APPLICATIONS geotag)
target_link_libraries(geotag
PRIVATE
exiv2-xmp
${EXPAT_LIBRARIES}
)
target_include_directories(geotag PRIVATE ${CMAKE_BINARY_DIR}) # exv_conf.h
target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/include) # <exiv2/exiv2.hpp>
target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR})
target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h
if (WIN32)
target_compile_definitions(geotag PRIVATE XML_STATIC)
endif()
if (MSVC)
set_target_properties(geotag PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
install( TARGETS geotag RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif() If you only use the new class XMLvalidator in the exiv2 command-line program, you'll need to link expat in much the same way that I do for samples/geotag. If you use your new class in the Exiv2 library, you shouldn't need to link expat into every application. If an application isn't calling this explicitly, it should like as any other internal library code. However the library will probably need something similar to the geotag/CMake code to link and use expat. If you use your new class in the XMPsdk (which is what I thought you had done), you shouldn't need anything to link expat as the XMPsdk already links and uses expat. |
It looks this bit was the solution:
I have no idea what that does! |
@clanmills: regarding your comment about not linking expat when it isn't needed: I think that's something that I need to fix. Right now, I am linking with expat unconditionally. I see now that a lot of the code in |
6326635
to
41b84d2
Compare
I think it says "only real MSVC wizards can understand this shit". I just can't remember. I think it's probably better to use the same condition used for geotag.cpp: if (WIN32)
target_compile_definitions(geotag PRIVATE XML_STATIC)
endif() Good team work got us here. |
I totally agree. XMLvalidator should only be compiled and linked when XMPsdk is in the mix. It has no other purpose. It's possible for geotag to be used without XMPsdk. I didn't try to solve that and nobody has ever requested it. My attitude is:
// geotag.cpp
// Sample program to read gpx files and update images with GPS tags
// g++ geotag.cpp -o geotag -lexiv2 -lexpat |
Yup. @kevinbackhouse can you make two changes and then we're done:
When that passes the CI, I'll approve the change and we're done. And much the same with the The sun is just starting to come out in Camberley. Forecast is great from 17:00 onwards and good for Saturday and Sunday. |
41b84d2
to
ab170bf
Compare
This is an automatic backport of pull request #1878 done by Mergify.
Cherry-pick of b35cc5f has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
@Mergifyio refresh
will re-evaluate the rules@Mergifyio rebase
will rebase this PR on its base branch@Mergifyio update
will merge the base branch into this PR@Mergifyio backport <destination>
will backport this PR on<destination>
branchAdditionally, on Mergify dashboard you can:
Finally, you can contact us on https://mergify.io/