@ -1395,10 +1395,12 @@ ImFileHandle ImFileOpen(const char* filename, const char* mode)
return fopen ( filename , mode ) ;
# endif
}
int ImFileClose ( ImFileHandle f ) { return fclose ( f ) ; }
size_t ImFileGetSize ( ImFileHandle f ) { long off = 0 , sz = 0 ; return ( ( off = ftell ( f ) ) ! = - 1 & & ! fseek ( f , 0 , SEEK_END ) & & ( sz = ftell ( f ) ) ! = - 1 & & ! fseek ( f , off , SEEK_SET ) ) ? ( size_t ) sz : ( size_t ) - 1 ; }
size_t ImFileRead ( void * data , size_t sz , size_t count , ImFileHandle f ) { return fread ( data , sz , count , f ) ; }
size_t ImFileWrite ( const void * data , size_t sz , size_t count , ImFileHandle f ) { return fwrite ( data , sz , count , f ) ; }
// We should in theory be using fseeko()/ftello() with off_t and _fseeki64()/_ftelli64() with __int64, waiting for the PR that does that in a very portable pre-C++11 zero-warnings way.
bool ImFileClose ( ImFileHandle f ) { return fclose ( f ) = = 0 ; }
ImU64 ImFileGetSize ( ImFileHandle f ) { long off = 0 , sz = 0 ; return ( ( off = ftell ( f ) ) ! = - 1 & & ! fseek ( f , 0 , SEEK_END ) & & ( sz = ftell ( f ) ) ! = - 1 & & ! fseek ( f , off , SEEK_SET ) ) ? ( ImU64 ) sz : ( ImU64 ) - 1 ; }
ImU64 ImFileRead ( void * data , ImU64 sz , ImU64 count , ImFileHandle f ) { return fread ( data , ( size_t ) sz , ( size_t ) count , f ) ; }
ImU64 ImFileWrite ( const void * data , ImU64 sz , ImU64 count , ImFileHandle f ) { return fwrite ( data , ( size_t ) sz , ( size_t ) count , f ) ; }
# endif // #ifndef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
// Helper: Load file content into memory
@ -1413,7 +1415,7 @@ void* ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_f
if ( ( f = ImFileOpen ( filename , mode ) ) = = NULL )
return NULL ;
size_t file_size = ImFileGetSize ( f ) ;
size_t file_size = ( size_t ) ImFileGetSize ( f ) ;
if ( file_size = = ( size_t ) - 1 )
{
ImFileClose ( f ) ;
@ -9076,7 +9078,7 @@ void ImGui::LogText(const char* fmt, ...)
{
g . LogBuffer . Buf . resize ( 0 ) ;
g . LogBuffer . appendfv ( fmt , args ) ;
ImFileWrite ( g . LogBuffer . c_str ( ) , sizeof ( char ) , ( size_t ) g . LogBuffer . size ( ) , g . LogFile ) ;
ImFileWrite ( g . LogBuffer . c_str ( ) , sizeof ( char ) , ( ImU64 ) g . LogBuffer . size ( ) , g . LogFile ) ;
}
else
{