~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/extras/FreeType/lib/ttload.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************
 
2
 *
 
3
 *  ttload.h                                                    1.1
 
4
 *
 
5
 *    TrueType Tables Loader.
 
6
 *
 
7
 *  Copyright 1996-1999 by
 
8
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
 
9
 *
 
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
 
12
 *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
 
13
 *  this file you indicate that you have read the license and
 
14
 *  understand and accept it fully.
 
15
 *
 
16
 *
 
17
 *  Changes between 1.1 and 1.0 :
 
18
 *
 
19
 *  - add function Load_TrueType_Any used by TT_Get_Font_Data
 
20
 *
 
21
 ******************************************************************/
 
22
/* $XFree86: xc/extras/FreeType/lib/ttload.h,v 1.2 2001/10/28 03:32:05 tsi Exp $ */
 
23
 
 
24
#ifndef TTLOAD_H
 
25
#define TTLOAD_H
 
26
 
 
27
#include "ttconfig.h"
 
28
#include "tttypes.h"
 
29
#include "ttobjs.h"
 
30
 
 
31
#ifdef __cplusplus
 
32
  extern "C" {
 
33
#endif
 
34
 
 
35
  EXPORT_DEF
 
36
  Long  TT_LookUp_Table( PFace  face, ULong  tag  );
 
37
 
 
38
#if !defined(FTXSBIT_H)
 
39
 
 
40
  LOCAL_DEF TT_Error  Load_TrueType_Directory        ( PFace  face,
 
41
                                                       ULong  faceIndex );
 
42
 
 
43
  LOCAL_DEF TT_Error  Load_TrueType_MaxProfile       ( PFace  face );
 
44
  LOCAL_DEF TT_Error  Load_TrueType_Gasp             ( PFace  face );
 
45
  LOCAL_DEF TT_Error  Load_TrueType_Header           ( PFace  face );
 
46
  LOCAL_DEF TT_Error  Load_TrueType_Locations        ( PFace  face );
 
47
  LOCAL_DEF TT_Error  Load_TrueType_Names            ( PFace  face );
 
48
  LOCAL_DEF TT_Error  Load_TrueType_CVT              ( PFace  face );
 
49
  LOCAL_DEF TT_Error  Load_TrueType_CMap             ( PFace  face );
 
50
  LOCAL_DEF TT_Error  Load_TrueType_Programs         ( PFace  face );
 
51
  LOCAL_DEF TT_Error  Load_TrueType_OS2              ( PFace  face );
 
52
  LOCAL_DEF TT_Error  Load_TrueType_PostScript       ( PFace  face );
 
53
  LOCAL_DEF TT_Error  Load_TrueType_Hdmx             ( PFace  face );
 
54
 
 
55
  LOCAL_DEF TT_Error  Load_TrueType_Metrics_Header( PFace  face,
 
56
                                                    Bool   vertical );
 
57
 
 
58
  LOCAL_DEF TT_Error  Load_TrueType_Any( PFace  face,
 
59
                                         ULong  tag,
 
60
                                         Long   offset,
 
61
                                         void*  buffer,
 
62
                                         Long*  length );
 
63
 
 
64
  LOCAL_DEF TT_Error  Free_TrueType_Names( PFace  face );
 
65
  LOCAL_DEF TT_Error  Free_TrueType_Hdmx ( PFace  face );
 
66
 
 
67
#endif /* !FTXSBIT_H */
 
68
 
 
69
 
 
70
/* The following macros are defined to simplify the writing of */
 
71
/* the various table and glyph loaders.                        */
 
72
 
 
73
/* For examples see the code in ttload.c, ttgload.c etc.       */
 
74
 
 
75
#define USE_Stream( original, duplicate ) \
 
76
          ( (error = TT_Use_Stream( original, &duplicate )) != TT_Err_Ok )
 
77
 
 
78
#define DONE_Stream( _stream ) \
 
79
          TT_Done_Stream( &_stream )
 
80
 
 
81
/* Define a file frame -- use it only when needed */
 
82
#define DEFINE_A_FRAME   TFileFrame  frame = TT_Null_FileFrame
 
83
 
 
84
/* Define a stream -- use it only when needed */
 
85
#define DEFINE_A_STREAM  TT_Stream   stream
 
86
 
 
87
 
 
88
#ifdef TT_CONFIG_OPTION_THREAD_SAFE  /* re-entrant implementation */
 
89
 
 
90
/* The following macros define the necessary local */
 
91
/* variables used to access streams and frames.    */
 
92
 
 
93
/* Define stream locals with frame */
 
94
#define DEFINE_STREAM_LOCALS  \
 
95
          TT_Error  error;    \
 
96
          DEFINE_A_STREAM;    \
 
97
          DEFINE_A_FRAME
 
98
 
 
99
/* Define stream locals without frame */
 
100
#define DEFINE_STREAM_LOCALS_WO_FRAME  \
 
101
          TT_Error  error;             \
 
102
          DEFINE_A_STREAM
 
103
 
 
104
/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
 
105
#define DEFINE_LOAD_LOCALS( STREAM )  \
 
106
          TT_Error  error;            \
 
107
          DEFINE_A_STREAM = (STREAM); \
 
108
          DEFINE_A_FRAME
 
109
 
 
110
/* Define locals without frame with a predefined stream - see ttload.c */
 
111
#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
 
112
          TT_Error      error;                \
 
113
          DEFINE_A_STREAM = (STREAM)
 
114
 
 
115
/* Define all locals necessary to access a font file */
 
116
#define DEFINE_ALL_LOCALS  \
 
117
          TT_Error  error; \
 
118
          DEFINE_A_STREAM; \
 
119
          DEFINE_A_FRAME
 
120
 
 
121
 
 
122
#define ACCESS_Frame( _size_ ) \
 
123
          ( (error = TT_Access_Frame( stream, \
 
124
                                      &frame, \
 
125
                                      (Long)(_size_) )) != TT_Err_Ok )
 
126
#define CHECK_ACCESS_Frame( _size_ ) \
 
127
          ( (error = TT_Check_And_Access_Frame( stream, \
 
128
                                                &frame, \
 
129
                                                (Long)(_size_) )) != TT_Err_Ok )
 
130
#define FORGET_Frame() \
 
131
          ( (void)TT_Forget_Frame( &frame ) )
 
132
 
 
133
#define GET_Byte()    TT_Get_Byte  ( &frame )
 
134
#define GET_Char()    TT_Get_Char  ( &frame )
 
135
#define GET_UShort()  TT_Get_UShort( &frame )
 
136
#define GET_Short()   TT_Get_Short ( &frame )
 
137
#define GET_Long()    TT_Get_Long  ( &frame )
 
138
#define GET_ULong()   TT_Get_ULong ( &frame )
 
139
#define GET_Tag4()    TT_Get_ULong ( &frame )
 
140
 
 
141
#define FILE_Pos()    TT_File_Pos ( stream )
 
142
 
 
143
#define FILE_Seek( _position_ ) \
 
144
          ( (error = TT_Seek_File( stream, \
 
145
                                   (Long)(_position_) )) != TT_Err_Ok )
 
146
#define FILE_Skip( _distance_ ) \
 
147
          ( (error = TT_Skip_File( stream, \
 
148
                                   (Long)(_distance_) )) != TT_Err_Ok )
 
149
#define FILE_Read( buffer, count ) \
 
150
          ( (error = TT_Read_File ( stream, \
 
151
                                    buffer, \
 
152
                                    (Long)(count) )) != TT_Err_Ok )
 
153
#define FILE_Read_At( pos, buffer, count ) \
 
154
          ( (error = TT_Read_At_File( stream, \
 
155
                                      (Long)(pos), \
 
156
                                      buffer, \
 
157
                                      (Long)(count) )) != TT_Err_Ok )
 
158
 
 
159
#else   /* thread-safe implementation */
 
160
 
 
161
/* Define stream locals with frame -- nothing in thread-safe mode */
 
162
#define DEFINE_STREAM_LOCALS  \
 
163
          TT_Error  error
 
164
 
 
165
/* Define stream locals without frame -- nothing in thread-safe mode */
 
166
#define DEFINE_STREAM_LOCALS_WO_FRAME \
 
167
          TT_Error  error
 
168
 
 
169
/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
 
170
#define DEFINE_LOAD_LOCALS( STREAM ) \
 
171
          TT_Error  error
 
172
 
 
173
 
 
174
/* Define locals without frame with a predefined stream - see ttload.c */
 
175
#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
 
176
          TT_Error  error
 
177
 
 
178
/* Define all locals necessary to access a font file */
 
179
#define DEFINE_ALL_LOCALS  \
 
180
          TT_Error  error; \
 
181
          DEFINE_A_STREAM
 
182
 
 
183
 
 
184
#define ACCESS_Frame( _size_ ) \
 
185
          ( (error = TT_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
 
186
#define CHECK_ACCESS_Frame( _size_ ) \
 
187
          ( (error = TT_Check_And_Access_Frame( (Long)(_size_) )) != TT_Err_Ok )
 
188
#define FORGET_Frame() \
 
189
          ( (void)TT_Forget_Frame() )
 
190
 
 
191
#define GET_Byte()    TT_Get_Byte  ()
 
192
#define GET_Char()    TT_Get_Char  ()
 
193
#define GET_UShort()  TT_Get_UShort()
 
194
#define GET_Short()   TT_Get_Short ()
 
195
#define GET_Long()    TT_Get_Long  ()
 
196
#define GET_ULong()   TT_Get_ULong ()
 
197
#define GET_Tag4()    TT_Get_ULong ()
 
198
 
 
199
#define FILE_Pos()    TT_File_Pos()
 
200
 
 
201
#define FILE_Seek( _position_ ) \
 
202
          ( (error = TT_Seek_File( (Long)(_position_) )) != TT_Err_Ok )
 
203
#define FILE_Skip( _distance_ ) \
 
204
          ( (error = TT_Skip_File( (Long)(_distance_) )) != TT_Err_Ok )
 
205
#define FILE_Read( buffer, count ) \
 
206
          ( (error = TT_Read_File ( buffer, \
 
207
                                    (Long)(count) )) != TT_Err_Ok )
 
208
#define FILE_Read_At( pos, buffer, count ) \
 
209
          ( (error = TT_Read_At_File( (Long)(pos), \
 
210
                                      buffer, \
 
211
                                      (Long)(count) )) != TT_Err_Ok )
 
212
 
 
213
#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
 
214
 
 
215
#ifdef __cplusplus
 
216
  }
 
217
#endif
 
218
 
 
219
#endif /* TTLOAD_H */
 
220
 
 
221
 
 
222
/* END */