summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2203cf4)
raw | patch | inline | side by side (parent: 2203cf4)
author | keescook <keescook@users.sourceforge.net> | |
Tue, 20 Mar 2007 17:16:36 +0000 (17:16 +0000) | ||
committer | keescook <keescook@users.sourceforge.net> | |
Tue, 20 Mar 2007 17:16:36 +0000 (17:16 +0000) |
37 files changed:
diff --git a/configure.ac b/configure.ac
index 121b251f3e75e83f94e58849f51341105dfa2a1c..346c1d35b2a7827c9040362f02dd463120ed2555 100644 (file)
--- a/configure.ac
+++ b/configure.ac
CFLAGS="-Wno-pointer-sign $CFLAGS"
AC_COMPILE_IFELSE([int dummy;
], , CFLAGS="$ink_svd_CFLAGS",)
- CFLAGS="-Wall -W $CFLAGS"
+ CFLAGS="-Wall -Wformat-security -W -D_FORTIFY_SOURCE=2 $CFLAGS"
fi
dnl Honor aclocal flags
# programmer deliberately has an unused parameter (e.g. because it's used
# as a callback or similar function pointer use).
- CXXFLAGS="-Wall -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch $CXXFLAGS"
+ CXXFLAGS="-Wall -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch -D_FORTIFY_SOURCE=2 $CXXFLAGS"
dnl Test for arch-specific situations.
case "$host_cpu" in
diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp
index fc83e89df006878579182213364194d9f0f34534..f425edd47a5152c4d148a686075de7ccace01646 100644 (file)
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
}
}
if (!iter->name) {
- g_warning("Unknown debugging category %*s", end - start, start);
+ g_warning("Unknown debugging category %*s", (int)(end - start), start);
}
}
if (*end) {
diff --git a/src/dom/cssparser.h b/src/dom/cssparser.h
index 0b399f7d59fe37ad993f2e5952053b05f7449d7b..816936dc38914d8d3336a6d6a8b46fb44508f250 100644 (file)
--- a/src/dom/cssparser.h
+++ b/src/dom/cssparser.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "dom.h"
/**
*
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Get the character at the given location in the buffer.
diff --git a/src/dom/jsdombind.h b/src/dom/jsdombind.h
index f995a1f535f7248c4b2b7f0f279be6c4376a12a2..33a71816a03359d29f8aa6c0a623cfb75a2d659b 100644 (file)
--- a/src/dom/jsdombind.h
+++ b/src/dom/jsdombind.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "jsengine.h"
/**
* Ouput a printf-formatted error message
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Ouput a printf-formatted error message
*/
- void trace(char *fmt, ...);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
JSRuntime *rt;
diff --git a/src/dom/jsengine.h b/src/dom/jsengine.h
index abcbb23e91457bd29d36b3db6d00d1ac672b9731..f47a7a4c7d1fe8661db28d56d482584957ceafb2 100644 (file)
--- a/src/dom/jsengine.h
+++ b/src/dom/jsengine.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "dom.h"
#include "js/jsapi.h"
/**
* Ouput a printf-formatted error message
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Ouput a printf-formatted error message
*/
- void trace(char *fmt, ...);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
JSRuntime *rt;
diff --git a/src/dom/lsimpl.h b/src/dom/lsimpl.h
index 0f0088684d4828de8b774c54668a6f929339ad5c..d73998e133bcea41d081862c68670085a6a6d131 100644 (file)
--- a/src/dom/lsimpl.h
+++ b/src/dom/lsimpl.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
+
#include "domimpl.h"
#include "events.h"
#include "traversal.h"
void spaces();
- void po(char *fmt, ...);
+ void po(char *fmt, ...) G_GNUC_PRINTF(2,3);
void pos(const DOMString &str);
diff --git a/src/dom/minidom.h b/src/dom/minidom.h
index b1ad82f0759fd420c2560e5455171910691a7404..41af805fbeed8460b1d8f77844a7f829d011897a 100644 (file)
--- a/src/dom/minidom.h
+++ b/src/dom/minidom.h
+#include <glib.h>
+
#include <string>
#include <vector>
void getLineAndColumn(int pos, int *lineNr, int *colNr);
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
int peek(int pos);
index 9305a553a24b61119f5635d6c7dc05e6485d1e66..307b44e01a8a3bd99b8fab75965716a1e248a2e9 100644 (file)
--- a/src/dom/svg/svgparser.h
+++ b/src/dom/svg/svgparser.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "svgimpl.h"
/**
*
*/
- void error(char *format, ...);
+ void error(char *format, ...) G_GNUC_PRINTF(2,3);
diff --git a/src/dom/uri.h b/src/dom/uri.h
index 8bc7df6dac09e74e53374ec8280eaf979931f973..8b95686b8c6d3d681737439eff4e6ce8a80ec04b 100644 (file)
--- a/src/dom/uri.h
+++ b/src/dom/uri.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "dom.h"
DOMString fragment;
- void error(const char *fmt, ...);
+ void error(const char *fmt, ...) G_GNUC_PRINTF(2,3);
- void trace(const char *fmt, ...);
+ void trace(const char *fmt, ...) G_GNUC_PRINTF(2,3);
int peek(int p);
diff --git a/src/dom/util/ziptool.h b/src/dom/util/ziptool.h
index 895f0ccb2c2857d472af1d46a803a02fdce33dd3..120fe568a62d0023dd3f3954ffeab9270927e551 100644 (file)
--- a/src/dom/util/ziptool.h
+++ b/src/dom/util/ziptool.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include <vector>
#include <string>
std::string fileName;
//debug messages
- void error(char *fmt, ...);
- void trace(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
unsigned long crc;
private:
//debug messages
- void error(char *fmt, ...);
- void trace(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
//# Private writing methods
diff --git a/src/dom/xmlreader.cpp b/src/dom/xmlreader.cpp
index 5e8184e4d243dd98b92b3f7243166d0c8e646b44..6e6db723dbe22a39b63369a49f78bc0996f357e3 100644 (file)
--- a/src/dom/xmlreader.cpp
+++ b/src/dom/xmlreader.cpp
closeTagQualifiedName);
if (openTagQualifiedName != closeTagQualifiedName)
{
- error("Mismatched closing tag. Expected </%S>. Got '%S'.",
+ error("Mismatched closing tag. Expected </%s>. Got '%s'.",
openTagQualifiedName.c_str(), closeTagQualifiedName.c_str());
return p0;
}
diff --git a/src/dom/xmlreader.h b/src/dom/xmlreader.h
index 1060555c738d0d92ae249fe9e379be8f227dcd67..f616fd1e12c8712e22262e7538252c255f54afde 100644 (file)
--- a/src/dom/xmlreader.h
+++ b/src/dom/xmlreader.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
#include "dom.h"
protected:
- void error(char *format, ...);
+ void error(char *format, ...) G_GNUC_PRINTF(2,3);
int get(int ch);
int peek(int ch);
diff --git a/src/dom/xmlwriter.h b/src/dom/xmlwriter.h
index bd8501019f7c94f18fce67f3d5f6dc6988caea3e..925dacd51172b47e073a58237c9328bf82b43bcf 100644 (file)
--- a/src/dom/xmlwriter.h
+++ b/src/dom/xmlwriter.h
#include "dom.h"
#include <stdio.h>
+#include <glib.h>
namespace org
void spaces();
- void po(char *str, ...);
+ void po(char *str, ...) G_GNUC_PRINTF(2,3);
void pos(const DOMString &str);
diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h
index ce565622807996d4e48f7033ea09520e2ef1402b..7a5b7cb55c3076894b58614b9b25f763f182c9f4 100644 (file)
--- a/src/dom/xpathparser.h
+++ b/src/dom/xpathparser.h
#include <stdio.h>
#include <stdarg.h>
+#include <glib.h>
#include <string>
#include <vector>
/**
*
*/
- void trace(const char *fmt, ...);
+ void trace(const char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
*
/**
*
*/
- void error(const char *fmt, ...);
+ void error(const char *fmt, ...) G_GNUC_PRINTF(2,3);
//#################################
//# LEXICAL SCANNING
index 54d49a79a35e546daa656a3e49c6d7ec7e3fa180..7318fa78457873bbcaa21388f5cbeb33c333ab6d 100644 (file)
{
va_list args;
va_start(args, fmt);
- g_vsnprintf(fmtbuf, 4096, fmt, args);
+ gchar * output = g_strdup_vprintf(fmt, args);
va_end(args);
- outbuf.append(fmtbuf);
+ outbuf.append(output);
+ g_free(output);
}
index 951921313e639e28ca3b47ebda0800c4876dd596..28f630f776611ed172ccb23c20c5d27aea6a04b0 100644 (file)
/**
* Format text to our output buffer
*/
- void out(char *fmt, ...);
+ void out(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Output a 2d vector
//For formatted output
String outbuf;
- char fmtbuf[2048];
//For statistics
int nrNodes;
index 9a097bd6e6cf37c2b0dba185e9ec5c83f371b8f3..5d7b38c335192a37d9107c15940331f58d2fe4ef 100644 (file)
GnomeVFSResult result = gnome_vfs_open (&handle, uri_local, GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK) {
- g_warning(gnome_vfs_result_to_string(result));
+ g_warning("%s", gnome_vfs_result_to_string(result));
}
std::vector<gchar> doc;
diff --git a/src/file.cpp b/src/file.cpp
index ba68b171d98fba0c1b70eb360c0a35a6bbbce916..c5347a66e5f2eecae8b35dcdb5e9f12e6b459de3 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
}
tmp += "]";
- g_message(tmp.c_str());
+ g_message("%s", tmp.c_str());
}
void dump_ustr(Glib::ustring const &ustr)
tmp += " ";
}
- g_message( tmp.c_str() );
+ g_message( "%s", tmp.c_str() );
}
} catch (...) {
g_message("XXXXXXXXXXXXXXXXXX Exception" );
diff --git a/src/interface.cpp b/src/interface.cpp
index dad1146c04d5ec94abd94e184bceff13c0c2bd1b..c7608f53a6c65f3e53d21cb3e2a77ddf0054dc7a 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
gchar *safeMsg = Inkscape::IO::sanitizeString(message);
dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE, safeMsg);
+ GTK_BUTTONS_CLOSE, "%s", safeMsg);
sp_transientize(dlg);
gtk_window_set_resizable(GTK_WINDOW(dlg), FALSE);
gtk_dialog_run(GTK_DIALOG(dlg));
index ad213dad95234b72dbd876356c677fc6d0f5f628..9c624af8f222696322d2aff3d608a0fdce49f643 100644 (file)
--- a/src/io/inkscapestream.h
+++ b/src/io/inkscapestream.h
virtual void put(gunichar ch) = 0;
/* Formatted output */
- virtual Writer& printf(char *fmt, ...) = 0;
+ virtual Writer& printf(char *fmt, ...) G_GNUC_PRINTF(2,3) = 0;
virtual Writer& writeChar(char val) = 0;
/* Formatted output */
- virtual Writer &printf(char *fmt, ...);
+ virtual Writer &printf(char *fmt, ...) G_GNUC_PRINTF(2,3);
virtual Writer& writeChar(char val);
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index 0bb0783f0027188a1db6e8857ec4b45fcaddd088..9f3d8ce4293dac6fb59862965dec2df0ad85de0a 100644 (file)
Vars::WHITEBOARD_MESSAGE, this->sessionType, this->sm->getClient().getJid(),
destJid, Vars::INKBOARD_XMLNS, this->getSessionId(), mes).c_str());
- if (!this->sm->getClient().write(finalmessage))
+ if (!this->sm->getClient().write("%s",finalmessage))
{ return false; }
else
{ return true; }
index f66e0981ca65a45102841eeaa56e482f3241abe9..81866d8ce6a5532c0a2c5f0481e43b0ee59171d8 100644 (file)
{
va_list args;
va_start(args, fmt);
- vsnprintf(writeBuf, writeBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- Gtk::MessageDialog dlg(writeBuf,
+ Gtk::MessageDialog dlg(buffer,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true);
dlg.run();
+ g_free(buffer);
}
void PedroGui::status(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- vsnprintf(writeBuf, writeBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- messageList.postMessage("STATUS", writeBuf);
+ messageList.postMessage("STATUS", buffer);
+ g_free(buffer);
}
//################################
case XmppEvent::EVENT_STATUS:
{
//printf("##### STATUS: %s\n", event.getData().c_str());
- status(event.getData().c_str());
+ status("%s", event.getData().c_str());
break;
}
case XmppEvent::EVENT_ERROR:
{
//printf("##### ERROR: %s\n", event.getData().c_str());
- error(event.getData().c_str());
+ error("%s", event.getData().c_str());
padlockDisable();
break;
}
index b223d72635cd6468e9946ea4de84a8d5655fc068..d9a66a5e51b144138d8b800e5ca6c538eb1ff4ca 100644 (file)
XmppConfig config;
- virtual void error(const char *fmt, ...);
+ virtual void error(const char *fmt, ...) G_GNUC_PRINTF(2,3);
- virtual void status(const char *fmt, ...);
+ virtual void status(const char *fmt, ...) G_GNUC_PRINTF(2,3);
std::vector<ChatWindow *>chats;
std::vector<GroupChatWindow *>groupChats;
-
- static const int writeBufLen = 2048;
-
- char writeBuf[writeBufLen];
};
index 501741c375e8884a16678bf7fbbbaebdadf72c59..40df49878066be7c7085846a1182ddec5c9e2d22 100644 (file)
g_return_if_fail (a_fp && a_this);
gchar *str = cr_statement_ruleset_to_string (a_this, a_indent);
if (str) {
- fprintf (a_fp, str);
+ fprintf (a_fp, "%s", str);
g_free (str);
str = NULL;
}
@@ -2475,7 +2475,7 @@ cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
gchar *str = cr_statement_charset_to_string (a_this,
a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
gchar *str = cr_statement_at_page_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str);
+ fprintf (a_fp, "%s", str);
g_free (str) ;
str = NULL ;
}
str = cr_statement_media_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
str = cr_statement_import_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
diff --git a/src/message-context.h b/src/message-context.h
index e5ed18e8bf792e819a8a7ec882f5ee62c117a083..145a73ee553c10d0de0a06f77e81db2d5e1ed12e 100644 (file)
--- a/src/message-context.h
+++ b/src/message-context.h
#define SEEN_INKSCAPE_MESSAGE_CONTEXT_H
#include <stdarg.h>
-#include <glib/gtypes.h>
+#include <glib.h>
#include "message.h"
namespace Inkscape {
* @param type the message type
* @param format a printf-style formatting string
*/
- void setF(MessageType type, gchar const *format, ...);
+ void setF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4);
/** @brief pushes a message on the stack using printf-style formatting,
* and a stdarg argument list
* @param type the message type
* @param format a printf-style formatting string
*/
- void flashF(MessageType type, gchar const *format, ...);
+ void flashF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4);
/** @brief pushes a message onto the stack for a brief period of time
* using printf-style formatting and a stdarg argument list;
diff --git a/src/message-stack.h b/src/message-stack.h
index 058c44933749b4d85325e35b11cb600086904318..24ec2d599219527ce92309805ceab4cb4a6ac1b2 100644 (file)
--- a/src/message-stack.h
+++ b/src/message-stack.h
#define SEEN_INKSCAPE_MESSAGE_STACK_H
#include <sigc++/sigc++.h>
-#include <glib/gtypes.h>
+#include <glib.h>
#include <stdarg.h>
#include "gc-managed.h"
#include "gc-finalized.h"
*
* @return the id of the pushed message
*/
- MessageId pushF(MessageType type, gchar const *format, ...);
+ MessageId pushF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4);
/** @brief pushes a message onto the stack using printf-like formatting,
* using a stdarg argument list
*
* @return the id of the pushed message
*/
- MessageId flashF(MessageType type, gchar const *format, ...);
+ MessageId flashF(MessageType type, gchar const *format, ...) G_GNUC_PRINTF(3,4);
/** @brief temporarily pushes a message onto the stack using
* printf-like formatting, using a stdarg argument list
diff --git a/src/pedro/pedrodom.cpp b/src/pedro/pedrodom.cpp
index a15d742516c77a4e1f3cf0008319688f75ad2169..4cb176a52973f72fb3dd3b7bde320ae4bceaa7ad 100644 (file)
--- a/src/pedro/pedrodom.cpp
+++ b/src/pedro/pedrodom.cpp
p = getWord(p, closeTagName);
if (openTagName != closeTagName)
{
- error("Mismatched closing tag. Expected </%S>. Got '%S'.",
+ error("Mismatched closing tag. Expected </%s>. Got '%s'.",
openTagName.c_str(), closeTagName.c_str());
return p0;
}
diff --git a/src/pedro/pedrodom.h b/src/pedro/pedrodom.h
index 0d418ac20d6537ab724e48788898023ab8a6d124..b8078dce14fa46abb9e3d29c7dd1bfbf19a9334c 100644 (file)
--- a/src/pedro/pedrodom.h
+++ b/src/pedro/pedrodom.h
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
+
#include <string>
#include <vector>
void getLineAndColumn(long pos, long *lineNr, long *colNr);
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
int peek(long pos);
diff --git a/src/pedro/pedrogui.cpp b/src/pedro/pedrogui.cpp
index 6bdbe3422c16dbb726936f70954cbdd5cf8a0059..38c66b40771fbffc73990d3c54150eaffc55d899 100644 (file)
--- a/src/pedro/pedrogui.cpp
+++ b/src/pedro/pedrogui.cpp
{
va_list args;
va_start(args, fmt);
- vsnprintf(writeBuf, writeBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- Gtk::MessageDialog dlg(writeBuf,
+ Gtk::MessageDialog dlg(buffer,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true);
dlg.run();
+ g_free(buffer);
}
void PedroGui::status(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- vsnprintf(writeBuf, writeBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- messageList.postMessage("STATUS", writeBuf);
+ messageList.postMessage("STATUS", buffer);
+ g_free(buffer);
}
//################################
case XmppEvent::EVENT_STATUS:
{
//printf("##### STATUS: %s\n", event.getData().c_str());
- status(event.getData().c_str());
+ status("%s", event.getData().c_str());
break;
}
case XmppEvent::EVENT_ERROR:
{
//printf("##### ERROR: %s\n", event.getData().c_str());
- error(event.getData().c_str());
+ error("%s", event.getData().c_str());
padlockDisable();
break;
}
diff --git a/src/pedro/pedrogui.h b/src/pedro/pedrogui.h
index dfafc0edfd033a1c1522c898412fff3e94674d6c..4af4f1aac381a94bd5b2a64994948d8d0810ca72 100644 (file)
--- a/src/pedro/pedrogui.h
+++ b/src/pedro/pedrogui.h
XmppConfig config;
- virtual void error(const char *fmt, ...);
+ virtual void error(const char *fmt, ...) G_GNUC_PRINTF(2,3);
- virtual void status(const char *fmt, ...);
+ virtual void status(const char *fmt, ...) G_GNUC_PRINTF(2,3);
std::vector<ChatWindow *>chats;
std::vector<GroupChatWindow *>groupChats;
-
- static const int writeBufLen = 2048;
-
- char writeBuf[writeBufLen];
};
index efe51d277ff05c9573091251407a38deb8eb7e70..1dc1d7ced87af33500edbbd8f9708a2c18c1235f 100644 (file)
--- a/src/pedro/pedroxmpp.cpp
+++ b/src/pedro/pedroxmpp.cpp
{
va_list args;
va_start(args,fmt);
- vsnprintf(targetWriteBuf, targetWriteBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- fprintf(stderr, "Error:%s\n", targetWriteBuf);
+ fprintf(stderr, "Error:%s\n", buffer);
XmppEvent evt(XmppEvent::EVENT_ERROR);
- evt.setData(targetWriteBuf);
+ evt.setData(buffer);
dispatchXmppEvent(evt);
+ g_free(buffer);
}
{
va_list args;
va_start(args,fmt);
- vsnprintf(targetWriteBuf, targetWriteBufLen, fmt, args);
+ gchar * buffer = g_strdup_vprintf(fmt, args);
va_end(args) ;
- //printf("Status:%s\n", targetWriteBuf);
+ //printf("Status:%s\n", buffer);
XmppEvent evt(XmppEvent::EVENT_STATUS);
- evt.setData(targetWriteBuf);
+ evt.setData(buffer);
dispatchXmppEvent(evt);
+ g_free(buffer);
}
"IQ set does not contain a 'from' address because "
"the entity is not registered with the server");
}
- error((char *)errMsg.c_str());
+ error("%s",(char *)errMsg.c_str());
}
else if (id.find("regcancel") != id.npos)
"IQ set does not contain a 'from' address because "
"the entity is not registered with the server");
}
- error((char *)errMsg.c_str());
+ error("%s",(char *)errMsg.c_str());
}
return true;
bool XmppClient::write(char *fmt, ...)
{
+ bool rc = true;
va_list args;
va_start(args,fmt);
- vsnprintf((char *)writeBuf, writeBufLen, fmt,args);
+ gchar * buffer = g_strdup_vprintf(fmt,args);
va_end(args) ;
- status("SEND: %s", writeBuf);
- if (!sock->write((char *)writeBuf))
+ status("SEND: %s", buffer);
+ if (!sock->write(buffer))
{
error("Cannot write to socket");
- return false;
+ rc = false;
}
- return true;
+ g_free(buffer);
+ return rc;
}
{
errMsg.append("some registration information was not provided");
}
- error((char *)errMsg.c_str());
+ error("%s",(char *)errMsg.c_str());
delete elem;
return false;
}
char *fmt =
"<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' "
"mechanism='DIGEST-MD5'/>\n";
- if (!write(fmt))
+ if (!write("%s",fmt))
return false;
DOMString recbuf = readStanza();
fmt =
"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>\n";
- if (!write(fmt))
+ if (!write("%s",fmt))
return false;
recbuf = readStanza();
delete elem;
char *fmt =
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>\n";
- if (!write(fmt))
+ if (!write("%s",fmt))
return false;
recbuf = readStanza();
status("RECV: '%s'\n", recbuf.c_str());
DOMString givenJid, givenResource;
parseJid(givenFullJid, givenJid, givenResource);
status("given user: %s realm: %s, rsrc: %s",
- givenJid.c_str(), givenResource.c_str());
+ givenJid.c_str(), realm.c_str(), givenResource.c_str());
setResource(givenResource);
}
fmt =
"<presence/>\n";
- if (!write(fmt))
+ if (!write("%s",fmt))
return false;
/*
{
char *fmt =
"<presence type='unavailable'/>\n";
- write(fmt);
+ write("%s",fmt);
}
keepGoing = false;
connected = false;
diff --git a/src/pedro/pedroxmpp.h b/src/pedro/pedroxmpp.h
index 1ad849b9903e517dccd03718ce7a8207b848a0b2..554cb76c666ae16a2b23a3b6e4bfe7997233f7f6 100644 (file)
--- a/src/pedro/pedroxmpp.h
+++ b/src/pedro/pedroxmpp.h
*/
#include <stdio.h>
+#include <glib.h>
#include <vector>
#include <map>
/**
* Send an error message to all subscribers
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Send a status message to all subscribers
*/
- void status(char *fmt, ...);
+ void status(char *fmt, ...) G_GNUC_PRINTF(2,3);
//###########################
//# LISTENERS
std::vector<XmppEvent> eventQueue;
bool eventQueueEnabled;
-
- static const int targetWriteBufLen = 2048;
-
- char targetWriteBuf[targetWriteBufLen];
};
/**
*
*/
- virtual bool write(char *fmt, ...);
+ virtual bool write(char *fmt, ...) G_GNUC_PRINTF(2,3);
//#######################
//# V A R I A B L E S
bool doRegister;
- static const int writeBufLen = 2048;
-
- unsigned char writeBuf[writeBufLen];
-
std::vector<XmppGroupChat *>groupChats;
//#### Roster
diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp
index f06f943e054c22b4f34e76d04fe59a7bf3fb2a6b..c69af04a165c85266a3897e98cdd8576018dac8e 100644 (file)
--- a/src/trace/siox.cpp
+++ b/src/trace/siox.cpp
return workImage;
}
- trace("knownBg:%d knownFg:%d", knownBg.size(), knownFg.size());
+ trace("knownBg:%zu knownFg:%zu", knownBg.size(), knownFg.size());
std::vector<CieLab> bgSignature ;
diff --git a/src/trace/siox.h b/src/trace/siox.h
index 8f6f90ff9887438771db1d88e87f32be08201016..5d6059d3ce84c3dabb5eccb437b491ef97130e24 100644 (file)
--- a/src/trace/siox.h
+++ b/src/trace/siox.h
/**
* Error logging
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
};
/**
* Error logging
*/
- void error(char *fmt, ...);
+ void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Trace logging
*/
- void trace(char *fmt, ...);
+ void trace(char *fmt, ...) G_GNUC_PRINTF(2,3);
/**
* Stage 1 of the color signature work. 'dims' will be either
diff --git a/src/util/format.h b/src/util/format.h
index 3066173e1aad984632efa7f5e8c570d974217a9b..80d79c28a4467b1502eaf6331587cf6b6c82534c 100644 (file)
--- a/src/util/format.h
+++ b/src/util/format.h
#define SEEN_INKSCAPE_UTIL_FORMAT_H
#include <stdarg.h>
-#include <glib/gstrfuncs.h>
+#include <glib.h>
#include "util/share.h"
namespace Inkscape {
return result;
}
+ // needed since G_GNUC_PRINTF can only be used on a declaration
+ ptr_shared<char> format(char const *format, ...) G_GNUC_PRINTF(1,2);
inline ptr_shared<char> format(char const *format, ...) {
va_list args;
index 237e4c8e9f40c5e8519049104157558ecb150e41..65afc4f2926cf7b293e9b9eff152e752e9b4104d 100644 (file)
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_YES_NO,
- text);
+ "%s", text);
gint response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
if (response == GTK_RESPONSE_YES)
diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp
index 994d73a2406df3fd565dbf34318e00df20fa83e7..8540ff9f0ebc029a2afb1867d91346d7fd008263 100644 (file)
--- a/src/xml/repr-css.cpp
+++ b/src/xml/repr-css.cpp
for ( List<AttributeRecord const> iter = css->attributeList() ;
iter ; ++iter )
{
- g_print(g_quark_to_string(iter->key));
- g_print(":\t");
- g_print(iter->value);
- g_print("\n");
+ gchar const * key = g_quark_to_string(iter->key);
+ gchar const * val = iter->value;
+ g_print("%s:\t%s\n",key,val);
}
}