# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1298073732 0 # Node ID 2b260f4309bb3748cb04d28ccad4c32aee7df04e # Parent f09977bc9b5c1a83a9f17b07b63212798a7d7ff5 Put in a fix for a Visual Studio 2008 crash with a time of 0. Also changed DEBUG to be DWDEBUG so the popup boxes don't fill the screen when making a simple debug build. diff -r f09977bc9b5c -r 2b260f4309bb win/dw.c --- a/win/dw.c Sat Feb 19 00:00:19 2011 +0000 +++ b/win/dw.c Sat Feb 19 00:02:12 2011 +0000 @@ -1551,7 +1551,7 @@ } } -#ifdef DEBUG +#ifdef DWDEBUG long ProcessCustomDraw (LPARAM lParam) { LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; @@ -1965,7 +1965,7 @@ } } } -#ifdef DEBUG +#ifdef DWDEBUG else if ( lem->hdr.code == NM_CUSTOMDRAW ) { dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW from _wndproc (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "Hello"); @@ -2188,7 +2188,7 @@ _resize_notebook_page(tem->hwndFrom, num); } -#ifdef DEBUG +#ifdef DWDEBUG else { /* @@ -7663,11 +7663,22 @@ struct tm curtm; CDATE cdate = *((CDATE *)data); - curtm.tm_mday = cdate.day; - curtm.tm_mon = cdate.month - 1; - curtm.tm_year = cdate.year - 1900; - - strftime(textbuffer, 100, "%x", &curtm); + + /* Safety check... zero dates are crashing + * Visual Studio 2008. -Brian + */ + if(cdate.year > 1900) + { + curtm.tm_mday = cdate.day; + curtm.tm_mon = cdate.month > 0 ? cdate.month - 1 : 0; + curtm.tm_year = cdate.year - 1900; + + strftime(textbuffer, 100, "%x", &curtm); + } + else + { + textbuffer[0] = 0; + } lvi.pszText = textbuffer; lvi.cchTextMax = strlen(textbuffer);