[Scribus] Bugfix non standard integer types - incoming patch
Michael Schloh von Bennewitz
michael.schloh
Wed Aug 20 13:15:45 CEST 2003
The most current version of Scribus 1.0.1 fails to compile on systems like
Solaris 8/9 with headers compliant to the ISO C standard. I've written a
patch to fix this, and still allow Scribus to build on non-compliant systems
like Linux. The patch is not perfect, because there may be some systems in
which inttypes.h and types.h conflict. I assume these cases are very few.
Apply the patch by changing to the directory 'scribus-1.0.1' and typing
'patch -p1 <nameofpatchfile'.
Regards,
Michael
diff -Naur scribus-1.0.1.orig/scribus/md5.h scribus-1.0.1/scribus/md5.h
--- scribus-1.0.1.orig/scribus/md5.h Sun Mar 2 13:42:30 2003
+++ scribus-1.0.1/scribus/md5.h Wed Aug 20 13:09:02 2003
@@ -40,7 +40,7 @@
#ifdef _LIBC
# include <sys/types.h>
-typedef u_int32_t md5_uint32;
+typedef uint32_t md5_uint32;
#else
# if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
diff -Naur scribus-1.0.1.orig/scribus/scfonts_ttf.cpp scribus-1.0.1/scribus/scfonts_ttf.cpp
--- scribus-1.0.1.orig/scribus/scfonts_ttf.cpp Tue Jul 1 21:45:14 2003
+++ scribus-1.0.1/scribus/scfonts_ttf.cpp Wed Aug 20 13:08:59 2003
@@ -22,7 +22,7 @@
#endif
// #define doPost
-QString showTag(u_int32_t tag)
+QString showTag(uint32_t tag)
{
char tmp[5];
tmp[0]=(tag>>24) & 255;
@@ -80,8 +80,8 @@
SCFonts_Encoding OwnEncoding;
SCFonts_Encoding PostEncoding;
sc_TTFontError error;
- u_int16_t readBEUInt16();
- u_int32_t readBEUInt32();
+ uint16_t readBEUInt16();
+ uint32_t readBEUInt32();
bool readHeaders();
bool readOffsetTable();
@@ -120,7 +120,7 @@
bool GlyphNamesRead;
#endif
- QArray<u_int32_t> Loca;
+ QArray<uint32_t> Loca;
bool LocaRead;
QArray<tt_longHorMetric> Hmtx;
@@ -254,9 +254,9 @@
}
-u_int16_t sc_TTFont::readBEUInt16()
+uint16_t sc_TTFont::readBEUInt16()
{
- u_int16_t result=0;
+ uint16_t result=0;
unsigned char tmp[2];
char *t=reinterpret_cast<char *>(tmp);
if(file.readBlock(t,2)==2)
@@ -267,9 +267,9 @@
}
-u_int32_t sc_TTFont::readBEUInt32()
+uint32_t sc_TTFont::readBEUInt32()
{
- u_int32_t result=0;
+ uint32_t result=0;
unsigned char tmp[4];
char *t=reinterpret_cast<char *>(tmp);
if(file.readBlock(t,4)==4)
@@ -456,7 +456,7 @@
return(true);
struct {
fxp16_16_t version;
- u_int16_t nglyphs;
+ uint16_t nglyphs;
} data;
file.at(entries[o_maxp].offset);
@@ -561,7 +561,7 @@
error=sc_TTFBadFile;
return(false);
}
- u_int16_t nglyphsps = readBEUInt16();
+ uint16_t nglyphsps = readBEUInt16();
if(nglyphsps!=nGlyphs)
std::cout << "Warning: nGlyphs should be consistent between head and post" << endl;
@@ -765,9 +765,9 @@
#if 0 // Need to implement Mac encoding sometime...
struct CmapFormat0
{
- u_int16_t format;
- u_int16_t length;
- u_int16_t language;
+ uint16_t format;
+ uint16_t length;
+ uint16_t language;
char glyphIdArray[256];
};
#endif
@@ -794,7 +794,7 @@
}
int segCount=tcm.segCountX2/2;
- u_int16_t *data=new u_int16_t[segCount*4];
+ uint16_t *data=new uint16_t[segCount*4];
if(!(data))
{
@@ -831,7 +831,7 @@
int idarraylength=(tcm.length-(16+8*segCount))/2;
- u_int16_t *idarray = new u_int16_t[idarraylength];
+ uint16_t *idarray = new uint16_t[idarraylength];
for(int i=0;i<idarraylength;++i)
idarray[i]=readBEUInt16();
if(error)
diff -Naur scribus-1.0.1.orig/scribus/scfonts_ttftypes.h scribus-1.0.1/scribus/scfonts_ttftypes.h
--- scribus-1.0.1.orig/scribus/scfonts_ttftypes.h Mon May 19 20:26:31 2003
+++ scribus-1.0.1/scribus/scfonts_ttftypes.h Wed Aug 20 13:11:34 2003
@@ -7,6 +7,11 @@
typedef unsigned int u_int32_t;
#endif
+#include "config.h"
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
#include <sys/types.h>
#ifndef MAKE_ID
@@ -16,7 +21,7 @@
struct fxp16_16_t
{
int16_t mantissa;
- u_int16_t fraction;
+ uint16_t fraction;
};
struct tt_datetime_t
@@ -24,25 +29,25 @@
char data[8];
};
-typedef u_int16_t fxp14_2_t;
+typedef uint16_t fxp14_2_t;
struct OffsetTable
{
fxp16_16_t version;
- u_int16_t numTables;
- u_int16_t searchRange;
- u_int16_t entrySelector;
- u_int16_t rangeShift;
+ uint16_t numTables;
+ uint16_t searchRange;
+ uint16_t entrySelector;
+ uint16_t rangeShift;
}; // 12 bytes
struct TableDirEntry
{
- u_int32_t tag;
- u_int32_t checkSum;
- u_int32_t offset;
- u_int32_t length;
+ uint32_t tag;
+ uint32_t checkSum;
+ uint32_t offset;
+ uint32_t length;
}; // 16 bytes
@@ -50,19 +55,19 @@
{
fxp16_16_t version;
fxp16_16_t fontRevision;
- u_int32_t checkSumAdjustment;
- u_int32_t magicNumber;
- u_int16_t flags;
- u_int16_t unitsPerEm;
+ uint32_t checkSumAdjustment;
+ uint32_t magicNumber;
+ uint16_t flags;
+ uint16_t unitsPerEm;
tt_datetime_t created;
tt_datetime_t modified;
int16_t xMin;
int16_t yMin;
int16_t xMax;
int16_t yMax;
- u_int16_t macStyle;
- u_int16_t lowestRecPPEM;
- u_int16_t fontDirectionHint;
+ uint16_t macStyle;
+ uint16_t lowestRecPPEM;
+ uint16_t fontDirectionHint;
int16_t indexToLocFormat;
int16_t glyphDataFormat;
};
@@ -71,12 +76,12 @@
struct NameRecord
{
- u_int16_t platformID;
- u_int16_t encodingID;
- u_int16_t languageID;
- u_int16_t nameID;
- u_int16_t length;
- u_int16_t offset;
+ uint16_t platformID;
+ uint16_t encodingID;
+ uint16_t languageID;
+ uint16_t nameID;
+ uint16_t length;
+ uint16_t offset;
};
/*------------------------------------------------------------*/
@@ -89,9 +94,9 @@
int16_t underlineThickness;
int32_t isFixedPitch;
int32_t minMemType42;
- u_int32_t maxMemType42;
- u_int32_t minMemType1;
- u_int32_t maxMemType1;
+ uint32_t maxMemType42;
+ uint32_t minMemType1;
+ uint32_t maxMemType1;
};
struct Post_GlyphName
@@ -107,40 +112,40 @@
struct CmapTable
{
- u_int16_t version;
- u_int16_t numTables;
+ uint16_t version;
+ uint16_t numTables;
};
struct CmapHeader
{
- u_int16_t platformID;
- u_int16_t encodingID;
- u_int32_t offset;
+ uint16_t platformID;
+ uint16_t encodingID;
+ uint32_t offset;
};
struct CmapFormat0
{
- u_int16_t format;
- u_int16_t length;
- u_int16_t language;
+ uint16_t format;
+ uint16_t length;
+ uint16_t language;
char glyphIdArray[256];
};
struct CmapFormat4
{
- u_int16_t format;
- u_int16_t length;
- u_int16_t language;
- u_int16_t segCountX2;
- u_int16_t searchRange;
- u_int16_t entrySelector;
- u_int16_t rangeShift;
- u_int16_t *endCount;
- u_int16_t reservedPad;
- u_int16_t *startCount;
- u_int16_t *idDelta;
- u_int16_t *idRangeOffset;
- u_int16_t *glyphIdArray;
+ uint16_t format;
+ uint16_t length;
+ uint16_t language;
+ uint16_t segCountX2;
+ uint16_t searchRange;
+ uint16_t entrySelector;
+ uint16_t rangeShift;
+ uint16_t *endCount;
+ uint16_t reservedPad;
+ uint16_t *startCount;
+ uint16_t *idDelta;
+ uint16_t *idRangeOffset;
+ uint16_t *glyphIdArray;
};
/*-----------------------------------------------------------------*/
@@ -151,7 +156,7 @@
int16_t Ascender;
int16_t Descender;
int16_t LineGap;
- u_int16_t advanceWidthMax;
+ uint16_t advanceWidthMax;
int16_t minLeftSideBearing;
int16_t minRightSideBearing;
int16_t xMaxExtent;
@@ -159,7 +164,7 @@
int16_t caretSlopeRun;
int16_t reserved[5];
int16_t metricDataFormat;
- u_int16_t numberOfHMetrics;
+ uint16_t numberOfHMetrics;
};
struct tt_Box
@@ -172,7 +177,7 @@
struct tt_longHorMetric
{
- u_int16_t advanceWidth;
+ uint16_t advanceWidth;
int16_t lsb;
};
@@ -180,15 +185,15 @@
struct KernTable
{
- u_int16_t version;
- u_int16_t nTables;
+ uint16_t version;
+ uint16_t nTables;
};
struct KernSubTableHeader
{
- u_int16_t version;
- u_int16_t length;
- u_int16_t coverage;
+ uint16_t version;
+ uint16_t length;
+ uint16_t coverage;
};
#define kernHorizontal 0x0001
@@ -199,16 +204,16 @@
struct KernSubTable
{
- u_int16_t nPairs;
- u_int16_t searchRange;
- u_int16_t entrySelector;
- u_int16_t rangeShift;
+ uint16_t nPairs;
+ uint16_t searchRange;
+ uint16_t entrySelector;
+ uint16_t rangeShift;
};
struct KernEntry
{
- u_int16_t left;
- u_int16_t right;
+ uint16_t left;
+ uint16_t right;
int16_t value;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 467 bytes
Desc: not available
Url : http://nashi.altmuehlnet.de/pipermail/scribus/attachments/20030820/d597b722/attachment.pgp
More information about the scribus
mailing list