ref: 8a803a6c2bc952d85f47df07f4d01c879987898b
parent: 336bc908c856c983a05d0f99ba18c56c00c9d298
author: Werner Lemberg <[email protected]>
date: Thu Apr 15 23:50:55 EDT 2004
* 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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-15 bytesoftware <[email protected]>
+
+ * include/freetype/config/ftconfig.h, src/base/ftstream.c
+ (FT_Stream_ReadFields): More fixes using FT_CHAR_BIT.
+
+2004-04-14 Werner Lemberg <[email protected]>
+
+ * include/freetype/config/ftconfig.h (FT_CHAR_BIT): New macro.
+
2004-04-14 Alex Strelnikov <[email protected]>
* src/cache/ftcsbits.c (ftc_snode_load): Initialize `*asize' in case
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -66,13 +66,18 @@
/* `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
@@ -79,9 +84,9 @@
/* 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 @@
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 @@
#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 @@
/* 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 @@
#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 {
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -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;