Upgrade to 1.2.0.8, which contains some of our patches. Add two more,

which should solve some crashes and allow to compile with a non-GCC
compiler (Re: zero-sized arrays).

Unfortunately, this still crashes on some images, but the vendor has
already pulled the 1.2.0.7 from the mirrors, so this upgrade will, at
least, keep things downloadable.
This commit is contained in:
Mikhail Teterin 2003-04-27 15:16:00 +00:00
parent 3cfd563526
commit f9063e87bf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=79746
5 changed files with 284 additions and 123 deletions

View file

@ -6,7 +6,7 @@
#
PORTNAME= libfpx
PORTVERSION= 1.2.0.7
PORTVERSION= 1.2.0.8
CATEGORIES= graphics
MASTER_SITES= ftp://gd.tuwien.ac.at/pub/graphics/%SUBDIR%/ \
ftp://ftp.sunet.se/pub/multimedia/graphics/%SUBDIR%/ \

View file

@ -1 +1 @@
MD5 (libfpx-1.2.0.7.tar.bz2) = 8f4dd8d6706562dcb0c7aeeb65d862fb
MD5 (libfpx-1.2.0.8.tar.bz2) = c926fc8d450be7a2a6337f75d39d83a0

View file

@ -0,0 +1,87 @@
--- fpx/buffdesc.cpp Wed Apr 23 21:31:48 2003
+++ fpx/buffdesc.cpp Fri Apr 25 18:41:02 2003
@@ -74,69 +74,31 @@
}
}
-/*
-// Rotate on the left by 8 bits on each 32 bits long and wrap the last one
-static void Shift8BitsLeft (unsigned char* buffer, long size)
-{
- register unsigned long tmp;
- register unsigned long* all = (unsigned long*)(buffer);
- while (size--) {
- tmp = (*all) >> 24;
- (*all) = ((*all) << 8) | tmp;
- all++;
- }
-} */
+
//Updated the procedure to work on both architedture --**IM-05/16/97
// Rotate on the left by 8 bits on each 32 bits long and wrap the last one
static void Shift8BitsLeft (unsigned char* buffer, long size)
{
- register unsigned long tmp;
- register unsigned long* all = (unsigned long*)(buffer);
+ unsigned char tmp;
while (size--) {
-
-#ifdef IN_LITTLE_ENDIAN
- *all = (unsigned long) SwapBytes( (int32) *all );
-#endif
-
- tmp = (*all) >> 24;
- (*all) = ((*all) << 8) | tmp;
-
-#ifdef IN_LITTLE_ENDIAN
- *all = (unsigned long) SwapBytes( (int32) *all );
-#endif
-
- all++;
+ tmp = buffer[0];
+ buffer[0] = buffer[1];
+ buffer[1] = buffer[2];
+ buffer[2] = buffer[3];
+ buffer[3] = tmp;
+ buffer += 4;
}
}
-/*
-// Rotate on the right by 8 bits on each 32 bits long and wrap the last one
-static void Shift8BitsRight (unsigned char* buffer, long size)
-{
- register unsigned long tmp;
- register unsigned long* all = (unsigned long*)(buffer);
- while (size--) {
- tmp = (*all) << 24;
- (*all) = ((*all) >> 8) | tmp;
- all++;
- }
-}
-*/
// Rotate on the right by 8 bits on each 32 bits long and wrap the last one
static void Shift8BitsRight (unsigned char* buffer, long size)
{
- register unsigned long tmp;
- register unsigned long* all = (unsigned long*)(buffer);
+ unsigned char tmp;
while (size--) {
-
-#ifdef IN_LITTLE_ENDIAN
- *all = (unsigned long) SwapBytes( (int32) *all );
-#endif
- tmp = (*all) << 24;
- (*all) = ((*all) >> 8) | tmp;
-
-#ifdef IN_LITTLE_ENDIAN
- *all = (unsigned long) SwapBytes( (int32) *all );
-#endif
- all++;
+ tmp = buffer[3];
+ buffer[3] = buffer[2];
+ buffer[2] = buffer[1];
+ buffer[1] = buffer[0];
+ buffer[0] = tmp;
+ buffer += 4;
}
}

View file

@ -24,35 +24,20 @@
@@ -67,5 +68,5 @@
ConstStr27Param,ConstStr15Param;
- typedef unsigned32 OSType;
- typedef unsigned long OSType;
+ typedef intptr_t OSType;
typedef OSType *OSTypePtr;
--- fpx/buffdesc.cpp Sat Dec 23 14:37:48 2000
+++ fpx/buffdesc.cpp Thu Nov 7 06:25:35 2002
@@ -1381,5 +1381,5 @@
CLIPDATA * clipData)
{
- char* buffer;
+ Ptr buffer;
long thumbnailSize;
ptr_Compresseur monCompresseur;
--- ri_image/priimage.h Sat Dec 23 14:37:49 2000
+++ ri_image/priimage.h Thu Nov 7 06:31:12 2002
@@ -15,4 +15,5 @@
#ifndef PRIImage_h
#define PRIImage_h
+ #include <sys/types.h>
#ifndef Commun_h
#include "common.h"
@@ -163,9 +164,9 @@
void ResetMagicNumber() { magicNumber = 0; }
- void SetMagicNumber() { magicNumber = (int32)(this); }
- Boolean ChallengeMagicNumber() { return (magicNumber == (int32)(this)); }
- void SetMagicNumber(int32 id) { magicNumber = id; }
- Boolean ChallengeMagicNumber(int32 id) { return (magicNumber == id); }
- int32 GetMagicNumber() { return magicNumber; }
- void SetMagicNumber() { magicNumber = (unsigned long)(this); }
- Boolean ChallengeMagicNumber() { return (magicNumber == (unsigned long)(this)); }
- void SetMagicNumber(unsigned long id) { magicNumber = id; }
- Boolean ChallengeMagicNumber(unsigned long id) { return (magicNumber == id); }
- unsigned long GetMagicNumber() { return magicNumber; }
+ void SetMagicNumber() { magicNumber = (intptr_t)(this); }
+ Boolean ChallengeMagicNumber() { return (magicNumber == (intptr_t)(this)); }
+ void SetMagicNumber(intptr_t id) { magicNumber = id; }
@ -63,105 +48,7 @@
@@ -215,5 +216,5 @@
// Reference management
- int32 magicNumber; // Used to reference a PRIImage object used by several composition objects
+ intptr_t magicNumber; // Used to reference a PRIImage object used by several composition objects
- unsigned long magicNumber; // Used to reference a PRIImage object used by several composition objects
+ intptr_t magicNumber; // Used to reference a PRIImage object used by several composition objects
long nbRefs; // Number of existing references to this PRIImage object
--- ri_image/ptile.h Sat Aug 11 20:04:06 2001
+++ ri_image/ptile.h Thu Nov 7 06:42:20 2002
@@ -212,5 +212,5 @@
static long indexLocked;
- static char* decompressBuffer; // Global buffer for decompression
+ static Ptr decompressBuffer; // Global buffer for decompression
static long decompressSize; // Size of the decompression buffer
static Boolean decompressLock; // true if buffer in use
--- fpx/ptil_fpx.cpp Sat Dec 23 14:37:48 2000
+++ fpx/ptil_fpx.cpp Thu Nov 7 06:47:35 2002
@@ -301,5 +301,5 @@
ptr_Compresseur monCompresseur;
- char *buffer = NULL;
+ Ptr buffer = NULL;
Pixel *entireTile;
Boolean wasLocked;
@@ -422,5 +422,5 @@
// Set the output buffer to write
- buffer = (char *)(entireTile);
+ buffer = (Ptr)entireTile;
break;
@@ -478,5 +478,5 @@
memcpy(decompressBuffer, buffer, tileSize);
} else
- decompressBuffer = (char *)entireTile;
+ decompressBuffer = (Ptr)entireTile;
// Get the jpeg compressor
@@ -1703,7 +1703,6 @@
// Get jpeg table index and make sure it is in 0 - 255 range
- unsigned char JPEGtableSelector = ((PResolutionFlashPix*)fatherSubImage)->compressTableGroup;
- JPEGtableSelector = (JPEGtableSelector < 0) ? 0 : JPEGtableSelector;
- JPEGtableSelector = (JPEGtableSelector >255) ? 255 : JPEGtableSelector;
+ unsigned char JPEGtableSelector =
+ (((PResolutionFlashPix*)fatherSubImage)->compressTableGroup >255) ? 255 : JPEGtableSelector;
--- ri_image/corr_lut.cpp Sat Dec 23 14:37:49 2000
+++ ri_image/corr_lut.cpp Thu Nov 7 07:00:54 2002
@@ -175,5 +175,4 @@
RGBColor colorTarget={0,0,0};
Boolean valide=FALSE;
- long influence=0;
int i;
@@ -190,5 +189,5 @@
for (i=0; i<lut_NbContraintes; i++)
file.Ecriture(valide);
- file.Ecriture(influence);
+ file.Ecriture((short)0);
}
}
@@ -199,5 +198,5 @@
RGBColor colorTarget={0,0,0};
Boolean valide=FALSE;
- long influence=0;
+ short int influence=0;
int i;
--- ri_image/ptile.cpp Sat Dec 23 14:37:49 2000
+++ ri_image/ptile.cpp Thu Nov 7 07:05:05 2002
@@ -84,5 +84,5 @@
long PTile::allocTiles = 0; // Debug use
- char* PTile::decompressBuffer = NULL;
+ Ptr PTile::decompressBuffer = NULL;
long PTile::decompressSize = 0;
Boolean PTile::decompressLock = false;
@@ -1456,5 +1456,5 @@
FastDeleteArray(decompressBuffer, char);
- FastAllocArray(decompressBuffer, char, size);
+ FastAllocArray(decompressBuffer, int8, size);
if (decompressBuffer)
decompressSize = size;
--- oless/h/dir.hxx Thu Feb 7 17:04:15 2002
+++ oless/h/dir.hxx Wed Nov 20 13:38:02 2002
@@ -87,5 +87,5 @@
//
//-----------------------------------------------------------------------
-const unsigned int CBDIRPAD = DIRENTRYSIZE - sizeof(SPreDirEntry);
+const unsigned int CBDIRPAD = (unsigned int)DIRENTRYSIZE - (unsigned int)sizeof(SPreDirEntry);
// DirEntry bit flags are used for the following private state
--- oless/wchar.c Fri Feb 8 11:23:42 2002
+++ oless/wchar.c Wed Nov 20 13:59:38 2002
@@ -32,4 +32,6 @@
#ifndef _MSC_VER
+#include <string.h> /* strlen()'s declaration */
+
size_t sbstowcs(WCHAR *pwcs, const char *s, size_t n )
{

View file

@ -0,0 +1,187 @@
--- oless/h/page.hxx Sat Dec 23 17:37:48 2000
+++ oless/h/page.hxx Fri Apr 25 12:43:54 2003
@@ -60,5 +60,5 @@
inline ULONG GetOffset(void) const;
inline SECT GetSect(void) const;
- inline void *GetData(void) const;
+ inline BYTE *GetData(void) const;
inline DWORD GetFlags(void) const;
inline CPagedVector * GetVector(void) const;
@@ -92,19 +92,4 @@
DWORD _dwFlags;
LONG _cReferences;
-
-#ifdef _MSC_VER
- // disable compiler warning C4200: nonstandard extension used :
- // zero-sized array in struct/union
-#pragma warning(disable: 4200)
- BYTE _ab[0];
-#pragma warning(default: 4200)
-#else
-# ifdef __GNUC__
- BYTE _ab[0];
-# else
- // FIXME: brain damage
- BYTE* _ab;
-# endif
-#endif
};
@@ -234,7 +219,7 @@
//----------------------------------------------------------------------------
-inline void * CMSFPage::GetData(void) const
+inline BYTE * CMSFPage::GetData(void) const
{
- return (void *) _ab;
+ return ((BYTE *)this) + sizeof(CMSFPage);
}
--- oless/h/dir.hxx Wed Apr 23 22:20:35 2003
+++ oless/h/dir.hxx Fri Apr 25 16:39:34 2003
@@ -167,18 +167,13 @@
private:
-#ifdef _MSC_VER
-#pragma warning(disable: 4200)
- CDirEntry _adeEntry[];
-#pragma warning(default: 4200)
-#else
-# ifdef __GNUC__
- CDirEntry _adeEntry[0];
-# else
- // FIXME: braindamage
- CDirEntry* _adeEntry;
-# endif
-#endif
-
+ // GetEntries() relies on the fact, there are no data
+ // fields in the class...
+ inline CDirEntry* GetEntries(void) const;
};
+
+inline CDirEntry * CDirSect::GetEntries(void) const
+{
+ return (CDirEntry *)this;
+}
//+-------------------------------------------------------------------------
--- oless/h/fat.hxx Sat Dec 23 17:37:48 2000
+++ oless/h/fat.hxx Fri Apr 25 16:35:20 2003
@@ -51,23 +51,18 @@
inline void ByteSwap(USHORT cbSector);
-private:
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4200)
- SECT _asectEntry[];
-#pragma warning(default: 4200)
-#else
-# ifdef __GNUC__
- SECT _asectEntry[0];
-# else
-// FIXME: brain damage
- SECT* _asectEntry;
-# endif
-#endif
+private:
+ // GetSects() relies on the fact, that the class has no
+ // data fields...
+ inline SECT * GetSects(void) const;
};
+inline SECT * CFatSect::GetSects(void) const
+{
+ return (SECT *)this;
+}
+
inline SECT CFatSect::GetSect(const FSOFFSET sect) const
{
- return _asectEntry[sect];
+ return GetSects()[sect];
}
@@ -75,15 +70,15 @@
const SECT sectNew)
{
- _asectEntry[sect] = sectNew;
+ GetSects()[sect] = sectNew;
}
inline SECT CFatSect::GetNextFat(USHORT uSize) const
{
- return _asectEntry[uSize];
+ return GetSects()[uSize];
}
inline void CFatSect::SetNextFat(USHORT uSize, const SECT sect)
{
- _asectEntry[uSize] = sect;
+ GetSects()[uSize] = sect;
}
@@ -92,5 +87,5 @@
// swap all sectors in the sector
for (FSOFFSET i=0; i < cbSector; i++)
- ::ByteSwap(&(_asectEntry[i]));
+ ::ByteSwap(GetSects() + i);
}
--- oless/h/dirfunc.hxx Sat Dec 23 17:37:48 2000
+++ oless/h/dirfunc.hxx Fri Apr 25 13:55:34 2003
@@ -168,5 +168,5 @@
inline CDirEntry* CDirSect::GetEntry(DIROFFSET iEntry)
{
- return &(_adeEntry[iEntry]);
+ return GetEntries() + iEntry;
}
@@ -207,5 +207,5 @@
{
for (unsigned int i=0; i< (cbSector/sizeof(CDirEntry)); i++)
- _adeEntry[i].ByteSwap();
+ GetEntries()[i].ByteSwap();
}
--- oless/fat.cxx Thu Nov 14 18:45:51 2002
+++ oless/fat.cxx Fri Apr 25 13:43:19 2003
@@ -38,5 +38,5 @@
//This assumes that FREESECT is always 0xFFFFFFFF
- memset(_asectEntry, 0xFF, uEntries * sizeof(SECT));
+ memset(GetSects(), 0xFF, uEntries * sizeof(SECT));
msfDebugOut((DEB_FAT,"Out CFatSect constructor\n"));
@@ -68,5 +68,5 @@
msfDebugOut((DEB_FAT,"Sector size is %u sectors\n",uSize));
- memcpy(_asectEntry,fsOld._asectEntry,sizeof(SECT)*uSize);
+ memcpy(GetSects(),fsOld.GetSects(),sizeof(SECT)*uSize);
msfDebugOut((DEB_FAT,"Out CFatSect copy constructor\n"));
return S_OK;
--- oless/dir.cxx Thu Nov 14 18:45:51 2002
+++ oless/dir.cxx Fri Apr 25 13:53:12 2003
@@ -152,5 +152,5 @@
for (ULONG i = 0; i < cdeEntries; i++)
{
- _adeEntry[i].Init(STGTY_INVALID);
+ GetEntries()[i].Init(STGTY_INVALID);
}
--- oless/page.cxx Thu Nov 14 18:45:51 2002
+++ oless/page.cxx Fri Apr 25 12:53:03 2003
@@ -39,5 +39,5 @@
{
case SIDDIR:
- ((CDirSect *)_ab)->
+ ((CDirSect *)GetData())->
ByteSwap( ((CDirVector*)pVect)->GetSectorSize() );
break;
@@ -45,5 +45,5 @@
case SIDMINIFAT:
case SIDDIF:
- ((CFatSect *)_ab)->
+ ((CFatSect *)GetData())->
ByteSwap( ((CFatVector*)pVect)->GetSectBlock() );
break;