Author: hbelusca
Date: Sat Aug 1 17:30:17 2015
New Revision: 68587
URL:
http://svn.reactos.org/svn/reactos?rev=68587&view=rev
Log:
[MSPAINT_NEW]
Fix build on MSVC by rewriting the code in *STANDARD* C++ !! (and not into some strange
idiom called "GCC-C++"). I suggest also to write a proper class for
dynamically-allocated (resource) strings instead of either having the static arrays of
hardcoded sizes, or being tempted to use non-standard constructs as the one I just saw.
(and btw, instead of defining a new "SIZEOF()" macro, there is one which already
exists in the PSDK called "ARRAYSIZE()" which just does the correct job).
Modified:
trunk/reactos/base/applications/mspaint_new/winproc.cpp
Modified: trunk/reactos/base/applications/mspaint_new/winproc.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint_…
==============================================================================
--- trunk/reactos/base/applications/mspaint_new/winproc.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint_new/winproc.cpp [iso-8859-1] Sat Aug 1
17:30:17 2015
@@ -196,14 +196,11 @@
{
if (!imageModel.IsImageSaved())
{
- TCHAR* tempptr;
- TCHAR programname[LoadString(hProgInstance, IDS_PROGRAMNAME,
(LPTSTR)&tempptr, 0) + 1];
- CopyMemory(programname, tempptr, sizeof(programname) - sizeof(TCHAR));
- programname[SIZEOF(programname) - 1] = (TCHAR)'\0';
- TCHAR saveprompttext[LoadString(hProgInstance, IDS_SAVEPROMPTTEXT,
(LPTSTR)&tempptr, 0) + 1];
- CopyMemory(saveprompttext, tempptr, sizeof(saveprompttext) - sizeof(TCHAR));
- saveprompttext[SIZEOF(saveprompttext) - 1] = (TCHAR)'\0';
- TCHAR temptext[SIZEOF(saveprompttext) + _tcslen(filename)];
+ TCHAR programname[20];
+ TCHAR saveprompttext[100];
+ TCHAR temptext[500];
+ LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
+ LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, saveprompttext,
SIZEOF(saveprompttext));
_stprintf(temptext, saveprompttext, filename);
switch (MessageBox(temptext, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
{