From 31c0d56f2ec3810c7917d23ebaba028dcee1f118 Mon Sep 17 00:00:00 2001 From: pjrm Date: Thu, 11 Oct 2007 13:46:40 +0000 Subject: [PATCH] Avoid string literal char* warnings on g++-4.2: change some functions to take char const* rather than char*. --- src/dom/io/domstream.cpp | 2 +- src/dom/svg/svgparser.cpp | 2 +- src/dom/svg/svgparser.h | 2 +- src/dom/util/ziptool.cpp | 24 ++++++++++++------------ src/dom/util/ziptool.h | 8 ++++---- src/extension/internal/odf.cpp | 8 ++++---- src/io/inkscapestream.cpp | 4 ++-- src/io/inkscapestream.h | 6 +++--- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/dom/io/domstream.cpp b/src/dom/io/domstream.cpp index c6234d462..c35a3d148 100644 --- a/src/dom/io/domstream.cpp +++ b/src/dom/io/domstream.cpp @@ -896,7 +896,7 @@ int BasicWriter::put(XMLCh ch) * Provide printf()-like formatting */ /* -Writer &BasicWriter::printf(char *fmt, ...) +Writer &BasicWriter::printf(char const *fmt, ...) { va_list args; va_start(args, fmt); diff --git a/src/dom/svg/svgparser.cpp b/src/dom/svg/svgparser.cpp index 350277f47..e263f1481 100644 --- a/src/dom/svg/svgparser.cpp +++ b/src/dom/svg/svgparser.cpp @@ -54,7 +54,7 @@ namespace svg /** * */ -void SvgParser::error(char *fmt, ...) +void SvgParser::error(char const *fmt, ...) { va_list args; fprintf(stderr, "SvgParser:error:"); diff --git a/src/dom/svg/svgparser.h b/src/dom/svg/svgparser.h index 2b7119040..bd230c4e6 100644 --- a/src/dom/svg/svgparser.h +++ b/src/dom/svg/svgparser.h @@ -122,7 +122,7 @@ private: /** * */ - void error(char *format, ...) + void error(char const *format, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp index fc4c7bad4..a51d12986 100644 --- a/src/dom/util/ziptool.cpp +++ b/src/dom/util/ziptool.cpp @@ -231,7 +231,7 @@ private: /** * */ - void error(char *fmt, ...) + void error(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif @@ -240,7 +240,7 @@ private: /** * */ - void trace(char *fmt, ...) + void trace(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif @@ -314,7 +314,7 @@ Inflater::~Inflater() /** * */ -void Inflater::error(char *fmt, ...) +void Inflater::error(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -327,7 +327,7 @@ void Inflater::error(char *fmt, ...) /** * */ -void Inflater::trace(char *fmt, ...) +void Inflater::trace(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -844,13 +844,13 @@ public: private: //debug messages - void error(char *fmt, ...) + void error(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif ; - void trace(char *fmt, ...) + void trace(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif @@ -982,7 +982,7 @@ bool Deflater::deflate(std::vector &dest, /** * Print error messages */ -void Deflater::error(char *fmt, ...) +void Deflater::error(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -995,7 +995,7 @@ void Deflater::error(char *fmt, ...) /** * Print trace messages */ -void Deflater::trace(char *fmt, ...) +void Deflater::trace(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -1427,7 +1427,7 @@ GzipFile::~GzipFile() /** * Print error messages */ -void GzipFile::error(char *fmt, ...) +void GzipFile::error(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -1440,7 +1440,7 @@ void GzipFile::error(char *fmt, ...) /** * Print trace messages */ -void GzipFile::trace(char *fmt, ...) +void GzipFile::trace(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -2172,7 +2172,7 @@ std::vector &ZipFile::getEntries() //# M E S S A G E S //##################################### -void ZipFile::error(char *fmt, ...) +void ZipFile::error(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -2182,7 +2182,7 @@ void ZipFile::error(char *fmt, ...) va_end(args); } -void ZipFile::trace(char *fmt, ...) +void ZipFile::trace(char const *fmt, ...) { va_list args; va_start(args, fmt); diff --git a/src/dom/util/ziptool.h b/src/dom/util/ziptool.h index f8cf01cc8..6cef266cf 100644 --- a/src/dom/util/ziptool.h +++ b/src/dom/util/ziptool.h @@ -203,13 +203,13 @@ private: std::string fileName; //debug messages - void error(char *fmt, ...) + void error(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif ; - void trace(char *fmt, ...) + void trace(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif @@ -478,12 +478,12 @@ public: private: //debug messages - void error(char *fmt, ...) + void error(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif ; - void trace(char *fmt, ...) + void trace(char const *fmt, ...) #ifdef G_GNUC_PRINTF G_GNUC_PRINTF(2, 3) #endif diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index e233515c9..58d19be32 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -884,12 +884,12 @@ int SingularValueDecomposition::rank() /** * Get the value of a node/attribute pair */ -static Glib::ustring getAttribute( Inkscape::XML::Node *node, char *attrName) +static Glib::ustring getAttribute( Inkscape::XML::Node *node, char const *attrName) { Glib::ustring val; - char *valstr = (char *)node->attribute(attrName); + char const *valstr = node->attribute(attrName); if (valstr) - val = (const char *)valstr; + val = valstr; return val; } @@ -1175,7 +1175,7 @@ bool OdfOutput::writeManifest(ZipFile &zf) else if (ext == ".jpg") outs.printf("image/jpeg"); outs.printf("\" manifest:full-path=\""); - outs.printf((char *)newName.c_str()); + outs.printf(newName.c_str()); outs.printf("\"/>\n"); } outs.printf("\n"); diff --git a/src/io/inkscapestream.cpp b/src/io/inkscapestream.cpp index e527101f6..c89dd70fc 100644 --- a/src/io/inkscapestream.cpp +++ b/src/io/inkscapestream.cpp @@ -509,7 +509,7 @@ void BasicWriter::put(gunichar ch) /** * Provide printf()-like formatting */ -Writer &BasicWriter::printf(char *fmt, ...) +Writer &BasicWriter::printf(char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -708,7 +708,7 @@ Writer& operator<< (Writer &writer, Glib::ustring &val) Writer& operator<< (Writer &writer, std::string &val) { return writer.writeStdString(val); } -Writer& operator<< (Writer &writer, char *val) +Writer& operator<< (Writer &writer, char const *val) { return writer.writeString(val); } Writer& operator<< (Writer &writer, bool val) diff --git a/src/io/inkscapestream.h b/src/io/inkscapestream.h index 9c624af8f..4388a2815 100644 --- a/src/io/inkscapestream.h +++ b/src/io/inkscapestream.h @@ -475,7 +475,7 @@ public: virtual void put(gunichar ch) = 0; /* Formatted output */ - virtual Writer& printf(char *fmt, ...) G_GNUC_PRINTF(2,3) = 0; + virtual Writer& printf(char const *fmt, ...) G_GNUC_PRINTF(2,3) = 0; virtual Writer& writeChar(char val) = 0; @@ -531,7 +531,7 @@ public: /* Formatted output */ - virtual Writer &printf(char *fmt, ...) G_GNUC_PRINTF(2,3); + virtual Writer &printf(char const *fmt, ...) G_GNUC_PRINTF(2,3); virtual Writer& writeChar(char val); @@ -579,7 +579,7 @@ Writer& operator<< (Writer &writer, Glib::ustring &val); Writer& operator<< (Writer &writer, std::string &val); -Writer& operator<< (Writer &writer, char *val); +Writer& operator<< (Writer &writer, char const *val); Writer& operator<< (Writer &writer, bool val); -- 2.30.2