[med-svn] [aghermann] 03/23: avoid passing a non-const ref of thing to be modified
andrei zavada
hmmr-guest at moszumanska.debian.org
Wed Jan 4 22:59:24 UTC 2017
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to tag 1.1.2
in repository aghermann.
commit 1ff6b424d7475714ce3fe1dcafd2e65b31a640c5
Author: Andrei Zavada <hmmr at frdg>
Date: Mon Jan 2 05:57:21 2017 +0200
avoid passing a non-const ref of thing to be modified
---
upstream/src/libsigfile/edf.cc | 47 +++++++++++++++++++++---------------------
upstream/src/libsigfile/edf.hh | 2 +-
2 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/upstream/src/libsigfile/edf.cc b/upstream/src/libsigfile/edf.cc
index 04b6151..9f71891 100644
--- a/upstream/src/libsigfile/edf.cc
+++ b/upstream/src/libsigfile/edf.cc
@@ -426,20 +426,19 @@ _lay_out_header()
-
char*
CEDFFile::
-_get_next_field( char *&field, const size_t fld_size) throw (TStatus)
+_get_next_field( char **field, const size_t fld_size) throw (TStatus)
{
if ( _fld_pos + fld_size > _fsize ) {
_status |= bad_header;
throw bad_header;
}
- field = (char*)_mmapping + _fld_pos;
+ *field = (char*)_mmapping + _fld_pos;
_fld_pos += fld_size;
- return field;
+ return *field;
}
@@ -461,16 +460,16 @@ _parse_header()
size_t n_channels;
try {
_fld_pos = 0;
- _get_next_field( header.version_number, 8);
- _get_next_field( header.patient_id, 80);
- _get_next_field( header.recording_id, 80);
- _get_next_field( header.recording_date, 8);
- _get_next_field( header.recording_time, 8);
- _get_next_field( header.header_length, 8);
- _get_next_field( header.reserved, 44);
- _get_next_field( header.n_data_records, 8);
- _get_next_field( header.data_record_size, 8);
- _get_next_field( header.n_channels, 4);
+ _get_next_field( &header.version_number, 8);
+ _get_next_field( &header.patient_id, 80);
+ _get_next_field( &header.recording_id, 80);
+ _get_next_field( &header.recording_date, 8);
+ _get_next_field( &header.recording_time, 8);
+ _get_next_field( &header.header_length, 8);
+ _get_next_field( &header.reserved, 44);
+ _get_next_field( &header.n_data_records, 8);
+ _get_next_field( &header.data_record_size, 8);
+ _get_next_field( &header.n_channels, 4);
if ( strncmp( header.version_number, version_string, 8) ) {
_status |= (bad_version | inoperable);
@@ -536,20 +535,20 @@ _parse_header()
// determine & validate signal types
for ( auto &H : channels ) {
- _get_next_field( H.header.label, 16);
+ _get_next_field( &H.header.label, 16);
// let libsigfile::SChannel ctor figure
H.ucd = {trim( string (H.header.label, 16))};
}
for ( auto &H : channels )
H.transducer_type =
- trim( string (_get_next_field( H.header.transducer_type, 80), 80));
+ trim( string (_get_next_field( &H.header.transducer_type, 80), 80));
for ( auto &H : channels )
H.physical_dim =
- trim( string (_get_next_field( H.header.physical_dim, 8), 8));
+ trim( string (_get_next_field( &H.header.physical_dim, 8), 8));
for ( auto &H : channels ) {
- _get_next_field( H.header.physical_min, 8);
+ _get_next_field( &H.header.physical_min, 8);
if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
continue;
if ( sscanf( H.header.physical_min, "%8lg",
@@ -560,7 +559,7 @@ _parse_header()
}
}
for ( auto &H : channels ) {
- _get_next_field( H.header.physical_max, 8);
+ _get_next_field( &H.header.physical_max, 8);
if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
continue;
if ( sscanf( H.header.physical_max, "%8lg",
@@ -572,7 +571,7 @@ _parse_header()
}
for ( auto &H : channels ) {
- _get_next_field( H.header.digital_min, 8);
+ _get_next_field( &H.header.digital_min, 8);
if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
continue;
if ( sscanf( H.header.digital_min, "%8d",
@@ -583,7 +582,7 @@ _parse_header()
}
}
for ( auto &H : channels ) {
- _get_next_field( H.header.digital_max, 8);
+ _get_next_field( &H.header.digital_max, 8);
if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
continue;
if ( sscanf( H.header.digital_max, "%8d",
@@ -596,11 +595,11 @@ _parse_header()
for ( auto &H : channels )
H.filtering_info.assign(
- trim( string (_get_next_field( H.header.filtering_info, 80), 80)));
+ trim( string (_get_next_field( &H.header.filtering_info, 80), 80)));
for ( auto &H : channels ) {
char *tail;
- string t {trim( string (_get_next_field( H.header.samples_per_record, 8), 8))};
+ string t {trim( string (_get_next_field( &H.header.samples_per_record, 8), 8))};
H.samples_per_record =
strtoul( t.c_str(), &tail, 10);
if ( tail == NULL || *tail != '\0' ) {
@@ -612,7 +611,7 @@ _parse_header()
for ( auto &H : channels )
H.reserved.assign(
- trim( string (_get_next_field( H.header.reserved, 32), 32)));
+ trim( string (_get_next_field( &H.header.reserved, 32), 32)));
}
} catch (TStatus ex) {
return -1;
diff --git a/upstream/src/libsigfile/edf.hh b/upstream/src/libsigfile/edf.hh
index 1a350d9..10655e6 100644
--- a/upstream/src/libsigfile/edf.hh
+++ b/upstream/src/libsigfile/edf.hh
@@ -393,7 +393,7 @@ class CEDFFile
_fsize,
_fld_pos,
_total_samples_per_record;
- char* _get_next_field( char*&, size_t) throw (TStatus);
+ char* _get_next_field( char**, size_t) throw (TStatus);
void *_mmapping;
int _fd;
--
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