summaryrefslogtreecommitdiff
path: root/src/textbuf_gui.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-10-22 19:12:10 +0000
committersmatz <smatz@openttd.org>2008-10-22 19:12:10 +0000
commitc10f7db5760594b1166872746eb0769232ed7b77 (patch)
tree43f6f4d436dced1e168f6a66c84f0027a6db24bd /src/textbuf_gui.h
parent6bc0f0ef922c316d2a5de4f3ee9c70e4cc7131de (diff)
downloadopenttd-c10f7db5760594b1166872746eb0769232ed7b77.tar.xz
(svn r14514) -Codechange: use 'size' instead of 'length' for querystring and textbuf, explicitly say it includes the terminating zero
-Fix: one couldn't rename things with too long default/automatic name -Fix: buffer overflow in console when too long (1024 bytes) command was entered
Diffstat (limited to 'src/textbuf_gui.h')
-rw-r--r--src/textbuf_gui.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h
index 7d91b67e7..26ae37a59 100644
--- a/src/textbuf_gui.h
+++ b/src/textbuf_gui.h
@@ -11,12 +11,12 @@
#include "core/enum_type.hpp"
struct Textbuf {
- char *buf; ///< buffer in which text is saved
- uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
- uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
- bool caret; ///< is the caret ("_") visible or not
- uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
- uint16 caretxoffs; ///< the current position of the caret in pixels
+ char *buf; ///< buffer in which text is saved
+ uint16 maxsize, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxsize is in bytes (including terminating '\0')
+ uint16 size, width; ///< the current size of the string. Width specifies screensize in pixels, size is in bytes
+ bool caret; ///< is the caret ("_") visible or not
+ uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
+ uint16 caretxoffs; ///< the current position of the caret in pixels
};
bool HandleCaret(Textbuf *tb);
@@ -26,7 +26,7 @@ bool DeleteTextBufferChar(Textbuf *tb, int delmode);
bool InsertTextBufferChar(Textbuf *tb, uint32 key);
bool InsertTextBufferClipboard(Textbuf *tb);
bool MoveTextBufferPos(Textbuf *tb, int navmode);
-void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth);
+void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 maxsize, uint16 maxwidth);
void UpdateTextBufferSize(Textbuf *tb);
/** Flags used in ShowQueryString() call */