1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
|
Description: remove deprecated throw specification
Just remove those.
Author: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Bug-Debian: https://bugs.debian.org/984415
Forwarded: no
Last-Update: 2021-11-07
---
--- zbackup-1.5.orig/file.cc
+++ zbackup-1.5/file.cc
@@ -24,7 +24,7 @@ enum
WriteBufferSize = 65536
};
-bool File::exists( char const * filename ) throw()
+bool File::exists( char const * filename )
{
#ifdef __WIN32
struct _stat buf;
@@ -37,7 +37,7 @@ bool File::exists( char const * filename
#endif
}
-bool File::special( string const & filename ) throw()
+bool File::special( string const & filename )
{
bool special = false;
#ifndef __WIN32
@@ -56,15 +56,14 @@ bool File::special( string const & filen
return special;
}
-void File::erase( std::string const & filename ) throw( exCantErase )
+void File::erase( std::string const & filename )
{
if ( remove( filename.c_str() ) != 0 )
throw exCantErase( filename );
}
void File::rename( std::string const & from,
- std::string const & to ) throw( exCantRename,
- exCantErase )
+ std::string const & to )
{
int res = 0;
res = ::rename( from.c_str(), to.c_str() );
@@ -115,7 +114,7 @@ void File::rename( std::string const & f
}
}
-void File::open( char const * filename, OpenMode mode ) throw( exCantOpen )
+void File::open( char const * filename, OpenMode mode )
{
char const * m;
@@ -137,7 +136,7 @@ void File::open( char const * filename,
throw exCantOpen( std::string( filename ) + ": " + strerror( errno ) );
}
-void File::open( int fd, OpenMode mode ) throw( exCantOpen )
+void File::open( int fd, OpenMode mode )
{
char const * m;
@@ -159,25 +158,23 @@ void File::open( int fd, OpenMode mode )
throw exCantOpen( "fd#" + Utils::numberToString( fd ) + ": " + strerror( errno ) );
}
-File::File( char const * filename, OpenMode mode ) throw( exCantOpen ):
+File::File( char const * filename, OpenMode mode ):
writeBuffer( 0 )
{
open( filename, mode );
}
File::File( std::string const & filename, OpenMode mode )
- throw( exCantOpen ): writeBuffer( 0 )
{
open( filename.c_str(), mode );
}
File::File( int fd, OpenMode mode )
- throw( exCantOpen ): writeBuffer( 0 )
{
open( fd, mode );
}
-void File::read( void * buf, size_t size ) throw( exReadError, exWriteError )
+void File::read( void * buf, size_t size )
{
if ( !size )
return;
@@ -196,7 +193,7 @@ void File::read( void * buf, size_t size
}
}
-size_t File::readRecords( void * buf, size_t size, size_t count ) throw( exWriteError )
+size_t File::readRecords( void * buf, size_t size, size_t count )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -204,7 +201,7 @@ size_t File::readRecords( void * buf, si
return fread( buf, size, count, f );
}
-void File::write( void const * buf, size_t size ) throw( exWriteError )
+void File::write( void const * buf, size_t size )
{
if ( !size )
return;
@@ -250,7 +247,6 @@ void File::write( void const * buf, size
}
size_t File::writeRecords( void const * buf, size_t size, size_t count )
- throw( exWriteError )
{
flushWriteBuffer();
@@ -258,7 +254,6 @@ size_t File::writeRecords( void const *
}
char * File::gets( char * s, int size, bool stripNl )
- throw( exWriteError )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -285,7 +280,7 @@ char * File::gets( char * s, int size, b
return result;
}
-std::string File::gets( bool stripNl ) throw( exReadError, exWriteError )
+std::string File::gets( bool stripNl )
{
char buf[ 1024 ];
@@ -300,7 +295,7 @@ std::string File::gets( bool stripNl ) t
return std::string( buf );
}
-void File::seek( long offset ) throw( exSeekError, exWriteError )
+void File::seek( long offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -309,7 +304,7 @@ void File::seek( long offset ) throw( ex
throw exSeekError();
}
-void File::seekCur( long offset ) throw( exSeekError, exWriteError )
+void File::seekCur( long offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -318,7 +313,7 @@ void File::seekCur( long offset ) throw(
throw exSeekError();
}
-void File::seekEnd( long offset ) throw( exSeekError, exWriteError )
+void File::seekEnd( long offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -327,12 +322,12 @@ void File::seekEnd( long offset ) throw(
throw exSeekError();
}
-void File::rewind() throw( exSeekError, exWriteError )
+void File::rewind()
{
seek( 0 );
}
-size_t File::tell() throw( exSeekError )
+size_t File::tell()
{
long result = ftell( f );
@@ -345,7 +340,7 @@ size_t File::tell() throw( exSeekError )
return ( size_t ) result;
}
-size_t File::size() throw( exSeekError, exWriteError )
+size_t File::size()
{
size_t cur = tell();
seekEnd( 0 );
@@ -355,7 +350,7 @@ size_t File::size() throw( exSeekError,
return result;
}
-bool File::eof() throw( exWriteError )
+bool File::eof()
{
if ( writeBuffer )
flushWriteBuffer();
@@ -363,21 +358,21 @@ bool File::eof() throw( exWriteError )
return feof( f );
}
-int File::error() throw( exReadError )
+int File::error()
{
int result = ferror( f );
return result;
}
-FILE * File::file() throw( exWriteError )
+FILE * File::file()
{
flushWriteBuffer();
return f;
}
-FILE * File::release() throw( exWriteError )
+FILE * File::release()
{
releaseWriteBuffer();
@@ -388,12 +383,12 @@ FILE * File::release() throw( exWriteErr
return c;
}
-void File::close() throw( exWriteError )
+void File::close()
{
fclose( release() );
}
-File::~File() throw()
+File::~File()
{
if ( f )
{
@@ -408,7 +403,7 @@ File::~File() throw()
}
}
-void File::flushWriteBuffer() throw( exWriteError )
+void File::flushWriteBuffer()
{
if ( writeBuffer && writeBufferLeft != WriteBufferSize )
{
@@ -421,7 +416,7 @@ void File::flushWriteBuffer() throw( exW
}
}
-void File::releaseWriteBuffer() throw( exWriteError )
+void File::releaseWriteBuffer()
{
flushWriteBuffer();
@@ -459,11 +454,11 @@ void File::exReadErrorDetailed::buildDes
description.append( path, pathChars );
}
-const char * File::exReadErrorDetailed::what() const throw()
+const char * File::exReadErrorDetailed::what()
{
return description.c_str();
}
-File::exReadErrorDetailed::~exReadErrorDetailed() throw ()
+File::exReadErrorDetailed::~exReadErrorDetailed()
{
}
--- zbackup-1.5.orig/file.hh
+++ zbackup-1.5/file.hh
@@ -39,30 +39,27 @@ public:
typedef long Offset;
- File( char const * filename, OpenMode )
- throw( exCantOpen );
+ File( char const * filename, OpenMode );
- File( std::string const & filename, OpenMode )
- throw( exCantOpen );
+ File( std::string const & filename, OpenMode );
- File( int fd, OpenMode )
- throw( exCantOpen );
+ File( int fd, OpenMode );
/// Reads the number of bytes to the buffer, throws an error if it
/// failed to fill the whole buffer (short read, i/o error etc)
- void read( void * buf, size_t size ) throw( exReadError, exWriteError );
+ void read( void * buf, size_t size );
template< typename T >
- void read( T & value ) throw( exReadError, exWriteError )
+ void read( T & value )
{ read( &value, sizeof( value ) ); }
template< typename T >
- T read() throw( exReadError, exWriteError )
+ T read()
{ T value; read( value ); return value; }
/// Attempts reading at most 'count' records sized 'size'. Returns
/// the number of records it managed to read, up to 'count'
- size_t readRecords( void * buf, size_t size, size_t count ) throw( exWriteError );
+ size_t readRecords( void * buf, size_t size, size_t count );
/// Writes the number of bytes from the buffer, throws an error if it
/// failed to write the whole buffer (short write, i/o error etc).
@@ -70,81 +67,79 @@ public:
/// end up on disk immediately, or a short write may occur later
/// than it really did. If you don't want write buffering, use
/// writeRecords() function instead
- void write( void const * buf, size_t size ) throw( exWriteError );
+ void write( void const * buf, size_t size );
template< typename T >
- void write( T const & value ) throw( exWriteError )
+ void write( T const & value )
{ write( &value, sizeof( value ) ); }
/// Attempts writing at most 'count' records sized 'size'. Returns
/// the number of records it managed to write, up to 'count'.
/// This function does not employ buffering, but flushes the buffer if it
/// was used before
- size_t writeRecords( void const * buf, size_t size, size_t count )
- throw( exWriteError );
+ size_t writeRecords( void const * buf, size_t size, size_t count );
/// Reads a string from the file. Unlike the normal fgets(), this one
/// can strip the trailing newline character, if this was requested.
/// Returns either s or 0 if no characters were read
- char * gets( char * s, int size, bool stripNl = false ) throw( exWriteError );
+ char * gets( char * s, int size, bool stripNl = false );
/// Like the above, but uses its own local internal buffer (1024 bytes
/// currently), and strips newlines by default
- std::string gets( bool stripNl = true ) throw( exReadError, exWriteError );
+ std::string gets( bool stripNl = true );
/// Seeks in the file, relative to its beginning
- void seek( long offset ) throw( exSeekError, exWriteError );
+ void seek( long offset );
/// Seeks in the file, relative to the current position
- void seekCur( long offset ) throw( exSeekError, exWriteError );
+ void seekCur( long offset );
/// Seeks in the file, relative to the end of file
- void seekEnd( long offset = 0 ) throw( exSeekError, exWriteError );
+ void seekEnd( long offset = 0 );
/// Seeks to the beginning of file
- void rewind() throw( exSeekError, exWriteError );
+ void rewind();
/// Tells the current position within the file, relative to its beginning
- size_t tell() throw( exSeekError );
+ size_t tell();
/// Returns file size
- size_t size() throw( exSeekError, exWriteError );
+ size_t size();
/// Returns true if end-of-file condition is set
- bool eof() throw( exWriteError );
+ bool eof();
/// Returns ferror
- int error() throw( exReadError );
+ int error();
/// Returns the underlying FILE * record, so other operations can be
/// performed on it
- FILE * file() throw( exWriteError );
+ FILE * file();
/// Releases the file handle out of the control of the class. No further
/// operations are valid. The file will not be closed on destruction
- FILE * release() throw( exWriteError );
+ FILE * release();
/// Closes the file. No further operations are valid
- void close() throw( exWriteError );
+ void close();
/// Checks if the file exists or not
- static bool exists( char const * filename ) throw();
+ static bool exists( char const * filename );
- static bool exists( std::string const & filename ) throw()
+ static bool exists( std::string const & filename )
{ return exists( filename.c_str() ); }
/// Returns false when lstat returns stat::st_mode having
/// S_IFREG (filename is a file, or softlink to a file, and
/// is not a socket, fifo, device node, etc.
- static bool special( std::string const & filename ) throw();
+ static bool special( std::string const & filename );
- ~File() throw();
+ ~File();
/// Erases the given file
- static void erase( std::string const & ) throw( exCantErase );
+ static void erase( std::string const & );
/// Renames the given file
static void rename( std::string const & from,
- std::string const & to ) throw( exCantRename,
- exCantErase );
+ std::string const & to );
/// Throwing this class instead of exReadError will make the description
/// include the file name
@@ -155,8 +150,8 @@ public:
public:
exReadErrorDetailed( int fd );
exReadErrorDetailed( FILE * f );
- virtual const char * what() const throw();
- virtual ~exReadErrorDetailed() throw ();
+ virtual const char * what();
+ virtual ~exReadErrorDetailed();
private:
void buildDescription( int fd );
@@ -164,10 +159,10 @@ public:
private:
- void open( char const * filename, OpenMode ) throw( exCantOpen );
- void open( int fd, OpenMode ) throw( exCantOpen );
- void flushWriteBuffer() throw( exWriteError );
- void releaseWriteBuffer() throw( exWriteError );
+ void open( char const * filename, OpenMode );
+ void open( int fd, OpenMode );
+ void flushWriteBuffer();
+ void releaseWriteBuffer();
};
#endif
--- zbackup-1.5.orig/unbuffered_file.cc
+++ zbackup-1.5/unbuffered_file.cc
@@ -19,7 +19,6 @@
UnbufferedFile::UnbufferedFile( char const * fileName, Mode mode )
- throw( exCantOpen )
{
int flags = ( mode == ReadWrite ? ( O_RDWR | O_CREAT ) :
@@ -33,7 +32,6 @@ UnbufferedFile::UnbufferedFile( char con
}
size_t UnbufferedFile::read( void * buf, size_t size )
- throw( exReadError )
{
char * next = ( char * ) buf;
size_t left = size;
@@ -61,7 +59,6 @@ size_t UnbufferedFile::read( void * buf,
}
void UnbufferedFile::write( void const * buf, size_t size )
- throw( exWriteError )
{
char const * next = ( char const * ) buf;
size_t left = size;
@@ -83,7 +80,7 @@ void UnbufferedFile::write( void const *
}
}
-UnbufferedFile::Offset UnbufferedFile::size() throw( exSeekError )
+UnbufferedFile::Offset UnbufferedFile::size()
{
Offset cur = lseek64( fd, 0, SEEK_CUR );
if ( cur < 0 )
@@ -94,19 +91,19 @@ UnbufferedFile::Offset UnbufferedFile::s
return result;
}
-void UnbufferedFile::seekCur( Offset offset ) throw( exSeekError )
+void UnbufferedFile::seekCur( Offset offset )
{
if ( lseek64( fd, offset, SEEK_CUR ) < 0 )
throw exSeekError();
}
-void UnbufferedFile::seek( Offset offset ) throw( exSeekError )
+void UnbufferedFile::seek( Offset offset )
{
if ( lseek64( fd, offset, SEEK_SET ) < 0 )
throw exSeekError();
}
-UnbufferedFile::~UnbufferedFile() throw()
+UnbufferedFile::~UnbufferedFile()
{
close( fd );
}
--- zbackup-1.5.orig/unbuffered_file.hh
+++ zbackup-1.5/unbuffered_file.hh
@@ -38,26 +38,26 @@ public:
typedef int64_t Offset;
/// Opens the given file
- UnbufferedFile( char const * fileName, Mode ) throw( exCantOpen );
+ UnbufferedFile( char const * fileName, Mode );
/// Reads up to 'size' bytes into the buffer. Returns the number of bytes
/// read. If the value returned is less than the 'size' provided, the end of
/// file was reached
- size_t read( void * buf, size_t size ) throw( exReadError );
+ size_t read( void * buf, size_t size );
/// Writes 'size' bytes
- void write( void const * buf, size_t size ) throw( exWriteError );
+ void write( void const * buf, size_t size );
/// Returns file size
- Offset size() throw( exSeekError );
+ Offset size();
/// Seeks to the given offset, relative to the current file offset
- void seekCur( Offset ) throw( exSeekError );
+ void seekCur( Offset );
/// Seeks to the given offset, relative to the beginning
- void seek( Offset ) throw( exSeekError );
+ void seek( Offset );
- ~UnbufferedFile() throw();
+ ~UnbufferedFile();
private:
int fd;
|