summaryrefslogtreecommitdiffstats
path: root/range_dec.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:16:35 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:16:35 +0000
commit9c4f65be76622adb3e5429760e1828c36343c15e (patch)
treeafc77153dd2432a0c71fe3589f0a431920b1ed33 /range_dec.cc
parentAdding upstream version 1.13~rc2. (diff)
downloadlziprecover-9c4f65be76622adb3e5429760e1828c36343c15e.tar.xz
lziprecover-9c4f65be76622adb3e5429760e1828c36343c15e.zip
Adding upstream version 1.13.upstream/1.13
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'range_dec.cc')
-rw-r--r--range_dec.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/range_dec.cc b/range_dec.cc
index 650d81a..d8e171a 100644
--- a/range_dec.cc
+++ b/range_dec.cc
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for lzipped files
- Copyright (C) 2009, 2010, 2011 Antonio Diaz Diaz.
+ Copyright (C) 2009, 2010, 2011, 2012 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,15 +44,15 @@ public:
const long long mp, const long long ms )
: dblock_( dp, ds ), mblock_( mp, ms ) {}
- const Block & dblock() const throw() { return dblock_; }
- Block & dblock() throw() { return dblock_; }
- const Block & mblock() const throw() { return mblock_; }
- Block & mblock() throw() { return mblock_; }
+ const Block & dblock() const { return dblock_; }
+ Block & dblock() { return dblock_; }
+ const Block & mblock() const { return mblock_; }
+ Block & mblock() { return mblock_; }
};
int seek_read( const int fd, uint8_t * const buf, const int size,
- const long long pos ) throw()
+ const long long pos )
{
if( lseek( fd, pos, SEEK_SET ) == pos )
return readblock( fd, buf, size );
@@ -95,30 +95,28 @@ public:
member_vector[i+1].dblock().pos( member_vector[i].dblock().end() );
}
- long long data_end() const throw()
+ long long data_end() const
{ if( member_vector.size() ) return member_vector.back().dblock().end();
else return 0; }
- const Member & member( const int i ) const throw()
- { return member_vector[i]; }
- const Block & dblock( const int i ) const throw()
+ const Member & member( const int i ) const { return member_vector[i]; }
+ const Block & dblock( const int i ) const
{ return member_vector[i].dblock(); }
- const Block & mblock( const int i ) const throw()
+ const Block & mblock( const int i ) const
{ return member_vector[i].mblock(); }
- int members() const throw() { return (int)member_vector.size(); }
+ int members() const { return (int)member_vector.size(); }
};
// Returns the number of chars read, or 0 if error.
//
-int parse_long_long( const char * const ptr, long long & value ) throw()
+int parse_long_long( const char * const ptr, long long & value )
{
char * tail;
- int c = 0;
errno = 0;
value = strtoll( ptr, &tail, 0 );
if( tail == ptr || errno ) return 0;
- c = tail - ptr;
+ int c = tail - ptr;
if( ptr[c] )
{
@@ -133,8 +131,8 @@ int parse_long_long( const char * const ptr, long long & value ) throw()
case 'T': exponent = 4; break;
case 'G': exponent = 3; break;
case 'M': exponent = 2; break;
- case 'K': if( factor == 1024 ) exponent = 1; break;
- case 'k': if( factor == 1000 ) exponent = 1; break;
+ case 'K': if( factor == 1024 ) exponent = 1; else return 0; break;
+ case 'k': if( factor == 1000 ) exponent = 1; else return 0; break;
}
if( exponent > 0 )
{
@@ -154,7 +152,7 @@ int parse_long_long( const char * const ptr, long long & value ) throw()
// Recognized formats: <begin> <begin>-<end> <begin>,<size>
//
-void parse_range( const char * const ptr, Block & range ) throw()
+void parse_range( const char * const ptr, Block & range )
{
long long value = 0;
int c = parse_long_long( ptr, value ); // pos
@@ -176,7 +174,7 @@ void parse_range( const char * const ptr, Block & range ) throw()
}
-bool safe_seek( const int fd, const long long pos ) throw()
+bool safe_seek( const int fd, const long long pos )
{
if( lseek( fd, pos, SEEK_SET ) == pos ) return true;
show_error( "Seek error", errno ); return false;