Use FileReader as var name

This commit is contained in:
Paul Reeves 2023-02-01 20:12:59 +01:00
parent 60206f3b48
commit c092e8fa8f

View File

@ -195,8 +195,9 @@ FB_UDR_EXECUTE_FUNCTION
out->result = 0; out->result = 0;
} }
ifstream File ( in->afilename.str , ios_base::in | ios_base::binary ); std::ifstream FileReader;
if (! File.is_open()) { FileReader.open( in->afilename.str , std::ifstream::binary );
if (! FileReader.is_open()) {
out->result = -2; out->result = -2;
return; return;
} }
@ -211,14 +212,14 @@ FB_UDR_EXECUTE_FUNCTION
vector<char> Buffer (MaxSegmentSize, 0); vector<char> Buffer (MaxSegmentSize, 0);
streamsize DataSize; streamsize DataSize;
while ( File.good() ) { while ( FileReader.good() ) {
File.read( Buffer.data(), Buffer.size() ); FileReader.read( Buffer.data(), Buffer.size() );
DataSize = File.gcount(); DataSize = FileReader.gcount();
Blob->putSegment( status, DataSize, Buffer.data() ); Blob->putSegment( status, DataSize, Buffer.data() );
out->result += DataSize; out->result += DataSize;
// Perhaps test for badbit here? // Perhaps test for badbit here?
} }
if (File.bad()) { // Something went wrong if (FileReader.bad()) { // Something went wrong
// What to do? // What to do?
out->resultNull = FB_TRUE; out->resultNull = FB_TRUE;
// What do we do with the partially written blob? Is cancel enough? // What do we do with the partially written blob? Is cancel enough?