Skip to content

Commit 36bdef7

Browse files
committed
Attempting to reduce compiler warnings for gcc-4.2 (which I don't
have, but Darren Dale has reported some new warnings). svn path=/trunk/matplotlib/; revision=3668
1 parent 269b4ff commit 36bdef7

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/_ttconv.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ convert_ttf_to_ps(PyObject* self, PyObject* args, PyObject* kwds) {
8383
int fonttype;
8484
std::vector<int> glyph_ids;
8585

86-
static char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL };
86+
static const char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL };
8787
if (! PyArg_ParseTupleAndKeywords
8888
(args, kwds,
89-
"sO&i|O&:convert_ttf_to_ps", kwlist,
89+
"sO&i|O&:convert_ttf_to_ps", (char **)kwlist,
9090
&filename,
9191
fileobject_to_PythonFileWriter,
9292
&output,
@@ -140,10 +140,10 @@ py_get_pdf_charprocs(PyObject* self, PyObject* args, PyObject* kwds) {
140140
std::vector<int> glyph_ids;
141141
PyObject* result;
142142

143-
static char *kwlist[] = { "filename", "glyph_ids", NULL };
143+
static const char *kwlist[] = { "filename", "glyph_ids", NULL };
144144
if (! PyArg_ParseTupleAndKeywords
145145
(args, kwds,
146-
"s|O&:convert_ttf_to_ps", kwlist,
146+
"s|O&:convert_ttf_to_ps", (char **)kwlist,
147147
&filename,
148148
pyiterable_to_vector_int,
149149
&glyph_ids))

src/ft2font.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,8 @@ FT2Font::get_sfnt_table(const Py::Tuple & args) {
13701370
std::string tagname = Py::String(args[0]);
13711371

13721372
int tag;
1373-
char *tags[] = {"head", "maxp", "OS/2", "hhea",
1374-
"vhea", "post", "pclt", NULL};
1373+
static const char *tags[] = {"head", "maxp", "OS/2", "hhea",
1374+
"vhea", "post", "pclt", NULL};
13751375

13761376
for (tag=0; tags[tag] != NULL; tag++)
13771377
if (strcmp(tagname.c_str(), tags[tag]) == 0)

ttconv/pprdrv_tt.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Fixed getFixed(BYTE *s)
107107
** is always 4 characters, though the last characters may be
108108
** padding spaces.
109109
-----------------------------------------------------------------------*/
110-
BYTE *GetTable(struct TTFONT *font, char *name)
110+
BYTE *GetTable(struct TTFONT *font, const char *name)
111111
{
112112
BYTE *ptr;
113113
ULONG x;
@@ -654,7 +654,7 @@ void sfnts_glyf_table(TTStreamWriter& stream, struct TTFONT *font, ULONG oldoffs
654654
*/
655655
void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)
656656
{
657-
char *table_names[]= /* The names of all tables */
657+
const char *table_names[]= /* The names of all tables */
658658
{ /* which it is worth while */
659659
"cvt ", /* to include in a Type 42 */
660660
"fpgm", /* PostScript font. */
@@ -828,7 +828,7 @@ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)
828828
** this array will instead convert PostScript character names
829829
** to executable proceedures.
830830
--------------------------------------------------------------*/
831-
char *Apple_CharStrings[]={
831+
const char *Apple_CharStrings[]={
832832
".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign",
833833
"dollar","percent","ampersand","quotesingle","parenleft","parenright",
834834
"asterisk","plus", "comma","hyphen","period","slash","zero","one","two",
@@ -871,7 +871,7 @@ char *Apple_CharStrings[]={
871871
** This routine is called by the one below.
872872
** It is also called from pprdrv_tt2.c
873873
*/
874-
char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex)
874+
const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex)
875875
{
876876
int GlyphIndex;
877877
static char temp[80];
@@ -1227,7 +1227,7 @@ void get_pdf_charprocs(const char *filename, std::vector<int>& glyph_ids, TTDict
12271227
i != glyph_ids.end(); ++i) {
12281228
StringStreamWriter writer;
12291229
tt_type3_charproc(writer, &font, *i);
1230-
char* name = ttfont_CharStrings_getname(&font, *i);
1230+
const char* name = ttfont_CharStrings_getname(&font, *i);
12311231
dict.add_pair(name, writer.str().c_str());
12321232
}
12331233
}

ttconv/truetype.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ struct TTFONT
5151
font_type_enum target_type; /* 42 or 3 for PS, or -3 for PDF */
5252

5353
ULONG numTables; /* number of tables present */
54-
char *PostName; /* Font's PostScript name */
55-
char *FullName; /* Font's full name */
56-
char *FamilyName; /* Font's family name */
57-
char *Style; /* Font's style string */
58-
char *Copyright; /* Font's copyright string */
59-
char *Version; /* Font's version string */
60-
char *Trademark; /* Font's trademark string */
54+
const char *PostName; /* Font's PostScript name */
55+
const char *FullName; /* Font's full name */
56+
const char *FamilyName; /* Font's family name */
57+
const char *Style; /* Font's style string */
58+
const char *Copyright; /* Font's copyright string */
59+
const char *Version; /* Font's version string */
60+
const char *Trademark; /* Font's trademark string */
6161
int llx,lly,urx,ury; /* bounding box */
6262

6363
Fixed TTVersion; /* Truetype version number from offset table */
@@ -98,7 +98,7 @@ Fixed getFixed(BYTE *p);
9898

9999
/* This is the one routine in pprdrv_tt.c that is */
100100
/* called from pprdrv_tt.c. */
101-
char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex);
101+
const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex);
102102

103103
void tt_type3_charproc(TTStreamWriter& stream, struct TTFONT *font, int charindex);
104104

0 commit comments

Comments
 (0)