1
0
forked from mirrors/0ad

c_str() and _long=>size_t

This was SVN commit r169.
This commit is contained in:
olsner
2004-03-04 20:27:37 +00:00
parent fa5870bad8
commit 12cea7849a
2 changed files with 9 additions and 6 deletions
+3 -3
View File
@@ -108,7 +108,7 @@ _double CStr::ToDouble() const
}
//You can retrieve the substring within the string
CStr CStr::GetSubstring(_long start, _long len)
CStr CStr::GetSubstring(size_t start, size_t len)
{
return CStr( m_String.substr(start, len) );
}
@@ -398,9 +398,9 @@ ostream &operator<<(ostream &os, CStr &Str)
return os;
}
size_t CStr::GetSerializedLength() const
uint CStr::GetSerializedLength() const
{
return m_String.length()+1;
return uint(m_String.length()+1);
}
u8 *CStr::Serialize(u8 *buffer) const
+6 -3
View File
@@ -38,7 +38,7 @@ More Info:
#include <iostream>
#include "posix.h"
#include "misc.h"
#include "lib.h"
#include "Network/Serialization.h"
#include <cstdlib>
@@ -115,7 +115,7 @@ public:
size_t Length() const {return m_String.length();}
// Retrieves the substring within the string
CStr GetSubstring(_long start, _long len);
CStr GetSubstring(size_t start, size_t len);
//Search the string for another string
_long Find(const CStr &Str);
@@ -172,8 +172,11 @@ public:
TCHAR &operator[](_long n);
TCHAR &operator[](_ulong n);
inline const char *c_str()
{ return m_String.c_str(); }
// Serialization functions
virtual size_t GetSerializedLength() const;
virtual uint GetSerializedLength() const;
virtual u8 *Serialize(u8 *buffer) const;
virtual const u8 *Deserialize(const u8 *buffer, const u8 *bufferend);