@ -82,7 +82,7 @@ Status ReadBlock(RandomAccessFile* file,
}
}
if ( contents . size ( ) ! = n + kBlockTrailerSize ) {
if ( contents . size ( ) ! = n + kBlockTrailerSize ) {
delete [ ] buf ;
delete [ ] buf ;
return Status : : Corruption ( " truncated block read " ) ;
return Status : : Corruption ( " truncated block read " , file - > GetName ( ) ) ;
}
}
// Check the crc of the type and the block contents
// Check the crc of the type and the block contents
@ -92,7 +92,7 @@ Status ReadBlock(RandomAccessFile* file,
const uint32_t actual = crc32c : : Value ( data , n + 1 ) ;
const uint32_t actual = crc32c : : Value ( data , n + 1 ) ;
if ( actual ! = crc ) {
if ( actual ! = crc ) {
delete [ ] buf ;
delete [ ] buf ;
s = Status : : Corruption ( " block checksum mismatch " ) ;
s = Status : : Corruption ( " block checksum mismatch " , file - > GetName ( ) ) ;
return s ;
return s ;
}
}
}
}
@ -119,13 +119,13 @@ Status ReadBlock(RandomAccessFile* file,
size_t ulength = 0 ;
size_t ulength = 0 ;
if ( ! port : : Snappy_GetUncompressedLength ( data , n , & ulength ) ) {
if ( ! port : : Snappy_GetUncompressedLength ( data , n , & ulength ) ) {
delete [ ] buf ;
delete [ ] buf ;
return Status : : Corruption ( " corrupted compressed block contents " ) ;
return Status : : Corruption ( " corrupted compressed block contents " , file - > GetName ( ) ) ;
}
}
char * ubuf = new char [ ulength ] ;
char * ubuf = new char [ ulength ] ;
if ( ! port : : Snappy_Uncompress ( data , n , ubuf ) ) {
if ( ! port : : Snappy_Uncompress ( data , n , ubuf ) ) {
delete [ ] buf ;
delete [ ] buf ;
delete [ ] ubuf ;
delete [ ] ubuf ;
return Status : : Corruption ( " corrupted compressed block contents " ) ;
return Status : : Corruption ( " corrupted compressed block contents " , file - > GetName ( ) ) ;
}
}
delete [ ] buf ;
delete [ ] buf ;
result - > data = Slice ( ubuf , ulength ) ;
result - > data = Slice ( ubuf , ulength ) ;
@ -135,7 +135,7 @@ Status ReadBlock(RandomAccessFile* file,
}
}
default :
default :
delete [ ] buf ;
delete [ ] buf ;
return Status : : Corruption ( " bad block type " ) ;
return Status : : Corruption ( " bad block type " , file - > GetName ( ) ) ;
}
}
return Status : : OK ( ) ;
return Status : : OK ( ) ;