From 659feb0cbf02cad810d02a2fc80c88bb8f93b96f Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Sat, 11 Feb 2023 22:40:13 +0100
Subject: [PATCH] RagePhoto: update ragephoto_setphotodata function

- RagePhotoTypedefs: add saveSize function
---
 src/RagePhoto.cpp       | 4 ++--
 src/RagePhotoC.h        | 3 ++-
 src/RagePhotoTypedefs.h | 4 ++++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp
index dab6770..4aa0816 100644
--- a/src/RagePhoto.cpp
+++ b/src/RagePhoto.cpp
@@ -1244,9 +1244,9 @@ void ragephoto_setbufferoffsets(ragephoto_t instance)
     ragePhoto->setBufferOffsets();
 }
 
-ragephoto_bool_t ragephoto_setphotodata(ragephoto_t *instance, RagePhotoData *ragePhotoData)
+ragephoto_bool_t ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *ragePhotoData)
 {
-    RagePhoto *ragePhoto = static_cast<RagePhoto*>(*instance);
+    RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance);
     return ragePhoto->setData(ragePhotoData, true);
 }
 
diff --git a/src/RagePhotoC.h b/src/RagePhotoC.h
index 8a19dfe..90608fe 100644
--- a/src/RagePhotoC.h
+++ b/src/RagePhotoC.h
@@ -32,6 +32,7 @@
 extern "C" {
 #endif // __cplusplus
 /** \file RagePhotoC.h */
+
 /** RagePhoto C++ class typedef for C API. */
 typedef void* ragephoto_t;
 
@@ -164,7 +165,7 @@ LIBRAGEPHOTO_C_BINDING void ragephoto_setbufferoffsets(ragephoto_t instance);
 * \param instance \p ragephoto_t instance
 * \param ragePhotoData RagePhotoData object being set
 */
-LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotodata(ragephoto_t *instance, RagePhotoData *ragePhotoData);
+LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *ragePhotoData);
 
 /** Copies RagePhotoData object to internal RagePhotoData object.
 * \param instance \p ragephoto_t instance
diff --git a/src/RagePhotoTypedefs.h b/src/RagePhotoTypedefs.h
index c2a6745..1081f77 100644
--- a/src/RagePhotoTypedefs.h
+++ b/src/RagePhotoTypedefs.h
@@ -61,12 +61,16 @@ typedef ragephoto_bool_t (*ragephoto_savefunc_t)(RagePhotoData*, char*, uint32_t
 /** RagePhoto save function typedef (char* allocated by function). */
 typedef ragephoto_bool_t (*ragephoto_savepfunc_t)(RagePhotoData*, char**, uint32_t);
 
+/** RagePhoto saveSize function typedef. */
+typedef size_t (*ragephoto_saveszfunc_t)(RagePhotoData*, uint32_t);
+
 /** RagePhoto format parser struct for registering custom formats. */
 typedef struct RagePhotoFormatParser {
     uint32_t photoFormat; /**< Photo file format magic */
     ragephoto_loadfunc_t funcLoad; /**< Pointer to load function */
     ragephoto_savefunc_t funcSave; /**< Pointer to save function */
     ragephoto_savepfunc_t funcSavep; /**< Pointer to savep function */
+    ragephoto_saveszfunc_t funcSaveSz; /**< Pointer to saveSize function */
 } RagePhotoFormatParser;
 
 #ifdef __cplusplus