OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftstream.c */ | 3 /* ftstream.c */ |
4 /* */ | 4 /* */ |
5 /* I/O stream support (body). */ | 5 /* I/O stream support (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2000-2002, 2004-2006, 2008-2011, 2013 by */ | 7 /* Copyright 2000-2002, 2004-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 |
18 | 18 |
19 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
20 #include "../../include/freetype/internal/ftstream.h" | 20 #include FT_INTERNAL_STREAM_H |
21 #include "../../include/freetype/internal/ftdebug.h" | 21 #include FT_INTERNAL_DEBUG_H |
22 | 22 |
23 | 23 |
24 /*************************************************************************/ | 24 /*************************************************************************/ |
25 /* */ | 25 /* */ |
26 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ | 26 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
27 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ | 27 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
28 /* messages during execution. */ | 28 /* messages during execution. */ |
29 /* */ | 29 /* */ |
30 #undef FT_COMPONENT | 30 #undef FT_COMPONENT |
31 #define FT_COMPONENT trace_stream | 31 #define FT_COMPONENT trace_stream |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 FT_BASE_DEF( FT_Error ) | 721 FT_BASE_DEF( FT_Error ) |
722 FT_Stream_ReadFields( FT_Stream stream, | 722 FT_Stream_ReadFields( FT_Stream stream, |
723 const FT_Frame_Field* fields, | 723 const FT_Frame_Field* fields, |
724 void* structure ) | 724 void* structure ) |
725 { | 725 { |
726 FT_Error error; | 726 FT_Error error; |
727 FT_Bool frame_accessed = 0; | 727 FT_Bool frame_accessed = 0; |
728 FT_Byte* cursor; | 728 FT_Byte* cursor; |
729 | 729 |
730 | 730 |
731 if ( !fields || !stream ) | 731 if ( !fields ) |
732 return FT_THROW( Invalid_Argument ); | 732 return FT_THROW( Invalid_Argument ); |
733 | 733 |
| 734 if ( !stream ) |
| 735 return FT_THROW( Invalid_Stream_Handle ); |
| 736 |
734 cursor = stream->cursor; | 737 cursor = stream->cursor; |
735 | 738 |
736 error = FT_Err_Ok; | 739 error = FT_Err_Ok; |
737 do | 740 do |
738 { | 741 { |
739 FT_ULong value; | 742 FT_ULong value; |
740 FT_Int sign_shift; | 743 FT_Int sign_shift; |
741 FT_Byte* p; | 744 FT_Byte* p; |
742 | 745 |
743 | 746 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 Exit: | 859 Exit: |
857 /* close the frame if it was opened by this read */ | 860 /* close the frame if it was opened by this read */ |
858 if ( frame_accessed ) | 861 if ( frame_accessed ) |
859 FT_Stream_ExitFrame( stream ); | 862 FT_Stream_ExitFrame( stream ); |
860 | 863 |
861 return error; | 864 return error; |
862 } | 865 } |
863 | 866 |
864 | 867 |
865 /* END */ | 868 /* END */ |
OLD | NEW |