From 7552f48d7b45aa1abc44eb8398b49df6c6028a16 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Jul 2015 17:46:49 -0600 Subject: [PATCH] ImLoadFileToMemory() default parameters --- imgui.cpp | 3 ++- imgui_internal.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5554afb8..96e0904a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1168,7 +1168,8 @@ bool ImLoadFileToMemory(const char* filename, const char* file_open_mode, void** fclose(f); *out_file_data = file_data; - *out_file_size = file_size; + if (out_file_size) + *out_file_size = file_size; return true; } diff --git a/imgui_internal.h b/imgui_internal.h index 300dafee..7b418a15 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -82,7 +82,7 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const Im // Helpers: Misc ImU32 ImHash(const void* data, int data_size, ImU32 seed); -bool ImLoadFileToMemory(const char* filename, const char* file_open_mode, void** out_file_data, int* out_file_size, int padding_bytes); +bool ImLoadFileToMemory(const char* filename, const char* file_open_mode, void** out_file_data, int* out_file_size = NULL, int padding_bytes = 0); bool ImIsPointInTriangle(const ImVec2& p, const ImVec2& a, const ImVec2& b, const ImVec2& c); static inline bool ImCharIsSpace(int c) { return c == ' ' || c == '\t' || c == 0x3000; } static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }