[med-svn] [aghermann] 09/24: assorted c++ style pedantisms and cleanups

andrei zavada hmmr-guest at moszumanska.debian.org
Mon Jun 15 01:48:25 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 03399feaa23511ad90318e9ea17910fb97d7fb2c
Author: Andrei Zavada <hmmr at ra>
Date:   Sun Jun 14 18:34:05 2015 +0300

    assorted c++ style pedantisms and cleanups
---
 upstream/src/aghermann/expdesign/recording.cc |  2 +-
 upstream/src/aghermann/ui/mw/mainmenu_cb.cc   | 16 ++++------------
 upstream/src/aghermann/ui/sf/channel.cc       |  2 +-
 upstream/src/aghermann/ui/sf/d/patterns.cc    |  2 +-
 upstream/src/common/config-validate.hh        |  2 +-
 upstream/src/libsigfile/edf-io.cc             |  6 +++---
 upstream/src/libsigfile/source-base.hh        | 10 +++++-----
 7 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/upstream/src/aghermann/expdesign/recording.cc b/upstream/src/aghermann/expdesign/recording.cc
index fde44ce..2a759a1 100644
--- a/upstream/src/aghermann/expdesign/recording.cc
+++ b/upstream/src/aghermann/expdesign/recording.cc
@@ -58,7 +58,7 @@ display_name() const
         case metrics::TType::psd: return move(sasprintf( "%s (%g-%g Hz)", metric_name(), P.psd.freq_from, P.psd.freq_upto));
         case metrics::TType::swu: return move(sasprintf( "%s (%g Hz)",    metric_name(), P.swu.f0));
         case metrics::TType::mc : return move(sasprintf( "%s (%g Hz)",    metric_name(), P.mc.f0));
-        default: return move(sasprintf( "(invalid metric: %d)", metric));
+        default: return move(sasprintf( "(invalid metric: %d)", (int)metric));
         }
 }
 
diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index b117126..f86b331 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -447,8 +447,7 @@ iExpGloballyDetectArtifacts_activate_cb(
                 };
         switch ( response ) {
         case GTK_RESPONSE_OK:
-                op =
-                [&]( SEpisode& E)
+                op = [&]( SEpisode& E)
                 {
                         if ( not keep_existing )
                                 for ( auto& F : E.sources ) {
@@ -456,28 +455,21 @@ iExpGloballyDetectArtifacts_activate_cb(
                                                 F().artifacts((int)h).clear_all();
                                         ad::detect_artifacts( F(), P);
                                 }
-                        // for ( size_t p = 0; p < marked.size(); ++p )
-                        //         af.mark_artifact(
-                        //                 marked[p] * P.scope * sr,
-                        //                 (marked[p]+1) * P.scope * sr);
                 };
-                filter =
-                [&]( SEpisode& E)
+                filter = [&]( SEpisode& E)
                 {
                         return true;  // R.signal_type() == sigfile::SChannel::TType::eeg;
                 };
             break;
 
         case 1:  // "Clear All"
-                op =
-                [&]( SEpisode& E)
+                op = [&]( SEpisode& E)
                 {
                         for ( auto& F : E.sources )
                                 for ( size_t h = 0; h < F().n_channels(); ++h )
                                         F().artifacts((int)h).clear_all();
                 };
-                filter =
-                [&]( SEpisode&)
+                filter = [&]( SEpisode&)
                 {
                         return true; // clear in all channels (mark in EEG channels only)
                 };
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index 04bb7f8..6c07b31 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -460,7 +460,7 @@ mark_region_as_annotation( const string& label,
                            const sigfile::SAnnotation::TType type)
 {
         sigfile::mark_annotation(
-                annotations,
+                &annotations,
                 selection_start_time, selection_end_time,
                 label,
                 type);
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.cc b/upstream/src/aghermann/ui/sf/d/patterns.cc
index d69b488..68f4073 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns.cc
@@ -263,7 +263,7 @@ occurrences_to_annotations( sigfile::SAnnotation::TType t)
 {
         for ( size_t o = 0; o < occurrences.size(); ++o )
                 sigfile::mark_annotation(
-                        field_channel->annotations,
+                        &field_channel->annotations,
                         ((double)occurrences[o]) / field_channel->samplerate(),
                         ((double)occurrences[o] + current_profile->pattern_size_essential()) / field_channel->samplerate(),
                         snprintf_buf("%s (%zu)", current_profile->name.c_str(), o+1),
diff --git a/upstream/src/common/config-validate.hh b/upstream/src/common/config-validate.hh
index 3ff540f..5779ce4 100644
--- a/upstream/src/common/config-validate.hh
+++ b/upstream/src/common/config-validate.hh
@@ -146,7 +146,7 @@ struct SValidator : IValidator {
                                 return; // leave at default
                         }
                         if ( not valf(tmp) ) {
-                                lo->msg( agh::log::TLevel::warning, LOG_SOURCE_ISSUER, "Bsd value for key \"%s\"", key.c_str());
+                                lo->msg( agh::log::TLevel::warning, LOG_SOURCE_ISSUER, "Bad value for key \"%s\"", key.c_str());
                                 if ( throw_option == TThrowOption::do_throw )
                                         throw invalid_argument( string("Bad value for \"") + key + "\"");
                         } else
diff --git a/upstream/src/libsigfile/edf-io.cc b/upstream/src/libsigfile/edf-io.cc
index c7bb709..1f2cf40 100644
--- a/upstream/src/libsigfile/edf-io.cc
+++ b/upstream/src/libsigfile/edf-io.cc
@@ -34,7 +34,7 @@ get_region_original_smpl( const int h,
         valarray<TFloat> recp;
 
         const SSignal& H = operator[](h);
-        size_t        r0    =                        (   sa) / H.samples_per_record,
+        size_t  r0    =                        (   sa) / H.samples_per_record,
                 r_cnt = (size_t) ceilf( (float)(sz-sa) / H.samples_per_record);
 
         int16_t* tmp;
@@ -44,8 +44,8 @@ get_region_original_smpl( const int h,
                 memcpy( &tmp[ r_cnt * H.samples_per_record ],
 
                         (char*)_mmapping + header_length
-                        + (r0 + r_cnt) * _total_samples_per_record * 2        // full records before
-                        + H._at * 2,                                // offset to our samples
+                        + (r0 + r_cnt) * _total_samples_per_record * 2 // full records before
+                        + H._at * 2,                                 // offset to our samples
 
                         H.samples_per_record * 2);        // our precious ones
 
diff --git a/upstream/src/libsigfile/source-base.hh b/upstream/src/libsigfile/source-base.hh
index 3eadf53..48e2703 100644
--- a/upstream/src/libsigfile/source-base.hh
+++ b/upstream/src/libsigfile/source-base.hh
@@ -159,13 +159,13 @@ struct SAnnotation {
 
 
 inline void
-mark_annotation( list<SAnnotation>& annotations,
-                 double aa, double az,
+mark_annotation( list<SAnnotation>* annotations,
+                 const double aa, const double az,
                  const string& label,
-                 SAnnotation::TType t = SAnnotation::TType::plain)
+                 const SAnnotation::TType t = SAnnotation::TType::plain)
 {
-        annotations.emplace_back( aa, az, label, t);
-        annotations.sort();
+        annotations->emplace_back( aa, az, label, t);
+        annotations->sort();
 }
 
 

-- 
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