summaryrefslogtreecommitdiff
path: root/src/win32.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-10-22 20:23:50 +0000
committersmatz <smatz@openttd.org>2008-10-22 20:23:50 +0000
commit1e7e5fb17567c09f23e4d8418c7783b889898c8a (patch)
treefd4c67715a8eaa696fce171d53c7814b7829b82e /src/win32.cpp
parentf43dc3e758d9183881833f2404272b5652578b31 (diff)
downloadopenttd-1e7e5fb17567c09f23e4d8418c7783b889898c8a.tar.xz
(svn r14518) -Fix (r14514): forgot win32 and OS/2 files (glx)
Diffstat (limited to 'src/win32.cpp')
-rw-r--r--src/win32.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/win32.cpp b/src/win32.cpp
index 4c33bfbd4..fffb6e6ca 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -1138,7 +1138,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (!IsPrintable(c)) break;
byte len = Utf8CharLen(c);
- if (tb->length + length >= tb->maxlength - len) break;
+ if (tb->size + length + len > tb->maxsize) break;
byte charwidth = GetCharacterWidth(FS_NORMAL, c);
if (tb->maxwidth != 0 && width + tb->width + charwidth > tb->maxwidth) break;
@@ -1149,15 +1149,15 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (length == 0) return false;
- memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->length - tb->caretpos);
+ memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->size - tb->caretpos);
memcpy(tb->buf + tb->caretpos, utf8_buf, length);
tb->width += width;
tb->caretxoffs += width;
- tb->length += length;
+ tb->size += length;
tb->caretpos += length;
- assert(tb->length < tb->maxlength);
- tb->buf[tb->length] = '\0'; // terminating zero
+ assert(tb->size <= tb->maxsize);
+ tb->buf[tb->size - 1] = '\0'; // terminating zero
return true;
}