| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftsystem.c */ | 3 /* ftsystem.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* ANSI-specific FreeType low-level system interface (body). */ | 5 /* ANSI-specific FreeType low-level system interface (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2002, 2006, 2008-2011 by */ | 7 /* Copyright 1996-2002, 2006, 2008-2011, 2013 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
| 11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 /* documentation is in ftstream.h */ | 221 /* documentation is in ftstream.h */ |
| 222 | 222 |
| 223 FT_BASE_DEF( FT_Error ) | 223 FT_BASE_DEF( FT_Error ) |
| 224 FT_Stream_Open( FT_Stream stream, | 224 FT_Stream_Open( FT_Stream stream, |
| 225 const char* filepathname ) | 225 const char* filepathname ) |
| 226 { | 226 { |
| 227 FT_FILE* file; | 227 FT_FILE* file; |
| 228 | 228 |
| 229 | 229 |
| 230 if ( !stream ) | 230 if ( !stream ) |
| 231 return FT_Err_Invalid_Stream_Handle; | 231 return FT_THROW( Invalid_Stream_Handle ); |
| 232 | 232 |
| 233 stream->descriptor.pointer = NULL; | 233 stream->descriptor.pointer = NULL; |
| 234 stream->pathname.pointer = (char*)filepathname; | 234 stream->pathname.pointer = (char*)filepathname; |
| 235 stream->base = 0; | 235 stream->base = 0; |
| 236 stream->pos = 0; | 236 stream->pos = 0; |
| 237 stream->read = NULL; | 237 stream->read = NULL; |
| 238 stream->close = NULL; | 238 stream->close = NULL; |
| 239 | 239 |
| 240 file = ft_fopen( filepathname, "rb" ); | 240 file = ft_fopen( filepathname, "rb" ); |
| 241 if ( !file ) | 241 if ( !file ) |
| 242 { | 242 { |
| 243 FT_ERROR(( "FT_Stream_Open:" | 243 FT_ERROR(( "FT_Stream_Open:" |
| 244 " could not open `%s'\n", filepathname )); | 244 " could not open `%s'\n", filepathname )); |
| 245 | 245 |
| 246 return FT_Err_Cannot_Open_Resource; | 246 return FT_THROW( Cannot_Open_Resource ); |
| 247 } | 247 } |
| 248 | 248 |
| 249 ft_fseek( file, 0, SEEK_END ); | 249 ft_fseek( file, 0, SEEK_END ); |
| 250 stream->size = ft_ftell( file ); | 250 stream->size = ft_ftell( file ); |
| 251 if ( !stream->size ) | 251 if ( !stream->size ) |
| 252 { | 252 { |
| 253 FT_ERROR(( "FT_Stream_Open:" )); | 253 FT_ERROR(( "FT_Stream_Open:" )); |
| 254 FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); | 254 FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); |
| 255 ft_fclose( file ); | 255 ft_fclose( file ); |
| 256 return FT_Err_Cannot_Open_Stream; | 256 return FT_THROW( Cannot_Open_Stream ); |
| 257 } | 257 } |
| 258 ft_fseek( file, 0, SEEK_SET ); | 258 ft_fseek( file, 0, SEEK_SET ); |
| 259 | 259 |
| 260 stream->descriptor.pointer = file; | 260 stream->descriptor.pointer = file; |
| 261 stream->read = ft_ansi_stream_io; | 261 stream->read = ft_ansi_stream_io; |
| 262 stream->close = ft_ansi_stream_close; | 262 stream->close = ft_ansi_stream_close; |
| 263 | 263 |
| 264 FT_TRACE1(( "FT_Stream_Open:" )); | 264 FT_TRACE1(( "FT_Stream_Open:" )); |
| 265 FT_TRACE1(( " opened `%s' (%d bytes) successfully\n", | 265 FT_TRACE1(( " opened `%s' (%d bytes) successfully\n", |
| 266 filepathname, stream->size )); | 266 filepathname, stream->size )); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 FT_Done_Memory( FT_Memory memory ) | 311 FT_Done_Memory( FT_Memory memory ) |
| 312 { | 312 { |
| 313 #ifdef FT_DEBUG_MEMORY | 313 #ifdef FT_DEBUG_MEMORY |
| 314 ft_mem_debug_done( memory ); | 314 ft_mem_debug_done( memory ); |
| 315 #endif | 315 #endif |
| 316 ft_sfree( memory ); | 316 ft_sfree( memory ); |
| 317 } | 317 } |
| 318 | 318 |
| 319 | 319 |
| 320 /* END */ | 320 /* END */ |
| OLD | NEW |