[gnote] Add -Wformat-security to compilation flags



commit 1a758b13d2d3945515b6cd4cad58b2f7194c0fe1
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Sun Oct 23 14:17:38 2011 +0300

    Add -Wformat-security to compilation flags
    
    Also fix resulting warnings.
    Fixes bug 662490.

 configure.ac                                       |    2 +-
 .../stickynoteimport/stickynoteimportnoteaddin.cpp |    8 ++++----
 src/dbus/remotecontrol-client-glue.cpp             |    2 +-
 src/remotecontrolproxy.cpp                         |    4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ad9c6c6..bc1fe89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ AC_ARG_ENABLE(debug,[  --enable-debug    Turn on debugging],[
 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
 
 
-CPPFLAGS="$CPPFLAGS $DEBUG_CFLAGS -Wall -Wcast-align -Wcast-qual -Wpointer-arith -Wreturn-type"
+CPPFLAGS="$CPPFLAGS $DEBUG_CFLAGS -Wall -Wcast-align -Wcast-qual -Wformat-security -Wpointer-arith -Wreturn-type"
 CFLAGS="$CFLAGS $DEBUG_CFLAGS $OPTIMIZE_CFLAGS"
 CXXFLAGS="$CXXFLAGS $DEBUG_CFLAGS $OPTIMIZE_CFLAGS"
 dnl CFLAGS=""
diff --git a/src/addins/stickynoteimport/stickynoteimportnoteaddin.cpp b/src/addins/stickynoteimport/stickynoteimportnoteaddin.cpp
index 847730f..d141091 100644
--- a/src/addins/stickynoteimport/stickynoteimportnoteaddin.cpp
+++ b/src/addins/stickynoteimport/stickynoteimportnoteaddin.cpp
@@ -117,7 +117,7 @@ void StickyNoteImportNoteAddin::initialize()
     } 
     else {
       s_sticky_file_might_exist = false;
-      DBG_OUT(DEBUG_NO_STICKY_FILE);
+      DBG_OUT("%s", DEBUG_NO_STICKY_FILE);
     }
   }
 }
@@ -159,7 +159,7 @@ bool StickyNoteImportNoteAddin::first_run(gnote::NoteManager & manager)
   if (firstRun) {
     ini_file.set_bool("status", "first_run", true);
 
-    DBG_OUT(DEBUG_FIRST_RUN_DETECTED);
+    DBG_OUT("%s", DEBUG_FIRST_RUN_DETECTED);
 
     xmlDocPtr xml_doc = get_sticky_xml_doc();
     if (xml_doc) {
@@ -180,12 +180,12 @@ xmlDocPtr StickyNoteImportNoteAddin::get_sticky_xml_doc()
   if (sharp::file_exists(s_sticky_xml_path)) {
     xmlDocPtr xml_doc = xmlReadFile(s_sticky_xml_path.c_str(), "UTF-8", 0);
     if(xml_doc == NULL) {
-      DBG_OUT(DEBUG_NO_STICKY_FILE);
+      DBG_OUT("%s", DEBUG_NO_STICKY_FILE);
     }
     return xml_doc;
   }
   else {
-    DBG_OUT(DEBUG_NO_STICKY_FILE);
+    DBG_OUT("%s", DEBUG_NO_STICKY_FILE);
     return NULL;
   }
 }
diff --git a/src/dbus/remotecontrol-client-glue.cpp b/src/dbus/remotecontrol-client-glue.cpp
index 2102730..2d7596b 100644
--- a/src/dbus/remotecontrol-client-glue.cpp
+++ b/src/dbus/remotecontrol-client-glue.cpp
@@ -133,7 +133,7 @@ Glib::VariantContainerBase RemoteControl_proxy::call_remote(const Glib::ustring
     return call_sync(method_name, parameters);
   }
   catch(...) {
-    ERR_OUT(("Remote call failed: " + method_name).c_str());
+    ERR_OUT("Remote call failed: %s", method_name.c_str());
     return Glib::VariantContainerBase();
   }
 }
diff --git a/src/remotecontrolproxy.cpp b/src/remotecontrolproxy.cpp
index ed68c7b..ebbb068 100644
--- a/src/remotecontrolproxy.cpp
+++ b/src/remotecontrolproxy.cpp
@@ -92,7 +92,7 @@ void RemoteControlProxy::on_name_acquired(const Glib::RefPtr<Gio::DBus::Connecti
     }
   }
   catch(Glib::Exception & e) {
-    DBG_OUT(("Failed to acquire name: " + e.what()).c_str());
+    DBG_OUT("Failed to acquire name: %s", e.what().c_str());
   }
 
   s_on_name_acquire_finish(false, false);
@@ -126,7 +126,7 @@ void RemoteControlProxy::load_introspection_xml()
     s_gnote_interface = node->lookup_interface(GNOTE_INTERFACE_NAME);
   }
   catch(Glib::Error & e) {
-    ERR_OUT(("Failed to load interface: " + e.what()).c_str());
+    ERR_OUT("Failed to load interface: %s", e.what().c_str());
   }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]