2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Renamed member variables
	* src/ByteArrayDiskWriter.cc
	* src/ByteArrayDiskWriter.h
pull/1/head
Tatsuhiro Tsujikawa 2010-06-11 14:43:41 +00:00
parent 158d779141
commit cfad3a2f19
3 changed files with 21 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables
* src/ByteArrayDiskWriter.cc
* src/ByteArrayDiskWriter.h
2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables Renamed member variables

View File

@ -44,7 +44,7 @@ ByteArrayDiskWriter::~ByteArrayDiskWriter() {}
void ByteArrayDiskWriter::clear() void ByteArrayDiskWriter::clear()
{ {
buf.str(A2STR::NIL); _buf.str(A2STR::NIL);
} }
void ByteArrayDiskWriter::initAndOpenFile(uint64_t totalLength) void ByteArrayDiskWriter::initAndOpenFile(uint64_t totalLength)
@ -65,29 +65,29 @@ void ByteArrayDiskWriter::writeData(const unsigned char* data, size_t dataLength
{ {
uint64_t length = size(); uint64_t length = size();
if(length < (uint64_t)position) { if(length < (uint64_t)position) {
buf.seekp(length, std::ios::beg); _buf.seekp(length, std::ios::beg);
for(uint64_t i = length; i < (uint64_t)position; ++i) { for(uint64_t i = length; i < (uint64_t)position; ++i) {
buf.put('\0'); _buf.put('\0');
} }
} else { } else {
buf.seekp(position, std::ios::beg); _buf.seekp(position, std::ios::beg);
} }
buf.write(reinterpret_cast<const char*>(data), dataLength); _buf.write(reinterpret_cast<const char*>(data), dataLength);
} }
ssize_t ByteArrayDiskWriter::readData(unsigned char* data, size_t len, off_t position) ssize_t ByteArrayDiskWriter::readData(unsigned char* data, size_t len, off_t position)
{ {
buf.seekg(position, std::ios::beg); _buf.seekg(position, std::ios::beg);
buf.read(reinterpret_cast<char*>(data), len); _buf.read(reinterpret_cast<char*>(data), len);
buf.clear(); _buf.clear();
return buf.gcount(); return _buf.gcount();
} }
uint64_t ByteArrayDiskWriter::size() uint64_t ByteArrayDiskWriter::size()
{ {
buf.seekg(0, std::ios::end); _buf.seekg(0, std::ios::end);
buf.clear(); _buf.clear();
return buf.tellg(); return _buf.tellg();
} }
} // namespace aria2 } // namespace aria2

View File

@ -42,7 +42,7 @@ namespace aria2 {
class ByteArrayDiskWriter : public DiskWriter { class ByteArrayDiskWriter : public DiskWriter {
private: private:
std::stringstream buf; std::stringstream _buf;
void clear(); void clear();
public: public:
@ -68,12 +68,12 @@ public:
void setString(const std::string& s) void setString(const std::string& s)
{ {
buf.str(s); _buf.str(s);
} }
std::string getString() const std::string getString() const
{ {
return buf.str(); return _buf.str();
} }
}; };