Author: hbelusca
Date: Wed Jul 13 15:50:44 2016
New Revision: 71924

URL: http://svn.reactos.org/svn/reactos?rev=71924&view=rev
Log:
[CHARMAP]
Don't overrun FillGrid() when accessing the last elements. Rewrite the code 
using 'for' loops, in the same style as what is done elsewhere in the code. CID 
1363552
CORE-11597 #resolve

Modified:
    trunk/reactos/base/applications/charmap/map.c

Modified: trunk/reactos/base/applications/charmap/map.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/charmap/map.c?rev=71924&r1=71923&r2=71924&view=diff
==============================================================================
--- trunk/reactos/base/applications/charmap/map.c       [iso-8859-1] (original)
+++ trunk/reactos/base/applications/charmap/map.c       [iso-8859-1] Wed Jul 13 
15:50:44 2016
@@ -107,8 +107,9 @@
     i = XCELLS * infoPtr->iYStart;
 
     added = 0;
-    x = y = 0;
-    while ((y <= YCELLS) && (x <= XCELLS))
+
+    for (y = 0; y < YCELLS; y++)
+    for (x = 0; x < XCELLS; x++)
     {
         ch = (WCHAR)infoPtr->ValidGlyphs[i];
 
@@ -131,14 +132,6 @@
 
         i++;
         ch = (WCHAR)i;
-
-        // move to the next cell
-        x++;
-        if (x > XCELLS - 1)
-        {
-            x = 0;
-            y++;
-        }
     }
     SelectObject(ps->hdc,
                  hOldFont);


Reply via email to