mirror of
https://github.com/ksherlock/dict.git
synced 2024-06-14 01:29:29 +00:00
buffer allocation was wrong which caused excess allocations
it also may have written past the end of the buffer and lost characters (including formatting characters, resulting in display glitches).
This commit is contained in:
parent
8085d2c934
commit
1155573111
6
nda.c
6
nda.c
|
@ -106,7 +106,7 @@ void AppendText(word length, char *cp) {
|
||||||
size = TextHandleUsed + length;
|
size = TextHandleUsed + length;
|
||||||
if (size > TextHandleSize) {
|
if (size > TextHandleSize) {
|
||||||
size += 4095;
|
size += 4095;
|
||||||
size &= ~4096;
|
size &= ~4095;
|
||||||
|
|
||||||
if (h) {
|
if (h) {
|
||||||
HUnlock(h);
|
HUnlock(h);
|
||||||
|
@ -153,7 +153,7 @@ void SetText(void) {
|
||||||
longword oldStart, oldEnd;
|
longword oldStart, oldEnd;
|
||||||
|
|
||||||
TESetSelection((Pointer)-1, (Pointer)-1, TECtrlHandle);
|
TESetSelection((Pointer)-1, (Pointer)-1, TECtrlHandle);
|
||||||
TESetText(teDataIsTextBox2|teTextIsPtr, (Ref)*TextHandle, TextHandleUsed, NULL, NULL, TECtrlHandle);
|
TESetText(teDataIsTextBox2|teTextIsPtr, (Ref)*TextHandle, TextHandleUsed, 0, NULL, TECtrlHandle);
|
||||||
|
|
||||||
|
|
||||||
TextHandleUsed = 0;
|
TextHandleUsed = 0;
|
||||||
|
@ -540,7 +540,7 @@ void DoDefine(void) {
|
||||||
|
|
||||||
handle = (Handle)GetCtlHandleFromID(MyWindow, rCtrlTE);
|
handle = (Handle)GetCtlHandleFromID(MyWindow, rCtrlTE);
|
||||||
|
|
||||||
TESetText(teDataIsTextBlock, (Ref)"", 0, NULL, NULL, handle);
|
TESetText(teDataIsTextBlock|teTextIsPtr, (Ref)"", 0, 0, NULL, handle);
|
||||||
|
|
||||||
GetLETextByID(MyWindow, rCtrlLE, (StringPtr)word_to_define);
|
GetLETextByID(MyWindow, rCtrlLE, (StringPtr)word_to_define);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user