[med-svn] [aghermann] 01/05: sprinkle some constness
andrei zavada
hmmr-guest at moszumanska.debian.org
Sat May 2 19:54:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to branch WIP
in repository aghermann.
commit b7897fcb111a2113c19ebe875dcb23020ae8098c
Author: Andrei Zavada <hmmr at ra>
Date: Sat Apr 4 05:43:52 2015 +0300
sprinkle some constness
---
upstream/src/aghermann/ui/misc.cc | 9 ++++++---
upstream/src/aghermann/ui/mw/admit-one.cc | 12 ++++++------
upstream/src/aghermann/ui/mw/admit-one_cb.cc | 2 +-
upstream/src/aghermann/ui/mw/construct.cc | 6 +++---
upstream/src/aghermann/ui/mw/loadsave.cc | 6 +++---
upstream/src/aghermann/ui/mw/measurements.cc | 19 ++++++++++---------
upstream/src/aghermann/ui/mw/measurements_cb.cc | 14 +++++++-------
upstream/src/aghermann/ui/ui++.cc | 2 +-
upstream/src/aghermann/ui/ui.cc | 11 ++++++-----
9 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/upstream/src/aghermann/ui/misc.cc b/upstream/src/aghermann/ui/misc.cc
index b184a7f..9124163 100644
--- a/upstream/src/aghermann/ui/misc.cc
+++ b/upstream/src/aghermann/ui/misc.cc
@@ -23,7 +23,8 @@ snprintf_buf_ts_d( const double d_)
if ( d_ < 1. )
snprintf_buf_ts_h( d_ * 24);
else {
- unsigned m_ = lroundf(d_*24*60*60) / 60,
+ const unsigned
+ m_ = lroundf(d_*24*60*60) / 60,
m = (m_ % 60),
h = (m_ / 60) % 24,
d = (m_ / 60 / 24);
@@ -46,7 +47,8 @@ snprintf_buf_ts_h( const double h_)
else if ( h_ >= 24. )
snprintf_buf_ts_d( h_ / 24);
else {
- unsigned m_ = lroundf( h_*60*60) / 60,
+ const unsigned
+ m_ = lroundf( h_*60*60) / 60,
m = (m_ % 60),
h = (m_ / 60);
if ( m % 60 == 0 )
@@ -66,7 +68,8 @@ snprintf_buf_ts_m( const double m_)
else if ( m_ >= 60. )
snprintf_buf_ts_h( m_ / 60);
else {
- unsigned s_ = lroundf( m_*60) / 60,
+ const unsigned
+ s_ = lroundf( m_*60) / 60,
s = (s_ % 60),
m = (s_ / 60);
if ( s % 60 == 0 )
diff --git a/upstream/src/aghermann/ui/mw/admit-one.cc b/upstream/src/aghermann/ui/mw/admit-one.cc
index 3852f75..7cd905c 100644
--- a/upstream/src/aghermann/ui/mw/admit-one.cc
+++ b/upstream/src/aghermann/ui/mw/admit-one.cc
@@ -117,7 +117,7 @@ dnd_maybe_admit_one( const char* fname)
// enumerate known sessions and episodes
// suggest those from the file proper
- for ( auto &i : AghEE ) {
+ for ( const auto &i : AghEE ) {
gtk_list_store_append( m_episodes, &iter);
gtk_list_store_set( m_episodes, &iter, 0, i.c_str(), -1);
}
@@ -130,7 +130,7 @@ dnd_maybe_admit_one( const char* fname)
(GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportEpisode),
F.episode());
- for ( auto &i : AghDD ) {
+ for ( const auto &i : AghDD ) {
gtk_list_store_append( m_sessions, &iter);
gtk_list_store_set( m_sessions, &iter, 0, i.c_str(), -1);
}
@@ -154,15 +154,15 @@ dnd_maybe_admit_one( const char* fname)
switch ( response ) {
case GTK_RESPONSE_OK: // Admit
{
- string dest_path, dest, cmd;
using agh::str::sasprintf;
- dest_path = sasprintf(
+ const string dest_path = sasprintf(
"%s/%s/%s/%s",
ED->session_dir(), selected_group,
F.subject().id.c_str(), selected_session);
- dest = sasprintf(
+ const string dest = sasprintf(
"%s/%s.edf",
dest_path.c_str(), selected_episode);
+ string cmd;
if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachCopy) )
cmd = sasprintf( "mkdir -p '%s' && cp -n '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
else if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachMove) )
@@ -171,7 +171,7 @@ dnd_maybe_admit_one( const char* fname)
cmd = sasprintf( "mkdir -p '%s' && ln -s '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
char* cmde = g_markup_escape_text( cmd.c_str(), -1);
- int cmd_exit = system( cmd.c_str());
+ const int cmd_exit = system( cmd.c_str());
if ( cmd_exit )
pop_ok_message(
wMainWindow,
diff --git a/upstream/src/aghermann/ui/mw/admit-one_cb.cc b/upstream/src/aghermann/ui/mw/admit-one_cb.cc
index 6d27e6a..cb6107f 100644
--- a/upstream/src/aghermann/ui/mw/admit-one_cb.cc
+++ b/upstream/src/aghermann/ui/mw/admit-one_cb.cc
@@ -22,7 +22,7 @@ check_gtk_entry_nonempty_cb(
GtkEditable*,
const gpointer userdata)
{
- auto& ED = *(SExpDesignUI*)userdata;
+ const auto& ED = *(SExpDesignUI*)userdata;
gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, TRUE);
diff --git a/upstream/src/aghermann/ui/mw/construct.cc b/upstream/src/aghermann/ui/mw/construct.cc
index 2f329e1..10457f8 100644
--- a/upstream/src/aghermann/ui/mw/construct.cc
+++ b/upstream/src/aghermann/ui/mw/construct.cc
@@ -324,7 +324,7 @@ SExpDesignUIWidgets ()
AGH_GBGETOBJ (eFFTParamsPlanType);
AGH_GBGETOBJ (eFFTParamsWindowType);
- for ( auto& e : {eFFTParamsBinSize, eFFTParamsPageSize, eFFTParamsPlanType, eFFTParamsWindowType} )
+ for ( const auto& e : {eFFTParamsBinSize, eFFTParamsPageSize, eFFTParamsPlanType, eFFTParamsWindowType} )
gtk_cell_layout_set_renderer( e);
// ------------- fArtifacts
@@ -561,7 +561,7 @@ SExpDesignUIWidgets ()
PANGO_TAB_LEFT, 190),
NULL);
- for ( auto W : {eEdfImportGroupEntry, eEdfImportSessionEntry, eEdfImportEpisodeEntry} )
+ for ( auto& W : {eEdfImportGroupEntry, eEdfImportSessionEntry, eEdfImportEpisodeEntry} )
g_signal_connect(
W,
"changed", (GCallback)check_gtk_entry_nonempty_cb,
@@ -609,7 +609,7 @@ SExpDesignUIWidgets ()
G_CONNECT_2 (tvGlobalAnnotations, row, activated);
int c = 0;
- for ( auto column : {"Recording", "Page(s)", "Channel", "Type", "Label"} ) {
+ for ( const auto& column : {"Recording", "Page(s)", "Channel", "Type", "Label"} ) {
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
g_object_set( (GObject*)renderer,
"editable", FALSE,
diff --git a/upstream/src/aghermann/ui/mw/loadsave.cc b/upstream/src/aghermann/ui/mw/loadsave.cc
index 6fe5e56..a286698 100644
--- a/upstream/src/aghermann/ui/mw/loadsave.cc
+++ b/upstream/src/aghermann/ui/mw/loadsave.cc
@@ -89,7 +89,7 @@ load_settings()
config.get( conf, agh::global::default_log_facility, agh::TThrowOption::do_throw);
try {
- auto& SC = conf.lookup("ScoreCodes");
+ const auto& SC = conf.lookup("ScoreCodes");
for ( size_t i = sigfile::SPage::TScore::none; i < sigfile::SPage::TScore::TScore_total; ++i )
ext_score_codes[i].assign( (const char*)SC[i]);
} catch (...) {
@@ -97,7 +97,7 @@ load_settings()
}
for( auto &p : saving_colors() ) {
try {
- auto& V = conf.lookup(string("Color.")+p.first);
+ const auto& V = conf.lookup(string("Color.")+p.first);
auto& C = CwB[p.second];
C.clr.red = V[0];
C.clr.green = V[1];
@@ -163,7 +163,7 @@ save_settings()
agh::confval::put( conf, "ScoreCodes", ext_score_codes);
- for ( auto &p : saving_colors() ) {
+ for ( const auto &p : saving_colors() ) {
auto& C = CwB[p.second];
agh::confval::put( conf, string("Color.") + p.first,
list<double> {C.clr.red, C.clr.green, C.clr.blue, C.clr.alpha});
diff --git a/upstream/src/aghermann/ui/mw/measurements.cc b/upstream/src/aghermann/ui/mw/measurements.cc
index 82d4946..9317dc8 100644
--- a/upstream/src/aghermann/ui/mw/measurements.cc
+++ b/upstream/src/aghermann/ui/mw/measurements.cc
@@ -144,16 +144,16 @@ draw_timeline( cairo_t *cr) const
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size( cr, 11);
for ( auto& E : episodes ) {
- unsigned
+ const unsigned
e_pixel_start = _p._p.T2P( E.start_rel),
e_pixel_end = _p._p.T2P( E.end_rel),
e_pixels = e_pixel_end - e_pixel_start;
// episode start timestamp
- time_t dima = E.start_time();
+ const time_t dima = E.start_time();
strftime( global::buf, 79, "%F %T",
localtime( &dima));
- string ss = agh::str::sasprintf(
+ const string ss = agh::str::sasprintf(
"%s | %s",
global::buf, E.name());
cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2+1, 12+1);
@@ -232,7 +232,8 @@ draw_timeline( cairo_t *cr) const
_p._p.CwB[TColour::mw_ticks /* bounds? */].set_source_rgba( cr, .7);
cairo_set_line_width( cr, .5);
- auto dxe = tl_left_margin() + e_pixel_start,
+ const auto
+ dxe = tl_left_margin() + e_pixel_start,
dye = tl_height() - 12;
cairo_move_to( cr, dxe, dye - F(0.) * tl_height()/2);
const size_t pp = M.full_pages();
@@ -252,10 +253,10 @@ draw_timeline( cairo_t *cr) const
cairo_set_line_width( cr, .5);
_p._p.CwB[TColour::mw_ticks].set_source_rgb( cr);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- unsigned clock_d0 = localtime(&tl_start_fixed)->tm_mday + 1;
+ const auto clock_d0 = localtime(&tl_start_fixed)->tm_mday + 1;
for ( time_t t = tl_start_fixed; t <= timeline_end(); t += 3600 ) {
- size_t x = _p._p.T2P(t);
- unsigned
+ const size_t x = _p._p.T2P(t);
+ const auto
clock_h = localtime(&t)->tm_hour,
clock_d = localtime(&t)->tm_mday;
if ( clock_h % 6 == 0 ) {
@@ -310,7 +311,7 @@ void
SExpDesignUI::
modify_active_profile_scale( const GdkScrollDirection d)
{
- auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
+ const auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
switch ( display_profile_type ) {
case metrics::TType::psd: profile_scale_psd *= fac; break;
case metrics::TType::swu: profile_scale_swu *= fac; break;
@@ -323,7 +324,7 @@ void
SExpDesignUI::
modify_profile_scales( const GdkScrollDirection d)
{
- auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
+ const auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
profile_scale_psd *= fac;
profile_scale_swu *= fac;
profile_scale_mc *= fac;
diff --git a/upstream/src/aghermann/ui/mw/measurements_cb.cc b/upstream/src/aghermann/ui/mw/measurements_cb.cc
index 8aa893b..1fcbac1 100644
--- a/upstream/src/aghermann/ui/mw/measurements_cb.cc
+++ b/upstream/src/aghermann/ui/mw/measurements_cb.cc
@@ -52,7 +52,7 @@ daSubjectTimeline_motion_notify_event_cb(
{
auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
- auto e_before = J.using_episode;
+ const auto e_before = J.using_episode;
if ( J.get_episode_from_timeline_click( event->x), J.using_episode != e_before )
gtk_widget_queue_draw( wid);
@@ -118,7 +118,7 @@ daSubjectTimeline_button_press_event_cb(
break;
case 2:
case 3:
- bool episode_ops = J.is_episode_focused();
+ const bool episode_ops = J.is_episode_focused();
gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineScore, episode_ops);
gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineDetectUltradianCycle, episode_ops);
gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineEDFInfo, episode_ops);
@@ -189,7 +189,7 @@ iSubjectTimelineScore_activate_cb(
const gpointer userdata)
{
auto& ED = *(SExpDesignUI*)userdata;
- auto J = ED.using_subject;
+ const auto J = ED.using_subject;
new SScoringFacility( J->csubject, *ED._AghDi, *ED._AghEi, ED);
}
@@ -215,8 +215,8 @@ iSubjectTimelineEDFInfo_activate_cb(
GtkMenuItem*,
const gpointer userdata)
{
- auto& ED = *(SExpDesignUI*)userdata;
- auto J = ED.using_subject;
+ const auto& ED = *(SExpDesignUI*)userdata;
+ const auto J = ED.using_subject;
const auto& F = J->using_episode->sources.front();
gtk_text_buffer_set_text(
@@ -240,7 +240,7 @@ iSubjectTimelineSaveAsSVG_activate_cb(
auto& ED = *(SExpDesignUI*)userdata;
auto J = ED.using_subject;
- string tmp = agh::str::sasprintf(
+ const string tmp = agh::str::sasprintf(
"%s/%s/%s/%s/%s.svg",
ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
ED.AghD(), ED.AghT());
@@ -281,7 +281,7 @@ iSubjectTimelineResetMontage_activate_cb(
const auto& ED = *(SExpDesignUI*)userdata;
const auto J = ED.using_subject;
- string exec = (not J->is_episode_focused())
+ const string exec = (not J->is_episode_focused())
? agh::str::sasprintf(
"find '%s/%s/%s/%s' -name '.*.montage' -delete",
ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
diff --git a/upstream/src/aghermann/ui/ui++.cc b/upstream/src/aghermann/ui/ui++.cc
index 18abd91..7d04415 100644
--- a/upstream/src/aghermann/ui/ui++.cc
+++ b/upstream/src/aghermann/ui/ui++.cc
@@ -39,7 +39,7 @@ SUIVar_<GtkListStore, list<string>>::down() const
v->clear();
GtkTreeIter
iter;
- gchar *entry;
+ gchar *entry;
while ( gtk_tree_model_get_iter_first( (GtkTreeModel*)w, &iter) ) {
gtk_tree_model_get(
(GtkTreeModel*)w, &iter,
diff --git a/upstream/src/aghermann/ui/ui.cc b/upstream/src/aghermann/ui/ui.cc
index f8ba657..461dc32 100644
--- a/upstream/src/aghermann/ui/ui.cc
+++ b/upstream/src/aghermann/ui/ui.cc
@@ -34,7 +34,8 @@ cairo_put_banner( cairo_t *cr, const float wd, const float ht,
cairo_set_source_rgba( cr, r, g, b, a);
cairo_text_extents_t extents;
cairo_text_extents( cr, text, &extents);
- double idox = wd/2 - extents.width/2,
+ const double
+ idox = wd/2 - extents.width/2,
idoy = ht/2 + extents.height/2;
cairo_move_to( cr, idox, idoy);
cairo_show_text( cr, text);
@@ -51,7 +52,7 @@ cairo_draw_signal( cairo_t *cr, const valarray<TFloat>& V,
const TDrawSignalDirection direction,
const TDrawSignalPathOption continue_path_option)
{
- bool continue_path = continue_path_option == TDrawSignalPathOption::yes;
+ const bool continue_path = continue_path_option == TDrawSignalPathOption::yes;
switch ( direction ) {
case TDrawSignalDirection::forward:
@@ -97,7 +98,7 @@ cairo_draw_envelope( cairo_t *cr, const valarray<TFloat>& V,
agh::alg::ensure_within( start, (ssize_t)0, (ssize_t)V.size());
agh::alg::ensure_within( end, (ssize_t)0, (ssize_t)V.size());
- double dps = (double)(end - start) / hspan;
+ const double dps = (double)(end - start) / hspan;
cairo_move_to( cr, hoff, voff);
ssize_t i = start;
for ( ; i < end; ++i )
@@ -150,7 +151,7 @@ pop_ok_message( GtkWindow *parent,
const char* primary_text,
const char* fmt, ...)
{
- auto W = (GtkMessageDialog*)
+ const auto W = (GtkMessageDialog*)
gtk_message_dialog_new_with_markup(
parent,
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
@@ -182,7 +183,7 @@ pop_question( GtkWindow* parent,
const char* primary_text,
const char* fmt, ...)
{
- auto W = (GtkMessageDialog*)
+ const auto W = (GtkMessageDialog*)
gtk_message_dialog_new_with_markup(
parent,
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git
More information about the debian-med-commit
mailing list