]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - windows/window.c
Fix divide overflow in internal_mod(). Thanks to William Petiot for
[PuTTY.git] / windows / window.c
index fe90483ec23f97711c27657c7adcd3b71349c229..b0d7d5c25f5c24651dae3b5d002520c3f9642efc 100644 (file)
@@ -158,7 +158,7 @@ static enum {
 } und_mode;
 static int descent;
 
-#define NCFGCOLOURS 24
+#define NCFGCOLOURS 22
 #define NEXTCOLOURS 240
 #define NALLCOLOURS (NCFGCOLOURS + NEXTCOLOURS)
 static COLORREF colours[NALLCOLOURS];
@@ -635,7 +635,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
      * Initialise the terminal. (We have to do this _after_
      * creating the window, since the terminal is the first thing
      * which will call schedule_timer(), which will in turn call
-     * timer_change_notify() which will expect hwnd to exist.
+     * timer_change_notify() which will expect hwnd to exist.)
      */
     term = term_init(&cfg, &ucsdata, NULL);
     logctx = log_init(NULL, &cfg);
@@ -2295,10 +2295,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                HBRUSH fillcolour, oldbrush;
                HPEN   edge, oldpen;
                fillcolour = CreateSolidBrush (
-                                   colours[(ATTR_DEFBG>>ATTR_BGSHIFT)*2]);
+                                   colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
                oldbrush = SelectObject(hdc, fillcolour);
                edge = CreatePen(PS_SOLID, 0, 
-                                   colours[(ATTR_DEFBG>>ATTR_BGSHIFT)*2]);
+                                   colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
                oldpen = SelectObject(hdc, edge);
 
                /*
@@ -3234,7 +3234,7 @@ void do_cursor(Context ctx, int x, int y, wchar_t *text, int len,
        if (attr & TATTR_ACTCURS) {
            HPEN oldpen;
            oldpen =
-               SelectObject(hdc, CreatePen(PS_SOLID, 0, colours[23]));
+               SelectObject(hdc, CreatePen(PS_SOLID, 0, colours[261]));
            MoveToEx(hdc, startx, starty, NULL);
            LineTo(hdc, startx + dx * length, starty + dy * length);
            oldpen = SelectObject(hdc, oldpen);
@@ -3242,7 +3242,7 @@ void do_cursor(Context ctx, int x, int y, wchar_t *text, int len,
        } else {
            for (i = 0; i < length; i++) {
                if (i % 2 == 0) {
-                   SetPixel(hdc, startx, starty, colours[23]);
+                   SetPixel(hdc, startx, starty, colours[261]);
                }
                startx += dx;
                starty += dy;