Changeset - r16731:8a32ed5c0818
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-12-12 01:21:02
rubidium@openttd.org
(svn r21474) -Fix: some MSVC code analysis warnings in strgen
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/strgen/strgen.cpp
Show inline comments
 
@@ -73,13 +73,13 @@ static LanguagePackHeader _lang; ///< He
 

	
 

	
 
#define HASH_SIZE 32767
 
static uint16 _hash_head[HASH_SIZE];
 

	
 
static byte _put_buf[4096];
 
static int _put_pos;
 
static uint _put_pos;
 
static int _next_string_id;
 

	
 
static uint32 _hash;
 

	
 
static const char *_cur_ident;
 

	
 
@@ -175,13 +175,13 @@ void NORETURN CDECL error(const char *s,
 
	}
 
	exit(1);
 
}
 

	
 
static void PutByte(byte c)
 
{
 
	if (_put_pos == lengthof(_put_buf)) error("Put buffer too small");
 
	if (_put_pos >= lengthof(_put_buf)) error("Put buffer too small");
 
	_put_buf[_put_pos++] = c;
 
}
 

	
 

	
 
static void PutUtf8(uint32 value)
 
{
 
@@ -412,12 +412,13 @@ static const CmdStruct *FindCmd(const ch
 
}
 

	
 
static uint ResolveCaseName(const char *str, uint len)
 
{
 
	/* First get a clean copy of only the case name, then resolve it. */
 
	char case_str[CASE_GENDER_LEN];
 
	len = min(lengthof(case_str) - 1, len);
 
	memcpy(case_str, str, len);
 
	case_str[len] = '\0';
 

	
 
	uint8 case_idx = _lang.GetCaseIndex(case_str);
 
	if (case_idx >= MAX_NUM_CASES) error("Invalid case-name '%s'", case_str);
 
	return case_idx + 1;
 
@@ -1121,13 +1122,13 @@ static void WriteLangfile(const char *fi
 
				/* Count the number of cases */
 
				for (num = 0, c = casep; c; c = c->next) num++;
 
				PutByte(num);
 

	
 
				/* Write each case */
 
				for (c = casep; c != NULL; c = c->next) {
 
					int pos;
 
					uint pos;
 

	
 
					PutByte(c->caseidx);
 
					/* Make some space for the 16-bit length */
 
					pos = _put_pos;
 
					PutByte(0);
 
					PutByte(0);
0 comments (0 inline, 0 general)