summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2003-09-17 19:20:02 +0000
committerWerner Lemberg <wl@gnu.org>2003-09-17 19:20:02 +0000
commit46333a118f0cb18f86ddda323cec6220809c130e (patch)
tree75112b59f2f24cac9c68dd6a60f7f2c41768ef20
parent013efd14103cbe453714749c1abe16258385d911 (diff)
downloadfreetype2-46333a118f0cb18f86ddda323cec6220809c130e.tar.gz
* 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.
-rw-r--r--ChangeLog16
-rw-r--r--include/freetype/internal/ftserv.h76
-rw-r--r--src/base/ftbdf.c8
-rw-r--r--src/base/ftmm.c3
-rw-r--r--src/base/ftobjs.c25
-rw-r--r--src/base/ftxf86.c4
6 files changed, 85 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 49bb206ca..3eccefb06 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 8f7643183..4e498ad46 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 0f5dcb7f1..9b597871e 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, &registry );
@@ -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 55ec42664..a11c934c0 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 8ec8f1676..11b17a6f4 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 e8e3056f9..e9188e102 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;
}