Aumentata dimensione stringa temporanea per la classe TString

git-svn-id: svn://10.65.10.50/trunk@5335 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-10-07 13:34:36 +00:00
parent 3ae649194c
commit 8314a8a0c3

View File

@ -20,6 +20,7 @@
#include <unistd.h>
#endif
#ifdef FOXPRO
class TString512 : public TFixed_string
{
char _str512[513];
@ -32,6 +33,19 @@ public:
void strncpy(const char* s, int n);
};
#else
class TString512 : public TString
{
public:
TString512() : TString(512) { }
const TString& operator =(const char* s);
const TString& operator =(const TString& s) { return operator =((const char*)s); }
void strncpy(const char* s, int n);
};
#endif
const TString& TString512::operator =(const char* s)
{
#ifdef FOXPRO
@ -52,8 +66,13 @@ void TString512::strncpy(const char* s, int n)
_str = _str512;
_size = 512;
}
#endif
TFixed_string::strncpy(s, n);
#else
if (n > _size)
resize(n, FALSE);
::strncpy(_str, s, n);
_str[n] = '\0';
#endif
}
@ -1237,7 +1256,7 @@ const char* TToken_string::get()
//
// @rdesc Ritorne la stringa identificata dal Token passato come parametro <p n>
const char* TToken_string::get(
int n) // @parm Token da ritornare (-1 = prossimo, -2 = ultimo, n = n-simo)
int n) // @parm Token da ritornare (0 = primo, -1 = prossimo, -2 = ultimo, n = n-simo)
// @syntax const char* get(int n);
// @syntax const char* get();