[gnome-commander/gcmd-1-6] Fixes bug in gnome_cmd_advrename_gen_fname resulting in string garbage when using advace rename tool
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-6] Fixes bug in gnome_cmd_advrename_gen_fname resulting in string garbage when using advace rename tool
- Date: Sat, 5 Nov 2016 22:44:58 +0000 (UTC)
commit 9434e6b85a7278e248c6710317efc1abb8981932
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sat Nov 5 23:38:25 2016 +0100
Fixes bug in gnome_cmd_advrename_gen_fname resulting in string garbage when using advace rename tool
src/gnome-cmd-advrename-lexer.ll | 2 +-
src/tags/gnome-cmd-tags.cc | 12 +++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gnome-cmd-advrename-lexer.ll b/src/gnome-cmd-advrename-lexer.ll
index ed322fd..691b163 100644
--- a/src/gnome-cmd-advrename-lexer.ll
+++ b/src/gnome-cmd-advrename-lexer.ll
@@ -549,7 +549,7 @@ char *gnome_cmd_advrename_gen_fname (GnomeCmdFile *f, size_t new_fname_size)
// if (tag_value)
// append_utf8_chunk (fmt, *i, tag_value, g_utf8_strlen (tag_value, -1));
- fmt += gcmd_tags_get_value (f, (*i)->tag.tag);
+ fmt += gcmd_tags_get_value_string (f, (*i)->tag.tag);
break;
default : break;
diff --git a/src/tags/gnome-cmd-tags.cc b/src/tags/gnome-cmd-tags.cc
index 65ecb67..ff31a28 100644
--- a/src/tags/gnome-cmd-tags.cc
+++ b/src/tags/gnome-cmd-tags.cc
@@ -717,11 +717,11 @@ const gchar *gcmd_tags_get_class_name(const GnomeCmdTag tag)
}
-const gchar *gcmd_tags_get_value(GnomeCmdFile *f, const GnomeCmdTag tag)
+const std::string gcmd_tags_get_value_string(GnomeCmdFile *f, const GnomeCmdTag tag)
{
g_return_val_if_fail (f != NULL, empty_string);
- const gchar *ret_val = empty_string;
+ std::string ret_val = empty_string;
switch (metatags[tag].tag_class)
{
@@ -777,7 +777,13 @@ const gchar *gcmd_tags_get_value(GnomeCmdFile *f, const GnomeCmdTag tag)
default: break;
}
- return ret_val ? ret_val : empty_string;
+ return ret_val.length() != 0 ? ret_val : empty_string;
+}
+
+
+const gchar *gcmd_tags_get_value(GnomeCmdFile *f, const GnomeCmdTag tag)
+{
+ return gcmd_tags_get_value_string(f, tag).c_str();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]