[Box Backup-commit] COMMIT r3475 - box/trunk/lib/common
subversion at boxbackup.org
subversion at boxbackup.org
Mon Dec 22 23:01:51 GMT 2014
Author: chris
Date: 2014-12-22 23:01:50 +0000 (Mon, 22 Dec 2014)
New Revision: 3475
Modified:
box/trunk/lib/common/IOStream.cpp
box/trunk/lib/common/IOStream.h
Log:
Replace Write(const char *) with Write(const std::string&).
This is better for C++ style and potential missing null termination.
Modified: box/trunk/lib/common/IOStream.cpp
===================================================================
--- box/trunk/lib/common/IOStream.cpp 2014-12-22 21:29:24 UTC (rev 3474)
+++ box/trunk/lib/common/IOStream.cpp 2014-12-22 23:01:50 UTC (rev 3475)
@@ -249,13 +249,13 @@
//
// Function
// Name: IOStream::Write
-// Purpose: Convenience method for writing a null-terminated
-// C string to a protocol buffer.
+// Purpose: Convenience method for writing a C++ string to a
+// protocol buffer.
//
// --------------------------------------------------------------------------
-void IOStream::Write(const char *pBuffer)
+void IOStream::Write(const std::string& rBuffer, int Timeout)
{
- Write(pBuffer, strlen(pBuffer));
+ Write(rBuffer.c_str(), rBuffer.size(), Timeout);
}
// --------------------------------------------------------------------------
Modified: box/trunk/lib/common/IOStream.h
===================================================================
--- box/trunk/lib/common/IOStream.h 2014-12-22 21:29:24 UTC (rev 3474)
+++ box/trunk/lib/common/IOStream.h 2014-12-22 23:01:50 UTC (rev 3475)
@@ -49,7 +49,8 @@
virtual pos_type BytesLeftToRead(); // may return IOStream::SizeOfStreamUnknown (and will for most stream types)
virtual void Write(const void *pBuffer, int NBytes,
int Timeout = IOStream::TimeOutInfinite) = 0;
- virtual void Write(const char *pBuffer);
+ virtual void Write(const std::string& rBuffer,
+ int Timeout = IOStream::TimeOutInfinite);
virtual void WriteAllBuffered(int Timeout = IOStream::TimeOutInfinite);
virtual pos_type GetPosition() const;
virtual void Seek(pos_type Offset, int SeekType);
More information about the Boxbackup-commit
mailing list