libragephoto 0.6.2 release
- CMakeLists.txt: update version to 0.6.2 - RagePhoto.c: fix ragephoto_addparser and byte swap function - RagePhoto.cpp: fix addParser and byte swap function - RagePhotoLibrary.h: fix endian detection - Syping.RagePhoto.Core.csproj: update version to 0.6.2
This commit is contained in:
parent
72f094958d
commit
aad0db247b
5 changed files with 97 additions and 100 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
cmake_policy(VERSION 3.16...3.28)
|
cmake_policy(VERSION 3.16...3.28)
|
||||||
project(ragephoto VERSION 0.6.1 LANGUAGES C CXX)
|
project(ragephoto VERSION 0.6.2 LANGUAGES C CXX)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# RagePhoto CMake includes
|
# RagePhoto CMake includes
|
||||||
|
|
|
||||||
|
|
@ -159,21 +159,12 @@ static inline bool writeDataChar(const char *input, char **output)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t charToUInt32LE(char *x)
|
static inline uint32_t swapUInt32(uint32_t x)
|
||||||
{
|
{
|
||||||
return ((unsigned char)(x[3]) << 24 |
|
return (x >> 24 & 0x000000FF) |
|
||||||
(unsigned char)(x[2]) << 16 |
|
(x >> 8 & 0x0000FF00) |
|
||||||
(unsigned char)(x[1]) << 8 |
|
(x << 8 & 0x00FF0000) |
|
||||||
(unsigned char)(x[0]));
|
(x << 24 & 0xFF000000);
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t swapToUInt32LE(uint32_t x)
|
|
||||||
{
|
|
||||||
unsigned char *y = (unsigned char*)&x;
|
|
||||||
return (y[3] << 24 |
|
|
||||||
y[2] << 16 |
|
|
||||||
y[1] << 8 |
|
|
||||||
y[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void uInt32ToCharLE(uint32_t x, char *y)
|
static inline void uInt32ToCharLE(uint32_t x, char *y)
|
||||||
|
|
@ -245,7 +236,7 @@ void ragephoto_addparser(ragephoto_t instance_t, RagePhotoFormatParser *rp_parse
|
||||||
return;
|
return;
|
||||||
size_t length;
|
size_t length;
|
||||||
for (length = 0; memcmp(&n_parser, &instance->parser[length], sizeof(RagePhotoFormatParser)); length++);
|
for (length = 0; memcmp(&n_parser, &instance->parser[length], sizeof(RagePhotoFormatParser)); length++);
|
||||||
RagePhotoFormatParser *t_parser = (RagePhotoFormatParser*)realloc(instance->parser, (length + 2 * sizeof(RagePhotoFormatParser)));
|
RagePhotoFormatParser *t_parser = (RagePhotoFormatParser*)realloc(instance->parser, (length + 2) * sizeof(RagePhotoFormatParser));
|
||||||
if (!t_parser)
|
if (!t_parser)
|
||||||
return;
|
return;
|
||||||
instance->parser = t_parser;
|
instance->parser = t_parser;
|
||||||
|
|
@ -296,7 +287,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
size_t size = readBuffer(data, &rp_data->photoFormat, &pos, 4, length);
|
size_t size = readBuffer(data, &rp_data->photoFormat, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->photoFormat = swapToUInt32LE(rp_data->photoFormat);
|
rp_data->photoFormat = swapUInt32(rp_data->photoFormat);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_NOFORMATIDENTIFIER; // 1
|
rp_data->error = RAGEPHOTO_ERROR_NOFORMATIDENTIFIER; // 1
|
||||||
|
|
@ -351,7 +342,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->headerSum, &pos, 4, length);
|
size = readBuffer(data, &rp_data->headerSum, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->headerSum = swapToUInt32LE(rp_data->headerSum);
|
rp_data->headerSum = swapUInt32(rp_data->headerSum);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETECHECKSUM; // 7
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETECHECKSUM; // 7
|
||||||
|
|
@ -374,7 +365,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->headerSum2, &pos, 4, length);
|
size = readBuffer(data, &rp_data->headerSum2, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->headerSum2 = swapToUInt32LE(rp_data->headerSum2);
|
rp_data->headerSum2 = swapUInt32(rp_data->headerSum2);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETECHECKSUM; // 7
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETECHECKSUM; // 7
|
||||||
|
|
@ -384,7 +375,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->endOfFile, &pos, 4, length);
|
size = readBuffer(data, &rp_data->endOfFile, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->endOfFile = swapToUInt32LE(rp_data->endOfFile);
|
rp_data->endOfFile = swapUInt32(rp_data->endOfFile);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEEOF; // 8
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEEOF; // 8
|
||||||
|
|
@ -393,7 +384,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jsonOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jsonOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jsonOffset = swapToUInt32LE(rp_data->jsonOffset);
|
rp_data->jsonOffset = swapUInt32(rp_data->jsonOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEJSONOFFSET; // 9
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEJSONOFFSET; // 9
|
||||||
|
|
@ -401,7 +392,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
}
|
}
|
||||||
size = readBuffer(data, &rp_data->titlOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->titlOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->titlOffset = swapToUInt32LE(rp_data->titlOffset);
|
rp_data->titlOffset = swapUInt32(rp_data->titlOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETETITLEOFFSET; // 10
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETETITLEOFFSET; // 10
|
||||||
|
|
@ -410,7 +401,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->descOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->descOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->descOffset = swapToUInt32LE(rp_data->descOffset);
|
rp_data->descOffset = swapUInt32(rp_data->descOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEDESCOFFSET; // 11
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEDESCOFFSET; // 11
|
||||||
|
|
@ -430,7 +421,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jpegBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jpegBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jpegBuffer = swapToUInt32LE(rp_data->jpegBuffer);
|
rp_data->jpegBuffer = swapUInt32(rp_data->jpegBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEPHOTOBUFFER; // 14
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEPHOTOBUFFER; // 14
|
||||||
|
|
@ -439,7 +430,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jpegSize, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jpegSize, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jpegSize = swapToUInt32LE(rp_data->jpegSize);
|
rp_data->jpegSize = swapUInt32(rp_data->jpegSize);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEPHOTOSIZE; // 15
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEPHOTOSIZE; // 15
|
||||||
|
|
@ -472,7 +463,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jsonBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jsonBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jsonBuffer = swapToUInt32LE(rp_data->jsonBuffer);
|
rp_data->jsonBuffer = swapUInt32(rp_data->jsonBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEJSONBUFFER; // 20
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEJSONBUFFER; // 20
|
||||||
|
|
@ -504,7 +495,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->titlBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->titlBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->titlBuffer = swapToUInt32LE(rp_data->titlBuffer);
|
rp_data->titlBuffer = swapUInt32(rp_data->titlBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETETITLEBUFFER; // 25
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETETITLEBUFFER; // 25
|
||||||
|
|
@ -536,7 +527,7 @@ bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->descBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->descBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->descBuffer = swapToUInt32LE(rp_data->descBuffer);
|
rp_data->descBuffer = swapUInt32(rp_data->descBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEDESCBUFFER; // 30
|
rp_data->error = RAGEPHOTO_ERROR_INCOMPLETEDESCBUFFER; // 30
|
||||||
|
|
|
||||||
|
|
@ -153,21 +153,12 @@ inline bool writeDataChar(const char *input, char **output)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t charToUInt32LE(char *x)
|
inline uint32_t swapUInt32(uint32_t x)
|
||||||
{
|
{
|
||||||
return (static_cast<unsigned char>(x[3]) << 24 |
|
return (x >> 24 & 0x000000FF) |
|
||||||
static_cast<unsigned char>(x[2]) << 16 |
|
(x >> 8 & 0x0000FF00) |
|
||||||
static_cast<unsigned char>(x[1]) << 8 |
|
(x << 8 & 0x00FF0000) |
|
||||||
static_cast<unsigned char>(x[0]));
|
(x << 24 & 0xFF000000);
|
||||||
}
|
|
||||||
|
|
||||||
inline uint32_t swapToUInt32LE(uint32_t x)
|
|
||||||
{
|
|
||||||
unsigned char *y = reinterpret_cast<unsigned char*>(&x);
|
|
||||||
return (y[3] << 24 |
|
|
||||||
y[2] << 16 |
|
|
||||||
y[1] << 8 |
|
|
||||||
y[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void uInt32ToCharLE(uint32_t x, char *y)
|
inline void uInt32ToCharLE(uint32_t x, char *y)
|
||||||
|
|
@ -227,7 +218,7 @@ void RagePhoto::addParser(RagePhotoFormatParser *rp_parser)
|
||||||
return;
|
return;
|
||||||
size_t length;
|
size_t length;
|
||||||
for (length = 0; memcmp(&n_parser[0], &m_parser[length], sizeof(RagePhotoFormatParser)); length++);
|
for (length = 0; memcmp(&n_parser[0], &m_parser[length], sizeof(RagePhotoFormatParser)); length++);
|
||||||
RagePhotoFormatParser *t_parser = static_cast<RagePhotoFormatParser*>(realloc(m_parser, (length + 2 * sizeof(RagePhotoFormatParser))));
|
RagePhotoFormatParser *t_parser = static_cast<RagePhotoFormatParser*>(realloc(m_parser, (length + 2) * sizeof(RagePhotoFormatParser)));
|
||||||
if (!t_parser)
|
if (!t_parser)
|
||||||
throw std::runtime_error("RagePhotoFormatParser array can't be expanded");
|
throw std::runtime_error("RagePhotoFormatParser array can't be expanded");
|
||||||
m_parser = t_parser;
|
m_parser = t_parser;
|
||||||
|
|
@ -269,7 +260,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
size_t size = readBuffer(data, &rp_data->photoFormat, &pos, 4, length);
|
size_t size = readBuffer(data, &rp_data->photoFormat, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->photoFormat = swapToUInt32LE(rp_data->photoFormat);
|
rp_data->photoFormat = swapUInt32(rp_data->photoFormat);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::NoFormatIdentifier; // 1
|
rp_data->error = Error::NoFormatIdentifier; // 1
|
||||||
|
|
@ -338,7 +329,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->headerSum, &pos, 4, length);
|
size = readBuffer(data, &rp_data->headerSum, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->headerSum = swapToUInt32LE(rp_data->headerSum);
|
rp_data->headerSum = swapUInt32(rp_data->headerSum);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteChecksum; // 7
|
rp_data->error = Error::IncompleteChecksum; // 7
|
||||||
|
|
@ -360,7 +351,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->headerSum2, &pos, 4, length);
|
size = readBuffer(data, &rp_data->headerSum2, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->headerSum2 = swapToUInt32LE(rp_data->headerSum2);
|
rp_data->headerSum2 = swapUInt32(rp_data->headerSum2);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteChecksum; // 7
|
rp_data->error = Error::IncompleteChecksum; // 7
|
||||||
|
|
@ -370,7 +361,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->endOfFile, &pos, 4, length);
|
size = readBuffer(data, &rp_data->endOfFile, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->endOfFile = swapToUInt32LE(rp_data->endOfFile);
|
rp_data->endOfFile = swapUInt32(rp_data->endOfFile);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteEOF; // 8
|
rp_data->error = Error::IncompleteEOF; // 8
|
||||||
|
|
@ -379,7 +370,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jsonOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jsonOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jsonOffset = swapToUInt32LE(rp_data->jsonOffset);
|
rp_data->jsonOffset = swapUInt32(rp_data->jsonOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteJsonOffset; // 9
|
rp_data->error = Error::IncompleteJsonOffset; // 9
|
||||||
|
|
@ -387,7 +378,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
}
|
}
|
||||||
size = readBuffer(data, &rp_data->titlOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->titlOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->titlOffset = swapToUInt32LE(rp_data->titlOffset);
|
rp_data->titlOffset = swapUInt32(rp_data->titlOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteTitleOffset; // 10
|
rp_data->error = Error::IncompleteTitleOffset; // 10
|
||||||
|
|
@ -396,7 +387,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->descOffset, &pos, 4, length);
|
size = readBuffer(data, &rp_data->descOffset, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->descOffset = swapToUInt32LE(rp_data->descOffset);
|
rp_data->descOffset = swapUInt32(rp_data->descOffset);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteDescOffset; // 11
|
rp_data->error = Error::IncompleteDescOffset; // 11
|
||||||
|
|
@ -416,7 +407,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jpegBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jpegBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jpegBuffer = swapToUInt32LE(rp_data->jpegBuffer);
|
rp_data->jpegBuffer = swapUInt32(rp_data->jpegBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompletePhotoBuffer; // 14
|
rp_data->error = Error::IncompletePhotoBuffer; // 14
|
||||||
|
|
@ -425,7 +416,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jpegSize, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jpegSize, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jpegSize = swapToUInt32LE(rp_data->jpegSize);
|
rp_data->jpegSize = swapUInt32(rp_data->jpegSize);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompletePhotoSize; // 15
|
rp_data->error = Error::IncompletePhotoSize; // 15
|
||||||
|
|
@ -458,7 +449,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->jsonBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->jsonBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->jsonBuffer = swapToUInt32LE(rp_data->jsonBuffer);
|
rp_data->jsonBuffer = swapUInt32(rp_data->jsonBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteJsonBuffer; // 20
|
rp_data->error = Error::IncompleteJsonBuffer; // 20
|
||||||
|
|
@ -490,7 +481,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->titlBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->titlBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->titlBuffer = swapToUInt32LE(rp_data->titlBuffer);
|
rp_data->titlBuffer = swapUInt32(rp_data->titlBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteTitleBuffer; // 25
|
rp_data->error = Error::IncompleteTitleBuffer; // 25
|
||||||
|
|
@ -522,7 +513,7 @@ bool RagePhoto::load(const char *data, size_t length, RagePhotoData *rp_data, Ra
|
||||||
|
|
||||||
size = readBuffer(data, &rp_data->descBuffer, &pos, 4, length);
|
size = readBuffer(data, &rp_data->descBuffer, &pos, 4, length);
|
||||||
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
#ifndef LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
rp_data->descBuffer = swapToUInt32LE(rp_data->descBuffer);
|
rp_data->descBuffer = swapUInt32(rp_data->descBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4) {
|
if (size != 4) {
|
||||||
rp_data->error = Error::IncompleteDescBuffer; // 30
|
rp_data->error = Error::IncompleteDescBuffer; // 30
|
||||||
|
|
|
||||||
|
|
@ -23,58 +23,73 @@
|
||||||
|
|
||||||
/* RAGEPHOTO LIBRARY BINDING BEGIN */
|
/* RAGEPHOTO LIBRARY BINDING BEGIN */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef LIBRAGEPHOTO_STATIC
|
#ifndef LIBRAGEPHOTO_STATIC
|
||||||
#ifdef LIBRAGEPHOTO_LIBRARY
|
#ifdef LIBRAGEPHOTO_LIBRARY
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllexport)
|
#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllexport)
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllexport)
|
#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllimport)
|
||||||
|
#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllimport)
|
||||||
|
#endif // LIBRAGEPHOTO_LIBRARY
|
||||||
|
#else
|
||||||
|
#define LIBRAGEPHOTO_C_PUBLIC
|
||||||
|
#define LIBRAGEPHOTO_CXX_PUBLIC
|
||||||
|
#endif // LIBRAGEPHOTO_STATIC
|
||||||
#else
|
#else
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllimport)
|
#ifdef __EMSCRIPTEN__
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllimport)
|
#include <emscripten/emscripten.h>
|
||||||
#endif // LIBRAGEPHOTO_LIBRARY
|
#define LIBRAGEPHOTO_C_PUBLIC EMSCRIPTEN_KEEPALIVE
|
||||||
#else
|
#define LIBRAGEPHOTO_CXX_PUBLIC
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC
|
#else
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC
|
#ifdef __GNUC__
|
||||||
#endif // LIBRAGEPHOTO_STATIC
|
#ifndef LIBRAGEPHOTO_STATIC
|
||||||
#else
|
#define LIBRAGEPHOTO_C_PUBLIC __attribute__((visibility("default")))
|
||||||
#ifdef __EMSCRIPTEN__
|
#define LIBRAGEPHOTO_CXX_PUBLIC __attribute__((visibility("default")))
|
||||||
#include <emscripten/emscripten.h>
|
#else
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC EMSCRIPTEN_KEEPALIVE
|
#define LIBRAGEPHOTO_C_PUBLIC
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC
|
#define LIBRAGEPHOTO_CXX_PUBLIC
|
||||||
#else
|
#endif // LIBRAGEPHOTO_STATIC
|
||||||
#ifdef __GNUC__
|
#else
|
||||||
#ifndef LIBRAGEPHOTO_STATIC
|
#define LIBRAGEPHOTO_C_PUBLIC
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC __attribute__((visibility("default")))
|
#define LIBRAGEPHOTO_CXX_PUBLIC
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC __attribute__((visibility("default")))
|
#endif // __GNUC__
|
||||||
#else
|
#endif // __EMSCRIPTEN__
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC
|
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC
|
|
||||||
#endif // LIBRAGEPHOTO_STATIC
|
|
||||||
#else
|
|
||||||
#define LIBRAGEPHOTO_C_PUBLIC
|
|
||||||
#define LIBRAGEPHOTO_CXX_PUBLIC
|
|
||||||
#endif // __GNUC__
|
|
||||||
#endif // __EMSCRIPTEN__
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
/* RAGEPHOTO LIBRARY BINDING END */
|
/* RAGEPHOTO LIBRARY BINDING END */
|
||||||
|
|
||||||
/* RAGEPHOTO LIBRARY ENDIAN START */
|
/* RAGEPHOTO LIBRARY ENDIAN START */
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32)
|
||||||
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
#else
|
#elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
#elif defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
#elif _BYTE_ORDER == _LITTLE_ENDIAN
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
#elif defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <machine/endian.h>
|
||||||
|
#if defined(__DARWIN_BYTE_ORDER) && defined(__DARWIN_LITTLE_ENDIAN) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
|
||||||
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
|
#endif // __DARWIN_BYTE_ORDER
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#include <endian.h>
|
||||||
|
#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
|
#endif // __BYTE_ORDER
|
||||||
|
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
#define LIBRAGEPHOTO_LITTLE_ENDIAN
|
||||||
|
#endif // _BYTE_ORDER
|
||||||
#endif
|
#endif
|
||||||
#endif // _WIN32
|
|
||||||
/* RAGEPHOTO LIBRARY ENDIAN END */
|
/* RAGEPHOTO LIBRARY ENDIAN END */
|
||||||
|
|
||||||
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY BEGIN */
|
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY BEGIN */
|
||||||
#ifdef LIBRAGEPHOTO_WASM
|
#ifdef LIBRAGEPHOTO_WASM
|
||||||
#ifdef LIBRAGEPHOTO_CXX_ONLY
|
#ifdef LIBRAGEPHOTO_CXX_ONLY
|
||||||
#undef LIBRAGEPHOTO_CXX_ONLY
|
#undef LIBRAGEPHOTO_CXX_ONLY
|
||||||
#define LIBRAGEPHOTO_CXX_C
|
#define LIBRAGEPHOTO_CXX_C
|
||||||
#endif // LIBRAGEPHOTO_CXX_ONLY
|
#endif // LIBRAGEPHOTO_CXX_ONLY
|
||||||
#endif // LIBRAGEPHOTO_WASM
|
#endif // LIBRAGEPHOTO_WASM
|
||||||
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY END */
|
/* ENABLE C API FOR LIBRAGEPHOTO WASM LIBRARY END */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
<TargetFrameworks>netstandard2.1;net47</TargetFrameworks>
|
<TargetFrameworks>netstandard2.1;net47</TargetFrameworks>
|
||||||
<AssemblyName>Syping.RagePhoto.Core</AssemblyName>
|
<AssemblyName>Syping.RagePhoto.Core</AssemblyName>
|
||||||
<RootNamespace>Syping.RagePhoto</RootNamespace>
|
<RootNamespace>Syping.RagePhoto</RootNamespace>
|
||||||
<Version>0.6.1.6</Version>
|
<Version>0.6.2</Version>
|
||||||
<AssemblyVersion>0.6.1.6</AssemblyVersion>
|
<AssemblyVersion>0.6.2</AssemblyVersion>
|
||||||
<FileVersion>0.6.1.6</FileVersion>
|
<FileVersion>0.6.2</FileVersion>
|
||||||
<Authors>Syping</Authors>
|
<Authors>Syping</Authors>
|
||||||
<Copyright>Copyright © 2025 Syping</Copyright>
|
<Copyright>Copyright © 2025 Syping</Copyright>
|
||||||
<Description>Open Source RAGE Photo Parser for GTA V and RDR 2</Description>
|
<Description>Open Source RAGE Photo Parser for GTA V and RDR 2</Description>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue