static int readVersion2FormatData(baltzo::Zoneinfo *zoneinfoResult, baltzo::ZoneinfoBinaryHeader *headerResult, bsl::istream& stream) // Read time zone information in the version '2' file format from the // specified 'stream', and load the description into the specified // 'zoneinfoResult', and the header information into the specified // 'headerResult'. Return 0 on success and a non-zero value if 'stream' // does not provide a sequence of bytes consistent with version '2' // Zoneinfo binary format. The 'stream' must refer to the first byte of // the version '2' header (which typically follows the version '\0' format // data in a Zoneinfo binary file). If an error occurs during the // operation, the resulting value of 'zoneinfoResult' is unspecified. { BALL_LOG_SET_CATEGORY(LOG_CATEGORY); int rc = readHeader(headerResult, stream); if (0 != rc) { return rc; // RETURN } bsl::vector<bdlb::BigEndianInt64> transitions; if (0 != readRawArray(&transitions, stream, headerResult->numTransitions())) { BALL_LOG_ERROR << "Error reading transitions from Zoneinfo file." << BALL_LOG_END return -23; // RETURN }
axStatus axFile::readWholeFile ( axIByteArray &out ) { axStatus st; axFileSize cur; st = getPos( cur ); if( !st ) return st; axFileSize filesize; st = getFileSize( filesize ); if( !st ) return st; axSize size; st = ax_safe_assign( size, filesize ); if( !st ) return st; st = out.resize( size ); if( !st ) return st; st = setPos( 0 ); if( !st ) return st; st = readRawArray( out.ptr(), size ); if( !st ) return st; st = setPos( cur ); if( !st ) return st; return 0; }
axStatus axFile::readWholeFile ( axIStringA &out ) { if( ! isValid() ) { assert(false); return axStatus_Std::not_initialized; } axStatus st; axFileSize cur; st = getPos( cur ); if( !st ) return st; axFileSize file_size; st = getFileSize( file_size ); if( !st ) return st; axSize size; st = ax_safe_assign( size, file_size ); if( !st ) return st; st = out.resize( size ); if( !st ) return st; st = setPos( 0 ); if( !st ) return st; st = readRawArray( out._getInternalBufferPtr(), size ); if( !st ) return st; st = setPos( cur ); if( !st ) return st; return 0; }