summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-26 09:35:42 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-26 09:35:42 +0000
commitffd094638c9d43a33f1e53720b88862aa5585625 (patch)
treee2b1ec1352812931aa0041e1c3a3913e47e02907
parente8fc09ff26847c7db60da792157fe6bcd965a5d1 (diff)
XeTeX: Enable and avoid gcc warnings for libxetex.a
git-svn-id: svn://tug.org/texlive/trunk@38210 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/Makefile.in2
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog9
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp18
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontInst.h8
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp1
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp2
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h2
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c58
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.h16
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_pic.c2
-rw-r--r--Build/source/texk/web2c/xetexdir/am/xetex.am2
11 files changed, 66 insertions, 54 deletions
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 25acec5d770..93a0f81839e 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -3623,7 +3623,7 @@ xetex_ch_srcs = \
tex-binpool.ch
libxetex_a_CPPFLAGS = $(xetex_cppflags)
-libxetex_a_CFLAGS = # $(WARNING_CFLAGS)
+libxetex_a_CFLAGS = $(WARNING_CFLAGS)
libxetex_a_CXXFLAGS = # $(WARNING_CXXFLAGS)
libxetex_a_OBJCXXFLAGS = # $(WARNING_OBJCXXFLAGS)
libxetex_a_SOURCES = xetexdir/MathTable.h xetexdir/XeTeXFontInst.cpp \
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog
index e1ddf90978d..ba1f0608824 100644
--- a/Build/source/texk/web2c/xetexdir/ChangeLog
+++ b/Build/source/texk/web2c/xetexdir/ChangeLog
@@ -1,3 +1,12 @@
+2015-08-25 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/xetex.am (libxetex_a_CFLAGS): Enable gcc warnings.
+
+ * XeTeX_ext.[ch], XeTeXFontInst{cpp,h}, XeTeXFontMgr.cpp,
+ XeTeXLayoutInterface.{cpp,h}, XeTeX_pic.c:
+ ANSI C prototypes, unconstify, drop (set but) unused variable,
+ remove useless or misleading casts.
+
2015-08-25 Akira Kakuto <kakuto@fuk.kinidai.ac.jp>
* XeTeXFontInst.cpp: Support pair kerning for native type1 fonts.
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp
index fe1c8657cd4..afdb847862d 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp
@@ -55,8 +55,8 @@ FT_Library gFreeTypeLibrary = 0;
static hb_font_funcs_t* hbFontFuncs = NULL;
XeTeXFontInst::XeTeXFontInst(const char* pathname, int index, float pointSize, int &status)
- : m_pointSize(pointSize)
- , m_unitsPerEM(0)
+ : m_unitsPerEM(0)
+ , m_pointSize(pointSize)
, m_ascent(0)
, m_descent(0)
, m_capHeight(0)
@@ -81,7 +81,7 @@ XeTeXFontInst::~XeTeXFontInst()
}
hb_font_destroy(m_hbFont);
delete[] m_filename;
- free((void*) m_math);
+ free(m_math);
}
/* HarfBuzz font functions */
@@ -301,7 +301,7 @@ XeTeXFontInst::initialize(const char* pathname, int index, int &status)
}
}
- error = FT_New_Face(gFreeTypeLibrary, (char*)pathname, index, &m_ftFace);
+ error = FT_New_Face(gFreeTypeLibrary, pathname, index, &m_ftFace);
if (error) {
status = 1;
return;
@@ -314,7 +314,7 @@ XeTeXFontInst::initialize(const char* pathname, int index, int &status)
/* for non-sfnt-packaged fonts (presumably Type 1), see if there is an AFM file we can attach */
if (index == 0 && !FT_IS_SFNT(m_ftFace)) {
- char* afm = xstrdup ((char *)xbasename (pathname));
+ char* afm = xstrdup (xbasename (pathname));
char* p = strrchr (afm, '.');
if (p != NULL && strlen(p) == 4 && tolower(*(p+1)) == 'p' &&
tolower(*(p+2)) == 'f')
@@ -368,7 +368,7 @@ XeTeXFontInst::setLayoutDirVertical(bool vertical)
m_vertical = vertical;
}
-const void *
+void *
XeTeXFontInst::getFontTable(OTTag tag) const
{
FT_ULong tmpLength = 0;
@@ -388,15 +388,15 @@ XeTeXFontInst::getFontTable(OTTag tag) const
return table;
}
-const char *
+char *
XeTeXFontInst::getMathTable()
{
if (m_math == NULL)
- m_math = (const char*) getFontTable(MATH_TAG);
+ m_math = (char*) getFontTable(MATH_TAG);
return m_math;
}
-const void *
+void *
XeTeXFontInst::getFontTable(FT_Sfnt_Tag tag) const
{
return FT_Get_Sfnt_Table(m_ftFace, tag);
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.h b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.h
index 82d431f433b..65e92933214 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.h
@@ -72,7 +72,7 @@ protected:
FT_Face m_ftFace;
hb_font_t* m_hbFont;
- const char *m_math;
+ char *m_math;
public:
XeTeXFontInst(float pointSize, int &status);
@@ -82,9 +82,9 @@ public:
void initialize(const char* pathname, int index, int &status);
- const void *getFontTable(OTTag tableTag) const;
- const void *getFontTable(FT_Sfnt_Tag tableTag) const;
- const char *getMathTable();
+ void *getFontTable(OTTag tableTag) const;
+ void *getFontTable(FT_Sfnt_Tag tableTag) const;
+ char *getMathTable();
const char *getFilename(uint32_t* index) const
{
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
index 28c8592addf..d8d249d4863 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp
@@ -235,7 +235,6 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize)
goto skip_to_slash;
}
if (*cp == 'S') {
- char* start = cp;
++cp;
if (*cp == '=')
++cp;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
index 90f8e15c240..4753a7064d1 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp
@@ -172,7 +172,7 @@ getDesignSize(XeTeXFont font)
return XeTeXFontMgr::GetFontManager()->getDesignSize(font);
}
-const char*
+char*
getFontFilename(XeTeXLayoutEngine engine, uint32_t* index)
{
return xstrdup(engine->font->getFilename(index));
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
index 87a743d99a6..5c510d11884 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h
@@ -74,7 +74,7 @@ char getReqEngine();
void setReqEngine(char reqEngine);
const char* getFullName(PlatformFontRef fontRef);
-const char* getFontFilename(XeTeXLayoutEngine engine, uint32_t* index);
+char* getFontFilename(XeTeXLayoutEngine engine, uint32_t* index);
double getDesignSize(XeTeXFont font);
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 4b9bc946e5a..86ab3438331 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -276,7 +276,7 @@ uclose(UFILE* f)
}
static void
-buffer_overflow()
+buffer_overflow(void)
{
fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
(unsigned) bufsize);
@@ -484,7 +484,7 @@ static UBreakIterator* brkIter = NULL;
static int brkLocaleStrNum = 0;
void
-linebreakstart(int f, integer localeStrNum, const uint16_t* text, integer textLength)
+linebreakstart(int f, integer localeStrNum, uint16_t* text, integer textLength)
{
UErrorCode status = U_ZERO_ERROR;
char* locale = (char*)gettexstring(localeStrNum);
@@ -529,7 +529,7 @@ linebreakstart(int f, integer localeStrNum, const uint16_t* text, integer textLe
}
int
-linebreaknext()
+linebreaknext(void)
{
if (brkIter != NULL)
return ubrk_next((UBreakIterator*)brkIter);
@@ -625,7 +625,7 @@ load_mapping_file(const char* s, const char* e, char byteMapping)
if (mapFile) {
uint32_t mappingSize;
Byte* mapping;
- TECkit_Status status;
+ /* TECkit_Status status; */
fseek(mapFile, 0, SEEK_END);
mappingSize = ftell(mapFile);
fseek(mapFile, 0, SEEK_SET);
@@ -633,12 +633,12 @@ load_mapping_file(const char* s, const char* e, char byteMapping)
fread(mapping, 1, mappingSize, mapFile);
fclose(mapFile);
if (byteMapping != 0)
- status = TECkit_CreateConverter(mapping, mappingSize,
+ /* status = */ TECkit_CreateConverter(mapping, mappingSize,
false,
UTF16_NATIVE, kForm_Bytes,
&cnv);
else
- status = TECkit_CreateConverter(mapping, mappingSize,
+ /* status = */ TECkit_CreateConverter(mapping, mappingSize,
true,
UTF16_NATIVE, UTF16_NATIVE,
&cnv);
@@ -659,7 +659,7 @@ load_mapping_file(const char* s, const char* e, char byteMapping)
char *saved_mapping_name = NULL;
void
-checkfortfmfontmapping()
+checkfortfmfontmapping(void)
{
char* cp = strstr((char*)nameoffile + 1, ":mapping=");
if (saved_mapping_name != NULL) {
@@ -677,7 +677,7 @@ checkfortfmfontmapping()
}
void*
-loadtfmfontmapping()
+loadtfmfontmapping(void)
{
void* rval = NULL;
if (saved_mapping_name != NULL) {
@@ -695,7 +695,8 @@ applytfmfontmapping(void* cnv, int c)
UniChar in = c;
Byte out[2];
UInt32 inUsed, outUsed;
- TECkit_Status status = TECkit_ConvertBuffer((TECkit_Converter)cnv,
+ /* TECkit_Status status; */
+ /* status = */ TECkit_ConvertBuffer((TECkit_Converter)cnv,
(const Byte*)&in, sizeof(in), &inUsed, out, sizeof(out), &outUsed, 1);
if (outUsed < 1)
return 0;
@@ -899,9 +900,9 @@ readFeatureNumber(const char* s, const char* e, hb_tag_t* f, int* v)
}
static void*
-loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const char* cp1)
+loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, char* cp1)
{
- XeTeXLayoutEngine engine;
+ XeTeXLayoutEngine engine = NULL;
hb_tag_t script = HB_TAG_NONE;
char * language = NULL;
hb_feature_t* features = NULL;
@@ -909,8 +910,8 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
int nFeatures = 0;
int nShapers = 0;
- const char* cp2;
- const char* cp3;
+ char* cp2;
+ char* cp3;
hb_tag_t tag;
@@ -927,10 +928,13 @@ loadOTfont(PlatformFontRef fontRef, XeTeXFont font, Fixed scaled_size, const cha
if (reqEngine == 'O' || reqEngine == 'G') {
shapers = (char**) xrealloc(shapers, (nShapers + 1) * sizeof(char *));
- if (reqEngine == 'O')
- shapers[nShapers] = "ot";
- else if (reqEngine == 'G')
- shapers[nShapers] = "graphite2";
+ if (reqEngine == 'O') {
+ static char ot_const[] = "ot";
+ shapers[nShapers] = ot_const;
+ } else if (reqEngine == 'G') {
+ static char graphite2_const[] = "graphite2";
+ shapers[nShapers] = graphite2_const;
+ }
nShapers++;
}
@@ -1584,12 +1588,12 @@ makefontdef(integer f)
uint16_t flags = 0;
uint32_t rgba;
Fixed size;
- const char* filename;
+ char* filename;
uint32_t index;
uint8_t filenameLen;
int fontDefLength;
char* cp;
- PlatformFontRef fontRef = 0;
+ /* PlatformFontRef fontRef = 0; */
float extend = 1.0;
float slant = 0.0;
float embolden = 0.0;
@@ -1633,7 +1637,7 @@ makefontdef(integer f)
XeTeXLayoutEngine engine;
engine = (XeTeXLayoutEngine)fontlayoutengine[f];
- fontRef = getFontRef(engine);
+ /* fontRef = */ getFontRef(engine);
filename = getFontFilename(engine, &index);
assert(filename);
@@ -1735,7 +1739,7 @@ makefontdef(integer f)
}
int
-applymapping(void* pCnv, const uint16_t* txtPtr, int txtLen)
+applymapping(void* pCnv, uint16_t* txtPtr, int txtLen)
{
TECkit_Converter cnv = (TECkit_Converter)pCnv;
UInt32 inUsed, outUsed;
@@ -1758,7 +1762,7 @@ retry:
switch (status) {
case kStatus_NoError:
- txtPtr = (const UniChar*)mappedtext;
+ txtPtr = (UniChar*)mappedtext;
return outUsed / sizeof(UniChar);
case kStatus_OutputBufferFull:
@@ -1960,9 +1964,9 @@ measure_native_node(void* pNode, int use_glyph_metrics)
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)(fontlayoutengine[f]);
- FixedPoint* locations;
+ FixedPoint* locations = NULL;
uint16_t* glyphIDs;
- Fixed* glyphAdvances;
+ Fixed* glyphAdvances = NULL;
int totalGlyphCount = 0;
/* need to find direction runs within the text, and call layoutChars separately for each */
@@ -2514,7 +2518,7 @@ aatprintfontname(int what, CFDictionaryRef attributes, int param1, int param2)
void
printglyphname(integer font, integer gid)
{
- char* s;
+ const char* s;
int len = 0;
#ifdef XETEX_MAC
if (fontarea[font] == AAT_FONT_FLAG) {
@@ -2523,7 +2527,7 @@ printglyphname(integer font, integer gid)
#endif
if (fontarea[font] == OTGR_FONT_FLAG) {
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)fontlayoutengine[font];
- s = (char*)getGlyphName(getFont(engine), gid, &len);
+ s = getGlyphName(getFont(engine), gid, &len);
} else {
fprintf(stderr, "\n! Internal error: bad native font flag in `print_glyph_name'\n");
exit(3);
@@ -2818,7 +2822,7 @@ get_uni_c(UFILE* f)
}
void
-makeutf16name()
+makeutf16name(void)
{
unsigned char* s = nameoffile + 1;
uint32_t rval;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
index a7edc2388eb..1ed54689eb7 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
@@ -197,8 +197,8 @@ extern "C" {
void setinputfileencoding(unicodefile f, integer mode, integer encodingData);
void uclose(unicodefile f);
- void linebreakstart(int f, integer localeStrNum, const uint16_t* text, integer textLength);
- int linebreaknext();
+ void linebreakstart(int f, integer localeStrNum, uint16_t* text, integer textLength);
+ int linebreaknext(void);
int getencodingmodeandinfo(integer* info);
void printutf8str(const unsigned char* str, int len);
void printchars(const unsigned short* str, int len);
@@ -225,7 +225,7 @@ extern "C" {
integer otfontget3(integer what, void* engine, integer param1, integer param2, integer param3);
int makeXDVGlyphArrayData(void* p);
int makefontdef(integer f);
- int applymapping(void* cnv, const uint16_t* txtPtr, int txtLen);
+ int applymapping(void* cnv, uint16_t* txtPtr, int txtLen);
void store_justified_native_glyphs(void* node);
void measure_native_node(void* node, int use_glyph_metrics);
Fixed get_native_italic_correction(void* node);
@@ -245,20 +245,20 @@ extern "C" {
double read_double(const char** s);
unsigned int read_rgb_a(const char** cp);
- int countpdffilepages();
+ int countpdffilepages(void);
int find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page);
int u_open_in(unicodefile* f, integer filefmt, const char* fopen_mode, integer mode, integer encodingData);
int open_dvi_output(FILE** fptr);
int dviclose(FILE* fptr);
int get_uni_c(UFILE* f);
int input_line(UFILE* f);
- void makeutf16name();
+ void makeutf16name(void);
- void terminatefontmanager();
+ void terminatefontmanager(void);
int maketexstring(const char* s);
- void checkfortfmfontmapping();
- void* loadtfmfontmapping();
+ void checkfortfmfontmapping(void);
+ void* loadtfmfontmapping(void);
int applytfmfontmapping(void* mapping, int c);
#ifndef XETEX_MAC
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_pic.c b/Build/source/texk/web2c/xetexdir/XeTeX_pic.c
index 92233654232..aa5544e3863 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_pic.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_pic.c
@@ -54,7 +54,7 @@ XeTeX_pic.c
int
-countpdffilepages()
+countpdffilepages(void)
{
int rval = 0;
diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am
index 1805e6f135c..d3a0def8320 100644
--- a/Build/source/texk/web2c/xetexdir/am/xetex.am
+++ b/Build/source/texk/web2c/xetexdir/am/xetex.am
@@ -130,7 +130,7 @@ DISTCLEANFILES += $(nodist_xetex_SOURCES) xetex.web xetex.ch xetex-web2c \
EXTRA_LIBRARIES += libxetex.a
libxetex_a_CPPFLAGS = $(xetex_cppflags)
-libxetex_a_CFLAGS = # $(WARNING_CFLAGS)
+libxetex_a_CFLAGS = $(WARNING_CFLAGS)
libxetex_a_CXXFLAGS = # $(WARNING_CXXFLAGS)
libxetex_a_OBJCXXFLAGS = # $(WARNING_OBJCXXFLAGS)