[med-svn] [aghermann] 03/34: rk1968: fix error path code flow
andrei zavada
hmmr-guest at moszumanska.debian.org
Sat Nov 23 00:46:47 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 6d5880ce6e9c4da2f242983c0263d10bf1944e0e
Author: andrei zavada <hmmr at fa2>
Date: Mon Nov 11 19:58:01 2013 +0200
rk1968: fix error path code flow
---
upstream/src/aghermann/rk1968/rk1968.cc | 46 ++++++++++++++++-----------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 0e9cfca..cf59c8a 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -221,7 +221,7 @@ host_get_data( lua_State *L)
int opcode = lua_tointeger( L, 2);
- auto make_arity_mismatch_return = [&L, &nargsin, &opcode] ( int correct_nargsin)
+ auto make_arity_mismatch_return = [&L, &nargsin, &opcode] ( int correct_nargsin) -> int
{
lua_settop( L, 0); // now we can push
lua_pushboolean( L, false);
@@ -229,7 +229,7 @@ host_get_data( lua_State *L)
lua_pushfstring( L, "Bad arity for opcode %d (need %d, got %d)", opcode, correct_nargsin, nargsin);
return 2;
};
- auto make_error_return = [&L] ( const char* fmt, ...) __attribute__ ((format (printf, 2, 3)))
+ auto make_error_return = [&L] ( const char* fmt, ...) __attribute__ ((format (printf, 2, 3))) -> int
{
lua_settop( L, 0); // now we can push
lua_pushboolean( L, false);
@@ -242,9 +242,9 @@ host_get_data( lua_State *L)
return 2;
};
#define NEED_ARITY_ATLEAST(A) \
- if ( nargsin < A ) { make_arity_mismatch_return(A); }
+ if ( nargsin < A ) { return make_arity_mismatch_return(A); }
#define NEED_ARITY_EXACT(A) \
- if ( nargsin != A ) { make_arity_mismatch_return(A); }
+ if ( nargsin != A ) { return make_arity_mismatch_return(A); }
switch ( opcode ) {
case op_noop:
@@ -254,7 +254,7 @@ host_get_data( lua_State *L)
NEED_ARITY_EXACT(0);
if ( !lua_checkstack( L, 1 + E.recordings.size()) )
- make_error_return( "Failed to grow stack for %d elements", 1 + (int)E.recordings.size());
+ return make_error_return( "Failed to grow stack for %d elements", 1 + (int)E.recordings.size());
lua_settop( L, 0); // now we can push
lua_pushinteger( L, E.recordings.size());
@@ -275,7 +275,7 @@ host_get_data( lua_State *L)
if ( 0 == strcasecmp( H.first.type_s(), type) )
++hh_of_type;
if ( !lua_checkstack( L, 1 + hh_of_type) )
- make_error_return( "Failed to grow stack for %d elements", 1 + (int)hh_of_type);
+ return make_error_return( "Failed to grow stack for %d elements", 1 + (int)hh_of_type);
lua_pushinteger( L, hh_of_type);
for ( auto& H : E.recordings )
@@ -293,11 +293,11 @@ host_get_data( lua_State *L)
auto Hi = E.recordings.find( sigfile::SChannel (channel));
if ( Hi == E.recordings.end() ) {
- make_error_return( "No such channel (%s)", channel);
+ return make_error_return( "No such channel (%s)", channel);
} else {
auto& R = Hi->second;
if ( !lua_checkstack( L, 4) )
- make_error_return( "Failed to grow stack for 4 elements");
+ return make_error_return( "Failed to grow stack for 4 elements");
lua_pushinteger( L, R.full_pages());
lua_pushinteger( L, R.total_pages());
lua_pushinteger( L, R.pagesize());
@@ -314,23 +314,23 @@ host_get_data( lua_State *L)
const char* channel = lua_tostring( L, 3);
auto Hi = E.recordings.find( sigfile::SChannel (channel));
if ( Hi == E.recordings.end() ) {
- make_error_return( "No such channel (%s)", channel);
+ return make_error_return( "No such channel (%s)", channel);
} else if ( !Hi->first.is_fftable() ) {
- make_error_return( "Request of profile metric from a non-EEG channel channel %s", channel);
+ return make_error_return( "Request of profile metric from a non-EEG channel channel %s", channel);
} else {
auto& R = Hi->second;
int pa = lua_tointeger( L, 4);
int pz = lua_tointeger( L, 5);
if ( !(pa <= pz) )
- make_error_return( "Invalid (inclusive) range: %d..%d", pa, pz);
+ return make_error_return( "Invalid (inclusive) range: %d..%d", pa, pz);
if ( pa < 0 || (size_t)pa >= R.full_pages() )
- make_error_return( "Page %d out of valid range (%zu is last full)", pa, R.full_pages());
+ return make_error_return( "Page %d out of valid range (%zu is last full)", pa, R.full_pages());
if ( pz < 0 || (size_t)pz >= R.full_pages() )
- make_error_return( "Page %d out of valid range (%zu is last full)", pz, R.full_pages());
+ return make_error_return( "Page %d out of valid range (%zu is last full)", pz, R.full_pages());
double fa = lua_tonumber( L, 6);
double fz = lua_tonumber( L, 7);
if ( fa >= fz )
- make_error_return( "Ill-formed frequency range");
+ return make_error_return( "Ill-formed frequency range");
lua_settop( L, 0);
auto C =
@@ -341,7 +341,7 @@ host_get_data( lua_State *L)
: R.swu_profile.course( fa);
auto p = pa;
if ( !lua_checkstack( L, pz - pa) )
- make_error_return( "Failed to grow stack for %d numbers", pz - pa);
+ return make_error_return( "Failed to grow stack for %d numbers", pz - pa);
while ( p <= pz )
lua_pushnumber( L, C[p++]);
@@ -356,19 +356,19 @@ host_get_data( lua_State *L)
auto Hi = E.recordings.find( sigfile::SChannel (channel));
if ( Hi == E.recordings.end() ) {
- make_error_return( "No such channel (%s)", channel);
+ return make_error_return( "No such channel (%s)", channel);
} else {
auto& R = Hi->second;
int p = lua_tointeger( L, 4);
if ( p < 0 || (size_t)p >= R.full_pages() )
- make_error_return( "Page %d out of valid range (%zu is last full)", p, R.full_pages());
+ return make_error_return( "Page %d out of valid range (%zu is last full)", p, R.full_pages());
double dh = lua_tonumber( L, 5);
if ( dh <= 0. || dh > 1e2 )
- make_error_return( "Bad scope parameter (%g; expecting it to be in range 0..1e2)", dh);
+ return make_error_return( "Bad scope parameter (%g; expecting it to be in range 0..1e2)", dh);
double dt = lua_tonumber( L, 6);
if ( dt <= 0. || dt > R.pagesize() )
- make_error_return( "Bad dt parameter (%g; expecting it to be in range 0..%zu)", dt, R.pagesize());
+ return make_error_return( "Bad dt parameter (%g; expecting it to be in range 0..%zu)", dt, R.pagesize());
lua_settop( L, 0);
auto sr = R.F().samplerate(R.h());
@@ -380,7 +380,7 @@ host_get_data( lua_State *L)
dh, dt);
if ( !lua_checkstack( L, raw_profile.size()) )
- make_error_return( "Failed to grow stack for %zu numbers", raw_profile.size());
+ return make_error_return( "Failed to grow stack for %zu numbers", raw_profile.size());
auto b = 0u;
while ( b < raw_profile.size() )
@@ -395,14 +395,14 @@ host_get_data( lua_State *L)
const char* channel = lua_tostring( L, 3);
auto Hi = E.recordings.find( sigfile::SChannel (channel));
if ( Hi == E.recordings.end() ) {
- make_error_return( "No such channel (%s)", channel);
+ return make_error_return( "No such channel (%s)", channel);
} else {
auto& R = Hi->second;
int p = lua_tointeger( L, 4);
lua_settop( L, 0);
if ( p < 0 || (size_t)p >= R.full_pages() )
- make_error_return( "Page %d out of valid range (%zu is last full)", p, R.full_pages());
+ return make_error_return( "Page %d out of valid range (%zu is last full)", p, R.full_pages());
lua_pushnumber(
L,
@@ -414,7 +414,7 @@ host_get_data( lua_State *L)
}
default:
- make_error_return( "Invalid host opcode %d", opcode);
+ return make_error_return( "Invalid host opcode %d", opcode);
}
#undef NEED_ARITY_EXACT
#undef NEED_ARITY_ATLEAST
--
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