[med-svn] [aghermann] 03/23: use agh::str::sasprintf instead of snprintf_buf, when passing filenames as %s, just in case
andrei zavada
hmmr-guest at alioth.debian.org
Sat Aug 17 18:05:39 UTC 2013
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to branch master
in repository aghermann.
commit 3e474e5393a382e54b6650f65fc06a682e19b51a
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sun Jul 28 11:25:47 2013 +0300
use agh::str::sasprintf instead of snprintf_buf, when passing filenames as %s, just in case
---
src/aghermann/ui/mw/measurements_cb.cc | 35 ++++++++++++++++++--------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/aghermann/ui/mw/measurements_cb.cc b/src/aghermann/ui/mw/measurements_cb.cc
index 223942d..e55782f 100644
--- a/src/aghermann/ui/mw/measurements_cb.cc
+++ b/src/aghermann/ui/mw/measurements_cb.cc
@@ -240,10 +240,10 @@ iSubjectTimelineSaveAsSVG_activate_cb(
auto& ED = *(SExpDesignUI*)userdata;
auto J = ED.using_subject;
- string tmp (snprintf_buf(
- "%s/%s/%s/%s/%s.svg",
- ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
- ED.AghD(), ED.AghT()));
+ string tmp = agh::str::sasprintf(
+ "%s/%s/%s/%s/%s.svg",
+ ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
+ ED.AghD(), ED.AghT());
J->is_focused = true;
J->draw_timeline( tmp);
@@ -260,11 +260,17 @@ iSubjectTimelineBrowse_activate_cb(
auto& ED = *(SExpDesignUI*)userdata;
auto J = ED.using_subject;
- snprintf_buf(
- "%s '%s/%s/%s/%s' &",
- ED.browse_command.c_str(),
- ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD());
- if ( system( __buf__) ) {}
+ if ( system( agh::str::sasprintf(
+ "%s '%s/%s/%s/%s' &",
+ ED.browse_command.c_str(),
+ ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
+ .c_str()) ) {
+ pop_ok_message(
+ ED.wMainWindow,
+ "Error launching file browser",
+ "Command '%s' returned a non-zero status.",
+ ED.browse_command.c_str()) ;
+ }
}
void
@@ -275,16 +281,15 @@ iSubjectTimelineResetMontage_activate_cb(
const auto& ED = *(SExpDesignUI*)userdata;
const auto J = ED.using_subject;
- if ( not J->is_episode_focused() )
- snprintf_buf(
+ string exec = (not J->is_episode_focused())
+ ? agh::str::sasprintf(
"find '%s/%s/%s/%s' -name '.*.montage' -delete",
- ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD());
- else
- snprintf_buf(
+ ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
+ : agh::str::sasprintf(
"rm -f '%s/%s/%s/%s/.%s.montage'",
ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD(), ED.AghE());
- if ( system( __buf__) )
+ if ( system( exec.c_str()) )
pop_ok_message(
ED.wMainWindow, "Wow", "Command '%s' returned a non-zero status. This is weird.", __buf__);
}
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git
More information about the debian-med-commit
mailing list