Skip to content

Commit ff3aa11

Browse files
committed
make endian functions generic to work with any type
1 parent 37a56fc commit ff3aa11

File tree

7 files changed

+97
-329
lines changed

7 files changed

+97
-329
lines changed

PhotoshopAPI/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ if(MSVC)
3434
# w45264 is for using std:move when returning a temporary.
3535
target_compile_options(PhotoshopAPI PRIVATE /W4 /WX /w44062 /w44464 /w45264)
3636
else()
37-
target_compile_options(PhotoshopAPI PUBLIC -O3)
37+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
38+
target_compile_options(PhotoshopAPI PUBLIC -O3 -Wuninitialized -Wmaybe-uninitialized)
39+
else()
40+
target_compile_options(PhotoshopAPI PUBLIC -O3)
41+
endif()
3842
include(CheckCXXCompilerFlag)
3943
check_cxx_compiler_flag("-mavx2" COMPILER_SUPPORTS_AVX2)
4044
if(COMPILER_SUPPORTS_AVX2)

PhotoshopAPI/src/Core/Compression/Compress_RLE.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ std::vector<uint8_t> CompressRLE(std::vector<T>& uncompressedData, const FileHea
416416
PSAPI_LOG_ERROR("CompressRLE", "Scanline sizes cannot exceed the numeric limits of 16-bit values when writing a PSD file");
417417
}
418418
uint16_t scanlineSizeu16 = static_cast<uint16_t>(scanlineSize);
419-
scanlineSizeu16 = endianEncodeBE(scanlineSizeu16);
419+
scanlineSizeu16 = endian_encode_be(scanlineSizeu16);
420420
// Set the data at the correct index
421421
std::memcpy(reinterpret_cast<void*>(compressedData.data() + scanlineIndex), &scanlineSizeu16, sizeof(uint16_t));
422422
}
423423
else
424424
{
425-
scanlineSize = endianEncodeBE(scanlineSize);
425+
scanlineSize = endian_encode_be(scanlineSize);
426426
std::memcpy(reinterpret_cast<void*>(compressedData.data() + scanlineIndex), &scanlineSize, sizeof(uint32_t));
427427
}
428428

0 commit comments

Comments
 (0)