diff --git a/examples/ragephoto-gtkviewer/CMakeLists.txt b/examples/ragephoto-gtkviewer/CMakeLists.txt index 707ae22..be78730 100644 --- a/examples/ragephoto-gtkviewer/CMakeLists.txt +++ b/examples/ragephoto-gtkviewer/CMakeLists.txt @@ -43,7 +43,7 @@ else() pkg_check_modules(RAGEPHOTO REQUIRED ragephoto) endif() -add_executable(ragephoto-gtkviewer ${GTKVIEWER_HEADERS} ${GTKVIEWER_SOURCES}) +add_executable(ragephoto-gtkviewer WIN32 ${GTKVIEWER_HEADERS} ${GTKVIEWER_SOURCES}) target_compile_options(ragephoto-gtkviewer PRIVATE ${GTKMM_CFLAGS} ${RAGEPHOTO_CFLAGS}) target_link_libraries(ragephoto-gtkviewer PRIVATE ${GTKMM_LIBRARIES} ${RAGEPHOTO_LIBRARIES}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.13.0") diff --git a/examples/ragephoto-qtviewer/CMakeLists.txt b/examples/ragephoto-qtviewer/CMakeLists.txt index 6d1ea5c..16dbb9b 100644 --- a/examples/ragephoto-qtviewer/CMakeLists.txt +++ b/examples/ragephoto-qtviewer/CMakeLists.txt @@ -44,7 +44,7 @@ else() pkg_check_modules(RAGEPHOTO REQUIRED ragephoto) endif() -add_executable(ragephoto-qtviewer ${QTVIEWER_SOURCES}) +add_executable(ragephoto-qtviewer WIN32 ${QTVIEWER_SOURCES}) target_compile_options(ragephoto-qtviewer PRIVATE ${RAGEPHOTO_CFLAGS}) target_link_libraries(ragephoto-qtviewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ${RAGEPHOTO_LIBRARIES}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.13.0") diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp index 1c2aeee..41731d7 100644 --- a/src/RagePhoto.cpp +++ b/src/RagePhoto.cpp @@ -95,7 +95,7 @@ bool RagePhoto::load(const char *data, size_t length) } #ifdef CODECVT_COMPATIBLE - std::wstring_convert,char16_t> convert; + std::wstring_convert,char16_t> convert; p_photoString = convert.to_bytes(reinterpret_cast(photoHeader)); #elif defined ICONV_COMPATIBLE iconv_t iconv_in = iconv_open("UTF-8", "UTF-16LE"); @@ -444,7 +444,7 @@ bool RagePhoto::save(char *data, PhotoFormat photoFormat) if (photoFormat == PhotoFormat::GTA5 || photoFormat == PhotoFormat::RDR2) { #if defined CODECVT_COMPATIBLE || defined ICONV_COMPATIBLE #ifdef CODECVT_COMPATIBLE - std::wstring_convert,char16_t> convert; + std::wstring_convert,char16_t> convert; std::u16string photoString = convert.from_bytes(p_photoString); const size_t photoHeader_size = photoString.size() * 2; if (photoHeader_size > 256) { @@ -796,7 +796,7 @@ void RagePhoto::moveOffsets() p_endOfFile = p_descOffset + p_descBuffer + 12; } -size_t RagePhoto::readBuffer(const char *input, char *output, size_t *pos, size_t len, size_t inputLen) +size_t RagePhoto::readBuffer(const char *input, void *output, size_t *pos, size_t len, size_t inputLen) { size_t readLen = 0; if (*pos >= inputLen) @@ -804,12 +804,12 @@ size_t RagePhoto::readBuffer(const char *input, char *output, size_t *pos, size_ readLen = inputLen - *pos; if (readLen > len) readLen = len; - memcpy(output, &input[*pos], readLen); + memcpy(output, reinterpret_cast(&input[*pos]), readLen); *pos = *pos + readLen; return readLen; } -size_t RagePhoto::writeBuffer(const char *input, char *output, size_t *pos, size_t len, size_t inputLen) +size_t RagePhoto::writeBuffer(const void *input, char *output, size_t *pos, size_t len, size_t inputLen) { const size_t maxLen = len - *pos; size_t writeLen = inputLen; @@ -817,7 +817,7 @@ size_t RagePhoto::writeBuffer(const char *input, char *output, size_t *pos, size return 0; if (inputLen > maxLen) writeLen = maxLen; - memcpy(&output[*pos], input, writeLen); + memcpy(reinterpret_cast(&output[*pos]), input, writeLen); *pos = *pos + writeLen; return writeLen; } diff --git a/src/RagePhoto.h b/src/RagePhoto.h index df427ee..a7acaac 100644 --- a/src/RagePhoto.h +++ b/src/RagePhoto.h @@ -147,8 +147,8 @@ public: protected: inline void moveOffsets(); - inline size_t readBuffer(const char *input, char *output, size_t *pos, size_t len, size_t inputLen); - inline size_t writeBuffer(const char *input, char *output, size_t *pos, size_t len, size_t inputLen); + inline size_t readBuffer(const char *input, void *output, size_t *pos, size_t len, size_t inputLen); + inline size_t writeBuffer(const void *input, char *output, size_t *pos, size_t len, size_t inputLen); inline uint32_t charToUInt32LE(char *x); inline void uInt32ToCharLE(uint32_t x, char *y); bool p_photoLoaded; diff --git a/tests/CodecvtTest.cpp b/tests/CodecvtTest.cpp index 83122e4..f5adce2 100644 --- a/tests/CodecvtTest.cpp +++ b/tests/CodecvtTest.cpp @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - std::wstring_convert,char16_t> convert; + std::wstring_convert,char16_t> convert; std::string photoString = convert.to_bytes(reinterpret_cast(photoHeader)); return strcmp(photoString.c_str(), "PHOTO - 02/01/17 08:42:44"); }