From: <md...@us...> - 2007-08-09 15:14:30
|
Revision: 3694 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3694&view=rev Author: mdboom Date: 2007-08-09 08:14:28 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Remove "deprecated conversion from string constant to char*" warnings. Modified Paths: -------------- trunk/matplotlib/src/_ttconv.cpp trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/ttconv/pprdrv_tt.cpp trunk/matplotlib/ttconv/truetype.h Modified: trunk/matplotlib/src/_ttconv.cpp =================================================================== --- trunk/matplotlib/src/_ttconv.cpp 2007-08-09 15:13:50 UTC (rev 3693) +++ trunk/matplotlib/src/_ttconv.cpp 2007-08-09 15:14:28 UTC (rev 3694) @@ -39,7 +39,7 @@ virtual void write(const char* a) { if (_write_method) - if (! PyObject_CallFunction(_write_method, "s", a)) + if (! PyObject_CallFunction(_write_method, (char *)"s", a)) throw PythonExceptionOccurred(); } }; @@ -83,10 +83,12 @@ int fonttype; std::vector<int> glyph_ids; - static char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL }; + static const char *kwlist[] = { + "filename", "output", "fonttype", "glyph_ids", NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - "sO&i|O&:convert_ttf_to_ps", kwlist, + "sO&i|O&:convert_ttf_to_ps", + (char**)kwlist, &filename, fileobject_to_PythonFileWriter, &output, @@ -140,10 +142,11 @@ std::vector<int> glyph_ids; PyObject* result; - static char *kwlist[] = { "filename", "glyph_ids", NULL }; + static const char *kwlist[] = { "filename", "glyph_ids", NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - "s|O&:convert_ttf_to_ps", kwlist, + "s|O&:convert_ttf_to_ps", + (char **)kwlist, &filename, pyiterable_to_vector_int, &glyph_ids)) Modified: trunk/matplotlib/src/ft2font.cpp =================================================================== --- trunk/matplotlib/src/ft2font.cpp 2007-08-09 15:13:50 UTC (rev 3693) +++ trunk/matplotlib/src/ft2font.cpp 2007-08-09 15:14:28 UTC (rev 3694) @@ -1411,8 +1411,8 @@ std::string tagname = Py::String(args[0]); int tag; - char *tags[] = {"head", "maxp", "OS/2", "hhea", - "vhea", "post", "pclt", NULL}; + const char *tags[] = {"head", "maxp", "OS/2", "hhea", + "vhea", "post", "pclt", NULL}; for (tag=0; tags[tag] != NULL; tag++) if (strcmp(tagname.c_str(), tags[tag]) == 0) Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp =================================================================== --- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-09 15:13:50 UTC (rev 3693) +++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-09 15:14:28 UTC (rev 3694) @@ -107,7 +107,7 @@ ** is always 4 characters, though the last characters may be ** padding spaces. -----------------------------------------------------------------------*/ -BYTE *GetTable(struct TTFONT *font, char *name) +BYTE *GetTable(struct TTFONT *font, const char *name) { BYTE *ptr; ULONG x; @@ -181,10 +181,10 @@ /* Set default values to avoid future references to */ /* undefined pointers. */ font->PostName = font->FullName = - font->FamilyName = font->Version = font->Style = "unknown"; + font->FamilyName = font->Version = font->Style = (char*)"unknown"; font->Copyright = font->Trademark = (char*)NULL; - table_ptr = GetTable(font,"name"); /* pointer to table */ + table_ptr = GetTable(font, "name"); /* pointer to table */ try { numrecords = getUSHORT( table_ptr + 2 ); /* number of names */ strings = table_ptr + getUSHORT( table_ptr + 4 ); /* start of string storage */ @@ -654,10 +654,10 @@ */ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font) { - char *table_names[]= /* The names of all tables */ - { /* which it is worth while */ - "cvt ", /* to include in a Type 42 */ - "fpgm", /* PostScript font. */ + static const char *table_names[] = /* The names of all tables */ + { /* which it is worth while */ + "cvt ", /* to include in a Type 42 */ + "fpgm", /* PostScript font. */ "glyf", "head", "hhea", @@ -828,7 +828,7 @@ ** this array will instead convert PostScript character names ** to executable proceedures. --------------------------------------------------------------*/ -char *Apple_CharStrings[]={ +const char *Apple_CharStrings[]={ ".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign", "dollar","percent","ampersand","quotesingle","parenleft","parenright", "asterisk","plus", "comma","hyphen","period","slash","zero","one","two", @@ -871,7 +871,7 @@ ** This routine is called by the one below. ** It is also called from pprdrv_tt2.c */ -char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) +const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) { int GlyphIndex; static char temp[80]; @@ -1227,7 +1227,7 @@ i != glyph_ids.end(); ++i) { StringStreamWriter writer; tt_type3_charproc(writer, &font, *i); - char* name = ttfont_CharStrings_getname(&font, *i); + const char* name = ttfont_CharStrings_getname(&font, *i); dict.add_pair(name, writer.str().c_str()); } } Modified: trunk/matplotlib/ttconv/truetype.h =================================================================== --- trunk/matplotlib/ttconv/truetype.h 2007-08-09 15:13:50 UTC (rev 3693) +++ trunk/matplotlib/ttconv/truetype.h 2007-08-09 15:14:28 UTC (rev 3694) @@ -98,7 +98,7 @@ /* This is the one routine in pprdrv_tt.c that is */ /* called from pprdrv_tt.c. */ -char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex); +const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex); void tt_type3_charproc(TTStreamWriter& stream, struct TTFONT *font, int charindex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |