* 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
diff --git a/ChangeLog b/ChangeLog
index 1007454..47c2915 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index e7a4a22..4bd8cf6 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -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 {
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 60e7856..7ff1e90 100644
--- 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;