Changeset - r16811:848f3da56fa1
[Not reviewed]
master
0 1 0
rubidium - 13 years ago 2010-12-21 09:29:01
rubidium@openttd.org
(svn r21555) -Fix [FS#4321]: strings for the query window weren't properly terminated to N characters anymore
1 file changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -1314,6 +1314,12 @@ struct QueryStringWindow : public QueryS
 
		GetString(this->edit_str_buf, str, &this->edit_str_buf[max_bytes - 1]);
 
		str_validate(this->edit_str_buf, &this->edit_str_buf[max_bytes - 1], false, true);
 

	
 
		/* Make sure the name isn't too long for the text buffer in the number of
 
		 * characters (not bytes). max_chars also counts the '\0' characters. */
 
		while (Utf8StringLength(this->edit_str_buf) + 1 > max_chars) {
 
			*Utf8PrevChar(this->edit_str_buf + strlen(this->edit_str_buf)) = '\0';
 
		}
 

	
 
		if ((flags & QSF_ACCEPT_UNCHANGED) == 0) this->orig = strdup(this->edit_str_buf);
 

	
 
		this->caption = caption;
0 comments (0 inline, 0 general)