Author: fireball
Date: Wed Feb 21 19:44:24 2007
New Revision: 25864
URL:
http://svn.reactos.org/svn/reactos?rev=25864&view=rev
Log:
- Merge 25830 (calc buffer fix)
Modified:
branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.c
branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.h
Modified: branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
==============================================================================
--- branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.c (original)
+++ branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.c Wed Feb 21
19:44:24 2007
@@ -476,18 +476,23 @@
if (!(len = _tcslen(calc.display)))
return 0;
+ if (!(s = calc.display))
+ return 0;
+
+ if (s[len - 1] == TEXT('.') || s[len - 1] == TEXT(','))
+ len--;
+
if (!(hGlobalMemory = GlobalAlloc(GHND, (len + 1) * sizeof(TCHAR))))
return 0;
if (!(pGlobalMemory = GlobalLock(hGlobalMemory)))
return 0;
- if (!(s = calc.display))
- return 0;
-
for (i = 0; i < len; i++)
*pGlobalMemory++ = *s++;
+ pGlobalMemory[len - 1] = 0;
+
GlobalUnlock(hGlobalMemory); // call GetLastError() for exception
handling
if (!OpenClipboard(hWnd))
@@ -496,7 +501,7 @@
if (!EmptyClipboard())
return 0;
- if (!SetClipboardData(CF_TEXT, hGlobalMemory))
+ if (!SetClipboardData(CF_TTEXT, hGlobalMemory))
return 0;
if (!CloseClipboard())
@@ -514,11 +519,11 @@
HGLOBAL hGlobalMemory;
LPTSTR pGlobalMemory;
- if (IsClipboardFormatAvailable(CF_TEXT)) {
+ if (IsClipboardFormatAvailable(CF_TTEXT)) {
if (!OpenClipboard(hWnd))
return 0;
- if (!(hGlobalMemory = GetClipboardData(CF_TEXT)))
+ if (!(hGlobalMemory = GetClipboardData(CF_TTEXT)))
return 0;
if (!(size = GlobalSize(hGlobalMemory)))
Modified: branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/a…
==============================================================================
--- branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.h (original)
+++ branches/ros-branch-0_3_1/reactos/base/applications/calc/winecalc.h Wed Feb 21
19:44:24 2007
@@ -19,6 +19,12 @@
*/
//////////////////////////////////////////////////////////////////
+
+#ifdef UNICODE
+#define CF_TTEXT CF_UNICODETEXT
+#else
+#define CF_TTEXT CF_TEXT
+#endif
// numerics are defined here for easier porting