* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE, FT_FACE_LOOKUP_SERVICE): Add parameter to pass pointer type. Ugly, I know, but this is needed for compilation with C++ -- maybe someone knows a better solution? Updated all callers. * src/base/ftobjs.c (FT_Get_Name_Index, FT_Get_Glyph_Name): Remove C++ compiler warnings. * src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Fix order of arguments passed to FT_FACE_FIND_SERVICE.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
diff --git a/ChangeLog b/ChangeLog
index 49bb206..3eccefb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
+2003-09-16 Werner Lemberg <wl@gnu.org>
+
+ * include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
+ FT_FACE_LOOKUP_SERVICE): Add parameter to pass pointer type.
+ Ugly, I know, but this is needed for compilation with C++ --
+ maybe someone knows a better solution?
+ Updated all callers.
+
+ * src/base/ftobjs.c (FT_Get_Name_Index, FT_Get_Glyph_Name): Remove
+ C++ compiler warnings.
+
+ * src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property):
+ Fix order of arguments passed to FT_FACE_FIND_SERVICE.
+
2003-09-15 Werner Lemberg <wl@gnu.org>
+ Avoid header files with identical names.
+
* include/freetype/internal/services/bdf.h: Renamed to...
* include/freetype/internal/services/svbdf.h: This.
Add copyright notice.
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 8f76431..4e498ad 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -22,8 +22,8 @@
/* generally corresponds to a structure containing function pointers. */
/* */
/* Note that a service's data cannot be a mere function pointer because */
- /* in C it is possible that function pointers might are implemented */
- /* differently from data pointers (e.g. 48 bits instead of 32). */
+ /* in C it is possible that function pointers might be implemented */
+ /* differently than data pointers (e.g. 48 bits instead of 32). */
/* */
/*************************************************************************/
@@ -35,35 +35,39 @@
FT_BEGIN_HEADER
- /*
- * @macro:
- * FT_FACE_FIND_SERVICE
- *
- * @description:
- * This macro is used to lookup a service from a face's driver module.
- *
- * @input:
- * id ::
- * A string describing the service as defined in the service's
- * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
- * `multi-masters').
- *
- * face ::
- * The source face handle.
- *
- * @output:
- * ptr ::
- * A variable that receives the service pointer. Will be NULL
- * if not found.
- */
-#define FT_FACE_FIND_SERVICE( ptr, face, id ) \
- FT_BEGIN_STMNT \
- FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
- \
- \
- (ptr) = NULL; \
- if ( module->clazz->get_interface ) \
- (ptr) = module->clazz->get_interface( module, id ); \
+ /*
+ * @macro:
+ * FT_FACE_FIND_SERVICE
+ *
+ * @description:
+ * This macro is used to lookup a service from a face's driver module.
+ *
+ * @input:
+ * id ::
+ * A string describing the service as defined in the service's
+ * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
+ * `multi-masters').
+ *
+ * face ::
+ * The source face handle.
+ *
+ * ptrtype ::
+ * The pointer type of `ptr'. This is needed to make FreeType
+ * compile cleanly with C++.
+ *
+ * @output:
+ * ptr ::
+ * A variable that receives the service pointer. Will be NULL
+ * if not found.
+ */
+#define FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id ) \
+ FT_BEGIN_STMNT \
+ FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
+ \
+ \
+ (ptr) = NULL; \
+ if ( module->clazz->get_interface ) \
+ (ptr) = (ptrtype)module->clazz->get_interface( module, id ); \
FT_END_STMNT
@@ -152,18 +156,22 @@ FT_BEGIN_HEADER
* id ::
* The service ID.
*
+ * ptrtype ::
+ * The pointer type of `ptr'. This is needed to make FreeType
+ * compile cleanly with C++.
+ *
* @output:
* ptr ::
* A variable receiving the service data. NULL if not available.
*/
-#define FT_FACE_LOOKUP_SERVICE( face, ptr, field, id ) \
+#define FT_FACE_LOOKUP_SERVICE( face, ptrtype, ptr, field, id ) \
FT_BEGIN_STMNT \
- (ptr) = FT_FACE(face)->internal->services.field ; \
+ (ptr) = (ptrtype)FT_FACE(face)->internal->services.field ; \
if ( (ptr) == FT_SERVICE_UNAVAILABLE ) \
(ptr) = NULL; \
else if ( (ptr) == NULL ) \
{ \
- FT_FACE_FIND_SERVICE( ptr, face, id ); \
+ FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id ); \
\
FT_FACE(face)->internal->services.field = \
(FT_Pointer)( (ptr) != NULL ? (ptr) \
diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c
index 0f5dcb7..9b59787 100644
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -39,7 +39,9 @@
FT_Service_BDF service;
- FT_FACE_FIND_SERVICE( service, face, FT_SERVICE_ID_BDF );
+ FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
+ face,
+ FT_SERVICE_ID_BDF );
if ( service && service->get_charset_id )
error = service->get_charset_id( face, &encoding, ®istry );
@@ -72,7 +74,9 @@
FT_Service_BDF service;
- FT_FACE_FIND_SERVICE( service, face, FT_SERVICE_ID_BDF );
+ FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
+ face,
+ FT_SERVICE_ID_BDF );
if ( service && service->get_property )
error = service->get_property( face, prop_name, aproperty );
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index 55ec426..a11c934 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -48,7 +48,8 @@
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
{
- FT_FACE_LOOKUP_SERVICE( face, *aservice,
+ FT_FACE_LOOKUP_SERVICE( face,
+ FT_Service_MultiMasters, *aservice,
multi_masters,
FT_SERVICE_ID_MULTI_MASTERS );
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 8ec8f16..11b17a6 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2401,13 +2401,14 @@
#if 0
- FT_FACE_LOOKUP_SERVICE( face, service,
+ FT_FACE_LOOKUP_SERVICE( face,
+ FT_Service_GlyphDict, service,
glyph_dict,
FT_SERVICE_ID_GLYPH_DICT );
#else
- service = face->internal->services.glyph_dict;
+ service = (FT_Service_GlyphDict)face->internal->services.glyph_dict;
if ( service == FT_SERVICE_UNAVAILABLE )
service = NULL;
else if ( service == NULL )
@@ -2416,11 +2417,11 @@
if ( module->clazz->get_interface )
- service = module->clazz->get_interface( module,
- FT_SERVICE_ID_GLYPH_DICT );
+ service = (FT_Service_GlyphDict)module->clazz->get_interface(
+ module, FT_SERVICE_ID_GLYPH_DICT );
face->internal->services.glyph_dict =
- service != NULL ? service
+ service != NULL ? (FT_Pointer)service
: FT_SERVICE_UNAVAILABLE;
}
@@ -2456,7 +2457,8 @@
FT_Service_GlyphDict service;
- FT_FACE_LOOKUP_SERVICE( face, service,
+ FT_FACE_LOOKUP_SERVICE( face,
+ FT_Service_GlyphDict, service,
glyph_dict,
FT_SERVICE_ID_GLYPH_DICT );
@@ -2484,7 +2486,8 @@
FT_Service_PsName service;
- FT_FACE_LOOKUP_SERVICE( face, service,
+ FT_FACE_LOOKUP_SERVICE( face,
+ FT_Service_PsName, service,
postscript_name,
FT_SERVICE_ID_POSTSCRIPT_NAME );
@@ -2509,7 +2512,9 @@
if ( face && FT_IS_SFNT( face ) )
{
- FT_FACE_FIND_SERVICE( face, service, FT_SERVICE_ID_SFNT_TABLE );
+ FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
+ face,
+ FT_SERVICE_ID_SFNT_TABLE );
if ( service != NULL )
table = service->get_table( face, tag );
}
@@ -2533,7 +2538,9 @@
if ( !face || !FT_IS_SFNT( face ) )
return FT_Err_Invalid_Face_Handle;
- FT_FACE_FIND_SERVICE( face, service, FT_SERVICE_ID_SFNT_TABLE );
+ FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
+ face,
+ FT_SERVICE_ID_SFNT_TABLE );
if ( service == NULL )
return FT_Err_Unimplemented_Feature;
diff --git a/src/base/ftxf86.c b/src/base/ftxf86.c
index e8e3056..e9188e1 100644
--- a/src/base/ftxf86.c
+++ b/src/base/ftxf86.c
@@ -26,8 +26,10 @@
{
const char* result = NULL;
+
if ( face )
- FT_FACE_FIND_SERVICE( result, face, FT_SERVICE_ID_XF86_NAME );
+ FT_FACE_FIND_SERVICE( const char*, result,
+ face, FT_SERVICE_ID_XF86_NAME );
return result;
}