[X2Go-Commits] [x2goclient] 01/03: help.{cpp, h}: add sanitizing helpers.
git-admin at x2go.org
git-admin at x2go.org
Wed Apr 22 07:59:16 CEST 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/help-cmd
in repository x2goclient.
commit 8587ec4d1288c1f5c4c4a04c5f2fc1f1815d47d7
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Apr 22 07:51:21 2015 +0200
help.{cpp,h}: add sanitizing helpers.
---
debian/changelog | 1 +
src/help.cpp | 21 +++++++++++++++++++--
src/help.h | 4 ++++
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1002103..926543b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -259,6 +259,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low
correctly, add more quotes and use absolute file path for pulse cookie.
- version.h: add include guard.
- help.{cpp,h}: add skeleton for new help system.
+ - help.{cpp,h}: add sanitizing helpers.
[ Fernando Pedemonte ]
* New upstream release (4.0.4.0):
diff --git a/src/help.cpp b/src/help.cpp
index d42c881..74dd1c0 100644
--- a/src/help.cpp
+++ b/src/help.cpp
@@ -17,10 +17,27 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "help.h"
#include <QCoreApplication>
+#include "help.h"
#include "version.h"
+help::prelude_t help::cleanup_prelude (help::prelude_t prelude) {
+ for (help::prelude_t::iterator it = prelude.begin (); it != prelude.end (); ++it) {
+ *it = (*it).trimmed ();
+ }
+
+ return (prelude);
+}
+
+help::params_t help::cleanup_params (help::params_t params) {
+ for (help::params_t::const_iterator params_it = params.constBegin (); params_it != params.constEnd (); ++params_it) {
+ (*params_it).first = (*params_it).first.trimmed ();
+ (*params_it).second = (*params_it).second.trimmed ();
+ }
+
+ return (params);
+}
+
help::prelude_t build_prelude () {
help::prelude_t ret ();
@@ -55,7 +72,7 @@ help::params_t help::build_params () {
}
help::data_t help::build_data () {
- return (help::data_t (help::build_prelude (), help::build_params ()));
+ return (help::data_t (help::cleanup_prelude (help::build_prelude ()), help::cleanup_params (help::build_params ())));
}
help::pretty_print (help::data_t data) {
diff --git a/src/help.h b/src/help.h
index 87cd5a7..8cc26b2 100644
--- a/src/help.h
+++ b/src/help.h
@@ -40,6 +40,10 @@ namespace help {
/* Merges prelude_t and params_t into a data_t object. */
data_t build_data ();
+ /* Cleanup functions for string trimming. */
+ prelude_t cleanup_prelude (prelude_t prelude);
+ params_t cleanup_params (params_t params);
+
/* Prints a help_data_t structure. */
void pretty_print (data_t data);
}
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list