* include/freetype/config/ftconfig.h, src/base/ftstream.c

(FT_Stream_ReadFields): More fixes using FT_CHAR_BIT.

* include/freetype/config/ftconfig.h (FT_CHAR_BIT): New macro.
This commit is contained in:
Werner Lemberg 2004-04-16 03:50:55 +00:00
parent fdd710cc7e
commit 63df8823f2
3 changed files with 29 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2004-04-15 bytesoftware <bytesoftware@btinternet.com>
* include/freetype/config/ftconfig.h, src/base/ftstream.c
(FT_Stream_ReadFields): More fixes using FT_CHAR_BIT.
2004-04-14 Werner Lemberg <wl@gnu.org>
* include/freetype/config/ftconfig.h (FT_CHAR_BIT): New macro.
2004-04-14 Alex Strelnikov <ptktyrf@mail.ru>
* src/cache/ftcsbits.c (ftc_snode_load): Initialize `*asize' in case

View File

@ -66,22 +66,27 @@ FT_BEGIN_HEADER
/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
/* `char' type. */
#ifndef FT_CHAR_BIT
#define FT_CHAR_BIT CHAR_BIT
#endif
/* The size of an `int' type. */
#if FT_UINT_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_INT (32 / CHAR_BIT)
#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
#elif FT_UINT_MAX == 0xFFFFU
#define FT_SIZEOF_INT (16 / CHAR_BIT)
#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_INT (64 / CHAR_BIT)
#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `int' type!"
#endif
/* The size of a `long' type. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / CHAR_BIT)
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_LONG (64 / CHAR_BIT)
#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `long' type!"
#endif
@ -131,12 +136,12 @@ FT_BEGIN_HEADER
typedef signed short FT_Int16;
typedef unsigned short FT_UInt16;
#if FT_SIZEOF_INT == 4
#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
#elif FT_SIZEOF_LONG == 4
#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
@ -146,12 +151,12 @@ FT_BEGIN_HEADER
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= 4
#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
typedef long FT_Fast;
typedef unsigned long FT_UFast;
@ -161,7 +166,7 @@ FT_BEGIN_HEADER
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
#if FT_SIZEOF_LONG == 8
#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
@ -197,7 +202,7 @@ FT_BEGIN_HEADER
#define FT_LONG64
#define FT_INT64 long long int
#endif /* FT_SIZEOF_LONG == 8 */
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
#define FT_BEGIN_STMNT do {

View File

@ -4,7 +4,7 @@
/* */
/* I/O stream support (body). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -770,15 +770,15 @@
p = (FT_Byte*)structure + fields->offset;
switch ( fields->size )
{
case 1:
case (8 / FT_CHAR_BIT):
*(FT_Byte*)p = (FT_Byte)value;
break;
case 2:
case (16 / FT_CHAR_BIT):
*(FT_UShort*)p = (FT_UShort)value;
break;
case 4:
case (32 / FT_CHAR_BIT):
*(FT_UInt32*)p = (FT_UInt32)value;
break;