+
+ block_start=read_pointer+block->get_discarded_bytes();
+ block_end=block_start+block->get_raw_size()-1;
+ read_pointer=block_end+1;
+ //printf("Discarded:%2x, Raw Size:%2x\n",block->get_discarded_bytes(),block->get_raw_size());
+ switch(block->get_state()){ // switchy
+ case tape_block::TBS_EOF_LEGAL:
+ delete block;
+ if (!in_object){
+ fprintf(stderr,"File successfully read.\n");
+ } else {
+ if (cfg_ignore_object_integrity_errors){
+ fprintf(stderr,"Warning: Object integrity check failed!\n");
+ warnings++;
+ } else {
+ fprintf(stderr,"Error: Object integrity check failed!\n");
+ errors++;
+ errcode=6;
+ }
+ }
+ read_ahead=false;
+ break;
+ case tape_block::TBS_EOF_ILLEGAL:
+ delete block;
+ if (cfg_ignoreblock_errors){
+ fprintf(stderr,"Warning: Block integrity check failed!\n");
+ warnings++;
+ } else {
+ fprintf(stderr,"Error: Block integrity check failed!\n");
+ errors++;
+ errcode=3;
+ }
+ read_ahead=false;
+ break;
+ case tape_block::TBS_CHECKSUM:
+ delete block;
+ char buffer[200];
+ snprintf(buffer,200,"Block No. %3i: Start(hex):%5x End(hex):%5x Size(hex):%3x\n",
+ blocks_read-1,
+ block_start,
+ block_end,
+ block->get_raw_size());
+ if (cfg_ignorechecksum_errors){
+ char buffer[200];
+ snprintf(buffer,200,"Block No. %3i: Start(hex):%5x End(hex):%5x Size(hex):%3x\n",
+ blocks_read-1,
+ block_start,
+ block_end,
+ block->get_raw_size());
+ write (out_fd,buffer,strlen(buffer));
+ fprintf(stderr,"Warning: Block checksum wrong!\n");
+ fprintf(stderr,buffer);
+ warnings++;
+ } else {
+ fprintf(stderr,"Error: Block checksum wrong!\n");
+ fprintf(stderr,buffer);
+ errors++;
+ read_ahead=false;
+ errcode=4;
+ }
+ break;
+ case tape_block::TBS_DEFAULT:
+ delete block;
+ fprintf(stderr,"TBS_DEFAULT encountered ->> SEVERE INTERNAL ERROR!\n");
+ errors++;
+ errcode=100;
+ read_ahead=false;
+ break;
+ case tape_block::TBS_IOERR:
+ delete block;
+ if (in_fd){
+ fprintf(stderr,"Error: Could not read from \"%s\"!\n",cfg_infile.c_str());
+ } else {
+ fprintf(stderr,"Error: Could not read from stdin!\n");
+ }
+ errors++;
+ read_ahead=false;
+ errcode=2;
+ case tape_block::TBS_OK: