From 8382e074e190056f372d2bee3c4a21287ab7e001 Mon Sep 17 00:00:00 2001 From: codemastr Date: Sun, 4 Nov 2001 17:55:10 +0000 Subject: [PATCH] Fixed a win32 bug where the editor would cut off text --- Changes | 1 + src/win32/Win32GUI.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 2f58527e7..aca6e76e5 100644 --- a/Changes +++ b/Changes @@ -891,3 +891,4 @@ seen. gmtime warning still there - Made some nameser.h changes to work win win32 - Fixed a typo in makenet found by 'Eternal Bliss' - Updated module dependancies to allow a module to load the module containing the symbol +- Fixed a win32 bug where the editor would cut off text, reported by Inter diff --git a/src/win32/Win32GUI.c b/src/win32/Win32GUI.c index ad1a085a6..0d066101c 100644 --- a/src/win32/Win32GUI.c +++ b/src/win32/Win32GUI.c @@ -211,8 +211,23 @@ void WipeColors() { } } -DWORD CALLBACK RTFToIRC(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { - int fd = (int)dwCookie; +DWORD CALLBACK BufferIt(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { + char *buf2; + static long size = 0; + buf2 = MyMalloc(size+cb+1); + if (RTFBuf) + memcpy(buf2,RTFBuf,size); + else + size = 0; + memcpy(buf2+size,pbBuff,cb); + size += cb; + MyFree(RTFBuf); + RTFBuf = buf2; + pcb = &cb; + return 0; +} + +DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) { char *buffer = (char *)malloc(cb); int i = 0, j = 0, k = 0, start = 0, end = 0; int incolor = 0, bold = 0, uline = 0; @@ -993,11 +1008,12 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar int fd; EDITSTREAM edit; fd = open(file, _O_TRUNC|_O_CREAT|_O_WRONLY|_O_BINARY,_S_IWRITE); - edit.dwCookie = (DWORD)fd; - edit.pfnCallback = RTFToIRC; + edit.dwCookie = 0; + edit.pfnCallback = BufferIt; SendMessage(GetDlgItem(hDlg, IDC_TEXT), EM_SETSEL, -1, -1); SendMessage(GetDlgItem(hDlg, IDC_TEXT), EM_STREAMOUT, (WPARAM)SF_RTF|SFF_PLAINRTF, (LPARAM)&edit); - close(fd); + RTFToIRC(fd, RTFBuf, strlen(RTFBuf)); + free(RTFBuf); EndDialog(hDlg, TRUE); } hWnd = GetDlgItem(hDlg, IDC_TEXT);