From d58b7b509e6954985304120945fb4063d0d68d7b Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sat, 3 Apr 2021 02:56:42 -0400 Subject: [PATCH] Make SaveFile* callbacks return a boolean (#1697) --- src/raylib.h | 4 ++-- src/utils.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 3ad0bd82..4e30822b 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -880,9 +880,9 @@ typedef enum { // WARNING: This callbacks are intended for advance users typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // FileIO: Load binary data -typedef void (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data +typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data typedef char *(*LoadFileTextCallback)(const char* fileName); // FileIO: Load text data -typedef void (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data +typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data #if defined(__cplusplus) diff --git a/src/utils.c b/src/utils.c index 9ef19b18..7912b876 100644 --- a/src/utils.c +++ b/src/utils.c @@ -245,8 +245,7 @@ bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) { if (saveFileData) { - saveFileData(fileName, data, bytesToWrite); - return success; + return saveFileData(fileName, data, bytesToWrite); } #if defined(SUPPORT_STANDARD_FILEIO) FILE *file = fopen(fileName, "wb"); @@ -340,8 +339,7 @@ bool SaveFileText(const char *fileName, char *text) { if (saveFileText) { - saveFileText(fileName, text); - return success; + return saveFileText(fileName, text); } #if defined(SUPPORT_STANDARD_FILEIO) FILE *file = fopen(fileName, "wt");