diff --git a/RagePhoto.cpp b/RagePhoto.cpp index b8152f8..6144acc 100644 --- a/RagePhoto.cpp +++ b/RagePhoto.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include RagePhoto::RagePhoto(const QByteArray &data) : p_fileData(data) @@ -232,7 +231,7 @@ bool RagePhoto::load() } else if (format == PhotoFormat::G5EX) { char formatHeader[4]; - qint64 size = dataBuffer.read(formatHeader, 4); + size = dataBuffer.read(formatHeader, 4); if (size != 4) return false; quint32 format = charToUInt32LE(formatHeader); @@ -437,3 +436,19 @@ quint32 RagePhoto::charToUInt32LE(char *x) { return (((unsigned char)x[3] << 24) | ((unsigned char)x[2] << 16) | ((unsigned char)x[1] << 8) | ((unsigned char)x[0])); } + +void RagePhoto::uInt32ToCharBE(quint32 *x, char *y) +{ + y[0] = (*x >> 24) & 0xFF; + y[1] = (*x >> 16) & 0xFF; + y[2] = (*x >> 8) & 0xFF; + y[3] = (*x) & 0xFF; +} + +void RagePhoto::uInt32ToCharLE(quint32 *x, char *y) +{ + y[0] = (*x) & 0xFF; + y[1] = (*x >> 8) & 0xFF; + y[2] = (*x >> 16) & 0xFF; + y[3] = (*x >> 24) & 0xFF; +} diff --git a/RagePhoto.h b/RagePhoto.h index 4c0dbbb..922a757 100644 --- a/RagePhoto.h +++ b/RagePhoto.h @@ -58,6 +58,8 @@ public: private: inline quint32 charToUInt32BE(char *x); inline quint32 charToUInt32LE(char *x); + inline void uInt32ToCharBE(quint32 *x, char *y); + inline void uInt32ToCharLE(quint32 *x, char *y); QJsonObject p_jsonObject; QByteArray p_fileData; QByteArray p_photoData;