* include/freetype/fterrors.h: updated some of the error macros to

simplify Werner's latest tricks :o)
This commit is contained in:
David Turner 2001-06-19 13:41:59 +00:00
parent 8ec0b130d8
commit c7b1d818a8
17 changed files with 134 additions and 136 deletions

View File

@ -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.

View File

@ -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 @@
/*******************************************************************/
/*******************************************************************/
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_
#ifdef FT_NEED_EXTERN_C
}
#endif
#endif /* __FT_ERRORS_H__ */
#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
#endif /* __FTERRORS_H__ */
/* END */

View File

@ -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
#undef FT_MODERR_START_LIST
#undef FT_MODERR_END_LIST
#undef FT_MODERRDEF
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** 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
#endif /* __FTMODERR_H__ */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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