summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2001-06-19 13:41:59 +0000
committerDavid Turner <david@freetype.org>2001-06-19 13:41:59 +0000
commitc7b1d818a887cb148fb9071ffe3c8e3977668be7 (patch)
tree97de0a0ee19a40a80934acfa7870c3d9a90a6038
parent8ec0b130d84c66684f2049ad50cd266b4848ad37 (diff)
downloadfreetype2-c7b1d818a887cb148fb9071ffe3c8e3977668be7.tar.gz
* include/freetype/fterrors.h: updated some of the error macros to
simplify Werner's latest tricks :o)
-rw-r--r--ChangeLog12
-rw-r--r--include/freetype/fterrors.h75
-rw-r--r--include/freetype/ftmoderr.h57
-rw-r--r--src/autohint/aherrors.h9
-rw-r--r--src/cache/ftcerror.h9
-rw-r--r--src/cff/cfferrs.h8
-rw-r--r--src/cid/ciderrs.h9
-rw-r--r--src/pcf/pcferror.h9
-rw-r--r--src/psaux/psauxerr.h9
-rw-r--r--src/psnames/psnamerr.h9
-rw-r--r--src/raster/rasterrs.h9
-rw-r--r--src/sfnt/sferrors.h9
-rw-r--r--src/sfnt/ttsbit.c4
-rw-r--r--src/smooth/ftsmerrs.h9
-rw-r--r--src/truetype/tterrors.h9
-rw-r--r--src/type1/t1errors.h9
-rw-r--r--src/winfonts/fnterrs.h9
17 files changed, 131 insertions, 133 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e672d499..47f9291b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-06-19 David Turner <david@freetype.org>
+
+ * include/freetype/fterrors.h: updated some of the error macros to
+ simplify Werner's latest tricks :o)
+
+ * include/freetype/freetype.h (FT_New_Memory_Face): updated docs
+
+ Removing _lots_ of compiler warnings when the most pedantic warning
+ levels of Visual C++ and Borland C++ are used. Too many files to be
+ listed here.., but FT2 now compiles without warnings with VC++ and
+ the "/W4" warning level (lint-style)
+
2001-06-18 Werner Lemberg <wl@gnu.org>
Minor cleanups to remove compiler warnings.
diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h
index bdfc8b016..3228f91f9 100644
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -85,6 +85,8 @@
#ifndef __FTERRORS_H__
#define __FTERRORS_H__
+/* include module base error codes */
+#include FT_MODULE_ERRORS_H
/*******************************************************************/
/*******************************************************************/
@@ -93,37 +95,59 @@
/***** *****/
/*******************************************************************/
/*******************************************************************/
+
+#undef FT_NEED_EXTERN_C
+#define FT_ERR_XCAT(x,y) x ## y
+#define FT_ERR_CAT(x,y) FT_ERR_XCAT(x,y)
-#include FT_MODULE_ERRORS_H
-#undef FT_NEED_EXTERN_C
+/* FT_ERR_PREFIX is used as a prefix for error identifiers */
+/* by default, we use "FT_Err_" */
+/* */
+#ifndef FT_ERR_PREFIX
+# define FT_ERR_PREFIX FT_Err_
+#endif
+
+
+
+/* FT_ERR_BASE is used as the base for module-specific errors */
+/* */
+#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
+# ifndef FT_ERR_BASE
+# define FT_ERR_BASE FT_Mod_Err_Base
+# endif
+#else
+# define FT_ERR_BASE 0
+#endif
+
+
+
+/* if FT_ERRORDEF is not defined, we need to define a simple enumeration */
+/* type.. */
+/* */
#ifndef FT_ERRORDEF
# define FT_ERRORDEF( e, v, s ) e = v,
+# define FT_ERROR_START_LIST enum {
+# define FT_ERROR_END_LIST FT_ERR_CAT(FT_ERR_PREFIX,Max) };
# ifdef __cplusplus
-# define FT_NEED_EXTERN_C
+# define FT_NEED_EXTERN_C
extern "C" {
# endif
#endif /* !FT_ERRORDEF */
-#ifndef FT_ERROR_START_LIST
-# define FT_ERROR_START_LIST enum {
-#endif
-
-#ifndef FT_ERROR_END_LIST
-# define FT_ERROR_END_LIST FT_Err_Max };
-#endif
+/* this macro is used to define an error */
+# define FT_ERRORDEF_( e, v, s ) \
+ FT_ERRORDEF( FT_ERR_CAT(FT_ERR_PREFIX,e), v + FT_ERR_BASE, s )
+/* this is only used for FT_Err_Ok, which must be 0 !! */
+# define FT_NOERRORDEF_( e, v, s ) \
+ FT_ERRORDEF( FT_ERR_CAT(FT_ERR_PREFIX,e), v, s )
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_Err_ ## e, v + FT_Mod_Err_Base, s )
-
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FT_Err_ ## e, v, s )
/*******************************************************************/
@@ -134,8 +158,9 @@
/*******************************************************************/
/*******************************************************************/
+#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
-
+#endif
/* generic errors */
@@ -313,8 +338,9 @@
"argument stack underflow" )
+#ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST
-
+#endif
/*******************************************************************/
/*******************************************************************/
@@ -324,17 +350,22 @@
/*******************************************************************/
/*******************************************************************/
+#ifdef FT_NEED_EXTERN_C
+ }
+#endif
+
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
+
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_
+#undef FT_NEED_EXTERN_C
+#undef FT_ERR_PREFIX
+#undef FT_ERR_BASE
+#undef FT_ERR_CONCAT
-#ifdef FT_NEED_EXTERN_C
- }
-#endif
-
-#endif /* __FT_ERRORS_H__ */
+#endif /* __FTERRORS_H__ */
/* END */
diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h
index 71252a1cc..0ebbc6984 100644
--- a/include/freetype/ftmoderr.h
+++ b/include/freetype/ftmoderr.h
@@ -58,29 +58,40 @@
#define __FTMODERR_H__
-#undef FT_NEED_EXTERN_C
-
-
-
-
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** SETUP MACROS *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
+
+#undef FT_NEED_EXTERN_C
#ifndef FT_MODERRDEF
-#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
-#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
-#else
-#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
-#endif
+# ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
+# define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
+# else
+# define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
+# endif
-#define FT_MODERR_START_LIST enum {
-#define FT_MODERR_END_LIST FT_Mod_Err_Max };
+# define FT_MODERR_START_LIST enum {
+# define FT_MODERR_END_LIST FT_Mod_Err_Max };
-#ifdef __cplusplus
-#define FT_NEED_EXTERN_C
+# ifdef __cplusplus
+# define FT_NEED_EXTERN_C
extern "C" {
-#endif
+# endif
#endif /* !FT_MODERRDEF */
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** LIST MODULE ERROR BASES *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
#ifdef FT_MODERR_START_LIST
FT_MODERR_START_LIST
@@ -107,16 +118,24 @@
FT_MODERR_END_LIST
#endif
+ /*******************************************************************/
+ /*******************************************************************/
+ /***** *****/
+ /***** CLEANUP *****/
+ /***** *****/
+ /*******************************************************************/
+ /*******************************************************************/
+
+#ifdef FT_NEED_EXTERN_C
+ }
+#endif
#undef FT_MODERR_START_LIST
#undef FT_MODERR_END_LIST
#undef FT_MODERRDEF
+#undef FT_NEED_EXTERN_C
-#ifdef FT_NEED_EXTERN_C
- }
-#endif
-
#endif /* __FTMODERR_H__ */
diff --git a/src/autohint/aherrors.h b/src/autohint/aherrors.h
index b236a64e8..0965d1f94 100644
--- a/src/autohint/aherrors.h
+++ b/src/autohint/aherrors.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( AH_Err_ ## e, v + FT_Mod_Err_Autohint, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( AH_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST AH_Err_Max };
+#define FT_ERR_PREFIX AH_Err_
+#define FT_ERR_BASE FT_Mod_Err_Autohint
#include FT_ERRORS_H
diff --git a/src/cache/ftcerror.h b/src/cache/ftcerror.h
index 3da42b3ea..dc0a5c615 100644
--- a/src/cache/ftcerror.h
+++ b/src/cache/ftcerror.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FTC_Err_ ## e, v + FT_Mod_Err_Cache, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FTC_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST FTC_Err_Max };
+#define FT_ERR_PREFIX FTC_Err_
+#define FT_ERR_BASE FT_Mod_Err_Cache
#include FT_ERRORS_H
diff --git a/src/cff/cfferrs.h b/src/cff/cfferrs.h
index 0ae0a3ded..0eb704f1c 100644
--- a/src/cff/cfferrs.h
+++ b/src/cff/cfferrs.h
@@ -29,13 +29,9 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( CFF_Err_ ## e, v + FT_Mod_Err_CFF, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( CFF_Err_ ## e, v, s )
+#define FT_ERR_PREFIX CFF_Err_
+#define FT_ERR_BASE FT_Mod_Err_CFF
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST CFF_Err_Max };
#include FT_ERRORS_H
diff --git a/src/cid/ciderrs.h b/src/cid/ciderrs.h
index 9aa2f38e4..c019e4758 100644
--- a/src/cid/ciderrs.h
+++ b/src/cid/ciderrs.h
@@ -29,13 +29,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( CID_Err_ ## e, v + FT_Mod_Err_CID, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( CID_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST CID_Err_Max };
+#define FT_ERR_PREFIX CID_Err_
+#define FT_ERR_BASE FT_Mod_Err_CID
#include FT_ERRORS_H
diff --git a/src/pcf/pcferror.h b/src/pcf/pcferror.h
index 2404ea975..6e0e8d9c0 100644
--- a/src/pcf/pcferror.h
+++ b/src/pcf/pcferror.h
@@ -29,13 +29,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PCF_Err_ ## e, v + FT_Mod_Err_PCF, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PCF_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST PCF_Err_Max };
+#define FT_ERR_PREFIX PCF_Err_
+#define FT_ERR_BASE FT_Mod_Err_PCF
#include FT_ERRORS_H
diff --git a/src/psaux/psauxerr.h b/src/psaux/psauxerr.h
index 2533277f2..f76365357 100644
--- a/src/psaux/psauxerr.h
+++ b/src/psaux/psauxerr.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PSaux_Err_ ## e, v + FT_Mod_Err_PSaux, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PSaux_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST PSaux_Err_Max };
+#define FT_ERR_PREFIX PSaux_Err_
+#define FT_ERR_BASE FT_Mod_Err_PSaux
#include FT_ERRORS_H
diff --git a/src/psnames/psnamerr.h b/src/psnames/psnamerr.h
index c620a879d..134845a1c 100644
--- a/src/psnames/psnamerr.h
+++ b/src/psnames/psnamerr.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PSnames_Err_ ## e, v + FT_Mod_Err_PSnames, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( PSnames_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST PSnames_Err_Max };
+#define FT_ERR_PREFIX PSnames_Err_
+#define FT_ERR_BASE FT_Mod_Err_PSnames
#include FT_ERRORS_H
diff --git a/src/raster/rasterrs.h b/src/raster/rasterrs.h
index a9b380520..3e4d5fe0c 100644
--- a/src/raster/rasterrs.h
+++ b/src/raster/rasterrs.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( Raster_Err_ ## e, v + FT_Mod_Err_Raster, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( Raster_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST Raster_Err_Max };
+#define FT_ERR_PREFIX Raster_Err_
+#define FT_ERR_BASE FT_Mod_Err_Raster
#include FT_ERRORS_H
diff --git a/src/sfnt/sferrors.h b/src/sfnt/sferrors.h
index fefd160de..d9c4f7665 100644
--- a/src/sfnt/sferrors.h
+++ b/src/sfnt/sferrors.h
@@ -29,13 +29,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( SFNT_Err_ ## e, v + FT_Mod_Err_SFNT, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( SFNT_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST SFNT_Err_Max };
+#define FT_ERR_PREFIX SFNT_Err_
+#define FT_ERR_BASE FT_Mod_Err_SFNT
#include FT_ERRORS_H
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 8850c6af6..f3b8eec25 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -105,7 +105,7 @@
for ( height = target->rows; height > 0; height-- )
{
FT_Byte* cur = line_buff; /* current write cursor */
- FT_UInt count = line_bits; /* # of bits to extract per line */
+ FT_Int count = line_bits; /* # of bits to extract per line */
FT_Byte shift = (FT_Byte)(x_offset & 7); /* current write shift */
FT_Byte space = (FT_Byte)(8 - shift);
@@ -156,7 +156,7 @@
/* ensure that there are at least `count' bits in the accumulator */
- if ( loaded < count )
+ if ( (FT_Int)loaded < count )
{
acc |= (FT_UShort)*source++ << ( 8 - loaded );
loaded += 8;
diff --git a/src/smooth/ftsmerrs.h b/src/smooth/ftsmerrs.h
index 0eb4062b0..9f06bbc2c 100644
--- a/src/smooth/ftsmerrs.h
+++ b/src/smooth/ftsmerrs.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( Smooth_Err_ ## e, v + FT_Mod_Err_Smooth, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( Smooth_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST Smooth_Err_Max };
+#define FT_ERR_PREFIX Smooth_Err_
+#define FT_ERR_BASE FT_Mod_Err_Smooth
#include FT_ERRORS_H
diff --git a/src/truetype/tterrors.h b/src/truetype/tterrors.h
index bb611b5b7..bf67190af 100644
--- a/src/truetype/tterrors.h
+++ b/src/truetype/tterrors.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( TT_Err_ ## e, v + FT_Mod_Err_TrueType, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( TT_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST TT_Err_Max };
+#define FT_ERR_PREFIX TT_Err_
+#define FT_ERR_BASE FT_Mod_Err_TrueType
#include FT_ERRORS_H
diff --git a/src/type1/t1errors.h b/src/type1/t1errors.h
index cf5c8b689..90f65e60f 100644
--- a/src/type1/t1errors.h
+++ b/src/type1/t1errors.h
@@ -29,13 +29,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( T1_Err_ ## e, v + FT_Mod_Err_Type1, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( T1_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST T1_Err_Max };
+#define FT_ERR_PREFIX T1_Err_
+#define FT_ERR_BASE FT_Mod_Err_Type1
#include FT_ERRORS_H
diff --git a/src/winfonts/fnterrs.h b/src/winfonts/fnterrs.h
index 730d4ead3..a05a7e9be 100644
--- a/src/winfonts/fnterrs.h
+++ b/src/winfonts/fnterrs.h
@@ -30,13 +30,8 @@
#undef __FTERRORS_H__
-#define FT_ERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FNT_Err_ ## e, v + FT_Mod_Err_Winfonts, s )
-#define FT_NOERRORDEF_( e, v, s ) \
- FT_ERRORDEF( FNT_Err_ ## e, v, s )
-
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST FNT_Err_Max };
+#define FT_ERR_PREFIX FNT_Err_
+#define FT_ERR_BASE FT_Mod_Err_Winfonts
#include FT_ERRORS_H