strcaps cleanup, init overreadval to 0

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6133 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2011-03-19 20:08:51 +00:00
parent 815d6ff0c7
commit 40498772a2
+6 -11
View File
@@ -134,16 +134,11 @@ struct stringformatter
inline char *strcaps(const char *s, bool on)
{
int (*caps)(int t) = (on ? toupper : tolower);
static char r[128];
char *c = (char *)s, *o = r;
int n = 0;
while( *c!='\0' && n < 127)
{
*o = caps(*c);
n++; o++; c++;
}
*o='\0';
static string r;
char *o = r;
if(on) while(*s && o < &r[sizeof(r)-1]) *o++ = toupper(*s++);
else while(*s && o < &r[sizeof(r)-1]) *o++ = tolower(*s++);
*o = '\0';
return r;
}
@@ -216,7 +211,7 @@ struct databuf
const T &get()
{
static T overreadval;
static T overreadval = 0;
if(len<maxlen) return buf[len++];
flags |= OVERREAD;
return overreadval;