--- a/yapf/str.hpp Sun Dec 31 23:48:04 2006 +0000
+++ b/yapf/str.hpp Mon Jan 01 01:43:40 2007 +0000
@@ -4,6 +4,7 @@
#define STR_HPP
#include <errno.h>
+#include <stdarg.h>
#include "blob.hpp"
#include "strapi.hpp"
@@ -15,17 +16,20 @@
{
typedef CBlobT<Tchar> base;
typedef CStrApiT<Tchar, TcaseInsensitive> Api;
+ typedef typename base::size_t size_t;
+ typedef typename base::OnTransfer OnTransfer;
+
FORCEINLINE CStrT(const Tchar* str = NULL) {AppendStr(str);}
- FORCEINLINE CStrT(const Tchar* str, size_t num_chars) : base(str, num_chars) {FixTail();}
- FORCEINLINE CStrT(const Tchar* str, const Tchar* end) : base(str, end - str) {FixTail();}
- FORCEINLINE CStrT(const CBlobBaseSimple& src) : base(src) {FixTail();}
+ FORCEINLINE CStrT(const Tchar* str, size_t num_chars) : base(str, num_chars) {base::FixTail();}
+ FORCEINLINE CStrT(const Tchar* str, const Tchar* end) : base(str, end - str) {base::FixTail();}
+ FORCEINLINE CStrT(const CBlobBaseSimple& src) : base(src) {base::FixTail();}
/** Take ownership constructor */
- FORCEINLINE CStrT(OnTransfer& ot) : base(ot) {}
- FORCEINLINE Titem* GrowSizeNC(size_t count) {Titem* ret = base::GrowSizeNC(count); FixTail(); return ret;}
- FORCEINLINE void AppendStr(const Tchar* str) {if (str != NULL && str[0] != '\0') base::Append(str, (size_t)Api::StrLen(str)); FixTail();}
- FORCEINLINE CStrT& operator = (const Tchar* src) {Clear(); Append(src); return *this;}
- FORCEINLINE bool operator < (const CStrT &other) const {return (Api::StrCmp(Data(), other.Data()) < 0);}
+ FORCEINLINE CStrT(const OnTransfer& ot) : base(ot) {}
+ FORCEINLINE Tchar* GrowSizeNC(size_t count) {Tchar* ret = base::GrowSizeNC(count); base::FixTail(); return ret;}
+ FORCEINLINE void AppendStr(const Tchar* str) {if (str != NULL && str[0] != '\0') base::Append(str, (size_t)Api::StrLen(str)); base::FixTail();}
+ FORCEINLINE CStrT& operator = (const Tchar* src) {base::Clear(); Append(src); return *this;}
+ FORCEINLINE bool operator < (const CStrT &other) const {return (Api::StrCmp(base::Data(), other.Data()) < 0);}
int FormatL(const Tchar *fmt, va_list args)
{
@@ -35,14 +39,14 @@
int ret;
do {
Tchar *buf = MakeFreeSpace(addSize);
- ret = Api::SPrintFL(buf, GetReserve(), fmt, args);
+ ret = Api::SPrintFL(buf, base::GetReserve(), fmt, args);
addSize *= 2;
} while(ret < 0 && (errno == ERANGE || errno == 0));
if (ret > 0) {
GrowSizeNC(ret);
} else {
- int err = errno;
- FixTail();
+// int err = errno;
+ base::FixTail();
}
return ret;
}