From e61d8fd8519f5e7b4a3b3760463a96bb3a0a17f1 Mon Sep 17 00:00:00 2001 From: Mikhail Teterin Date: Wed, 5 Sep 2001 14:56:00 +0000 Subject: [PATCH] Uh, actually commit the patches described in my previous commit. The primary purpose is to fix the port on Alphas. --- graphics/lcms/files/patch-32bit | 127 ++++++++++++++++++++++++++++++++ graphics/lcms/files/patch-icc34 | 14 ++++ graphics/lcms/files/patch-test | 10 +++ 3 files changed, 151 insertions(+) create mode 100644 graphics/lcms/files/patch-32bit create mode 100644 graphics/lcms/files/patch-icc34 create mode 100644 graphics/lcms/files/patch-test diff --git a/graphics/lcms/files/patch-32bit b/graphics/lcms/files/patch-32bit new file mode 100644 index 000000000000..6a458fad6f06 --- /dev/null +++ b/graphics/lcms/files/patch-32bit @@ -0,0 +1,127 @@ +This patch fixes assumptions made in different parts of the code +regarding the sizeof long and int. The original code appears to use them +interchangeably, even though it expects them to be 32 bit wide. +--- cmsio1.c Tue Feb 13 12:08:06 2001 ++++ cmsio1.c Wed Sep 5 10:20:58 2001 +@@ -96,5 +96,5 @@ + /* Dictionary */ + +- int TagCount; ++ icInt32Number TagCount; + icTagSignature TagNames[MAX_TABLE_TAG]; + size_t TagSizes[MAX_TABLE_TAG]; +@@ -194,5 +194,5 @@ + icTag Tag; + icHeader Header; +- long TagCount, i; ++ icInt32Number TagCount, i; + + fread(&Header, sizeof(icHeader), 1, ICCfile); +@@ -230,5 +230,5 @@ + Icc -> stream = ICCfile; + +- if (fread(&TagCount, sizeof(long), 1, ICCfile) != 1) ++ if (fread(&TagCount, sizeof(TagCount), 1, ICCfile) != 1) + goto ErrorCleanup; + +@@ -276,7 +276,7 @@ + + static +-int SearchTag(LPICCPROFILE Profile, icTagSignature sig) ++icInt32Number SearchTag(LPICCPROFILE Profile, icTagSignature sig) + { +- int i; ++ icInt32Number i; + + for (i=0; i < Profile -> TagCount; i++) +@@ -297,5 +297,5 @@ + { + LPVOID Ptr; +- int i; ++ icInt32Number i; + + i = SearchTag(Icc, sig); +@@ -525,5 +525,5 @@ + if (!file) + { +- int i; ++ icInt32Number i; + + for (i=0; i < icco -> TagCount; i++) +@@ -1383,7 +1383,7 @@ + + static +-long TransportValue32(long Value) ++icInt32Number TransportValue32(icInt32Number Value) + { +- long Temp = Value; ++ icInt32Number Temp = Value; + + AdjustEndianess32((LPBYTE) &Temp); +@@ -1520,5 +1520,5 @@ + BOOL SaveGamma(FILE *OutStream, LPGAMMATABLE Gamma) + { +- long Count; ++ icInt32Number Count; + int i; + +@@ -1528,5 +1528,5 @@ + Count = TransportValue32(Gamma->nEntries); + +- if (!DoWrite(OutStream, sizeof(long), &Count)) return FALSE; ++ if (!DoWrite(OutStream, sizeof(Count), &Count)) return FALSE; + + for (i=0; i < Gamma->nEntries; i++) +@@ -1549,5 +1549,5 @@ + + +-/* Save an ASCII Tag (long) */ ++/* Save an ASCII Tag (icInt32Number) */ + + static +@@ -1644,9 +1644,9 @@ + BOOL SaveTagDirectory(FILE *OutStream, LPICCPROFILE Icc) + { +- int i; ++ icInt32Number i; + icTag Tag; +- long TagCount = TransportValue32(Icc -> TagCount); ++ icInt32Number TagCount = TransportValue32(Icc -> TagCount); + +- if (!DoWrite(OutStream, sizeof(long) , &TagCount)) return FALSE; ++ if (!DoWrite(OutStream, sizeof(TagCount) , &TagCount)) return FALSE; + + for (i=0; i < Icc -> TagCount; i++) { +@@ -1670,5 +1670,5 @@ + + LPBYTE Data; +- int i; ++ icInt32Number i; + size_t Begin; + +--- cmsmtrx.c Tue Feb 13 12:08:06 2001 ++++ cmsmtrx.c Wed Sep 5 10:28:02 2001 +@@ -705,6 +705,6 @@ + void VEC3scaleAndCut(LPWVEC3 r, LPVEC3 v, double d) + { +- r -> n[VX] = (long) floor(v -> n[VX] * d + .5); +- r -> n[VY] = (long) floor(v -> n[VY] * d + .5); +- r -> n[VZ] = (long) floor(v -> n[VZ] * d + .5); ++ r -> n[VX] = (icInt32Number) floor(v -> n[VX] * d + .5); ++ r -> n[VY] = (icInt32Number) floor(v -> n[VY] * d + .5); ++ r -> n[VZ] = (icInt32Number) floor(v -> n[VZ] * d + .5); + } +--- lcms.h Mon Feb 19 04:55:06 2001 ++++ lcms.h Wed Sep 5 10:31:08 2001 +@@ -621,9 +621,9 @@ + /* Fixed point */ + +-typedef long Fixed32; /* Fixed 15.16 whith sign */ ++typedef icInt32Number Fixed32; /* Fixed 15.16 whith sign */ + + + #define INT_TO_FIXED(x) ((x)<<16) +-#define DOUBLE_TO_FIXED(x) ((long)((x)*65536.0+.5)) ++#define DOUBLE_TO_FIXED(x) ((icInt32Number)((x)*65536.0+.5)) + #define FIXED_TO_INT(x) ((x)>>16) + #define FIXED_REST_TO_INT(x) ((x)&0xFFFFU) diff --git a/graphics/lcms/files/patch-icc34 b/graphics/lcms/files/patch-icc34 new file mode 100644 index 000000000000..cbfc341be5c7 --- /dev/null +++ b/graphics/lcms/files/patch-icc34 @@ -0,0 +1,14 @@ +Try to use the int32 and friends on all Unixes -- not just SGI's Irix. +--- icc34.h Tue Feb 13 12:08:06 2001 ++++ icc34.h Wed Sep 5 10:08:42 2001 +@@ -141,8 +141,10 @@ + * etc into icXXX form. The rest of the header uses the icXXX + * typedefs. Signatures are 4 byte quantities. + */ ++#ifdef __unix__ + #ifdef __sgi + #include "sgidefs.h" ++#endif + + typedef __int32_t icSignature; + diff --git a/graphics/lcms/files/patch-test b/graphics/lcms/files/patch-test new file mode 100644 index 000000000000..0d224b296513 --- /dev/null +++ b/graphics/lcms/files/patch-test @@ -0,0 +1,10 @@ +Inititialize/clear more variables. Now this test works on Alphas too. +--- ../testbed/testcms.c Tue Feb 13 12:08:32 2001 ++++ ../testbed/testcms.c Wed Sep 5 10:04:07 2001 +@@ -582,5 +582,5 @@ + static void ClearStats(LPSTATS p) + { +- p -> x = p -> y = p -> x2 = p -> y2 = p -> xy ++ p -> n = p -> x = p -> y = p -> x2 = p -> y2 = p -> xy + = p -> Peak = 0.0; + }