Mercurial > dwindows
changeset 1601:71e0a3ad07f7
Enable level 3 warnings in DEBUG mode with Visual C to show deprecation warnings.
Source code cleanup to eliminate the warnings now generated on this level.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 26 Feb 2012 09:21:35 +0000 |
parents | cbfdd56e3e72 |
children | 02641cd81203 |
files | dw.h dwcompat.c dwcompat.h dwtest.c makefile.vc platform/dirent.h win/dirent.c win/dw.c |
diffstat | 8 files changed, 218 insertions(+), 184 deletions(-) [+] |
line wrap: on
line diff
--- a/dw.h Sat Feb 25 23:35:59 2012 +0000 +++ b/dw.h Sun Feb 26 09:21:35 2012 +0000 @@ -1438,23 +1438,27 @@ /* Visual C */ #if defined(_MSC_VER) -#define DW_DEPRECATED(func, message) __declspec(deprecated(message)) func +# if _MSC_VER >= 1400 +# define DW_DEPRECATED(func, message) __declspec(deprecated(message)) func +# endif /* Clang */ #elif defined(__has_extension) -# if __has_extension(attribute_deprecated_with_message) -# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message))) -# else -# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated)) -# endif +# if __has_extension(attribute_deprecated_with_message) +# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message))) +# else +# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated)) +# endif /* GCC */ #elif defined(__GNUC__) -# if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40500 -# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message))) -# else -# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated)) -# endif -#else +# if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40500 +# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message))) +# else +# define DW_DEPRECATED(func, message) func __attribute__ ((deprecated)) +# endif +#endif + /* Compiler without deprecation support */ +#ifndef DW_DEPRECATED #define DW_DEPRECATED(func, message) func #endif
--- a/dwcompat.c Sat Feb 25 23:35:59 2012 +0000 +++ b/dwcompat.c Sun Feb 26 09:21:35 2012 +0000 @@ -1,10 +1,13 @@ /* $Id$ */ -#include "dwcompat.h" -#include "dw.h" +#ifdef __WIN32__ +#include <direct.h> +#endif #if defined(__OS2__) || defined(__WIN32__) #include <share.h> #endif +#include "dwcompat.h" +#include "dw.h" #if defined(__UNIX__) || defined(__MAC__) #if defined(__FreeBSD__) || defined(__MAC__)
--- a/dwcompat.h Sat Feb 25 23:35:59 2012 +0000 +++ b/dwcompat.h Sun Feb 26 09:21:35 2012 +0000 @@ -198,9 +198,23 @@ #define P_NOWAIT _P_NOWAIT #endif -#define strcasecmp stricmp -#define strncasecmp strnicmp -#define msleep Sleep +#ifdef _MSC_VER +/* Handle deprecated functions in Visual C */ +# if _MSC_VER >= 1400 +# define strcasecmp(a, b) _stricmp(a, b) +# define strncasecmp(a, b, c) _strnicmp(a, b, c) +# define strdup(a) _strdup(a) +# define unlink(a) _unlink(a) +# define close(a) _close(a) +# define mkdir(a) _mkdir(a) +# define fdopen(a, b) _fdopen(a, b) +# define chdir(a) _chdir(a) +# else +# define strcasecmp(a, b) stricmp(a, b) +# define strncasecmp(a, b, c) strnicmp(a, b, c) +# endif +#endif +#define msleep(a) Sleep(a) #endif /* WIN32 */
--- a/dwtest.c Sat Feb 25 23:35:59 2012 +0000 +++ b/dwtest.c Sun Feb 26 09:21:35 2012 +0000 @@ -8,6 +8,12 @@ #include <stdio.h> #include "dw.h" +#ifdef _MSC_VER +# if _MSC_VER >= 1400 +# define strdup(a) _strdup(a) +# endif +#endif + /* Select a fixed width font for our platform */ #ifdef __OS2__ #define FIXEDFONT "5.System VIO"
--- a/makefile.vc Sat Feb 25 23:35:59 2012 +0000 +++ b/makefile.vc Sun Feb 26 09:21:35 2012 +0000 @@ -43,7 +43,9 @@ # Settings for either debug or release # !if "$(DEBUG)" == "Y" -CFLAGS_DEBUG = -DDEBUG -Z7 -Od -MTd # was -Zi +# -D_CRT_SECURE_NO_WARNINGS disables unsafe string function warnings +# These can be perfectly safe if used properly but get enabled by -W3 +CFLAGS_DEBUG = -DDEBUG -Z7 -W3 -Od -MTd -D_CRT_SECURE_NO_WARNINGS # was -Zi LINK_DEBUG = -debug !else CFLAGS_DEBUG = -Ox -MT
--- a/platform/dirent.h Sat Feb 25 23:35:59 2012 +0000 +++ b/platform/dirent.h Sun Feb 26 09:21:35 2012 +0000 @@ -34,14 +34,14 @@ #endif struct dirent { - int d_ino; /* Dummy */ - int d_reclen; /* Dummy, same as d_namlen */ - int d_namlen; /* length of name */ - char d_name[MAXNAMLEN + 1]; - unsigned long d_size; - unsigned short d_attribute; /* attributes (see above) */ - unsigned short d_time; /* modification time */ - unsigned short d_date; /* modification date */ + int d_ino; /* Dummy */ + int d_reclen; /* Dummy, same as d_namlen */ + int d_namlen; /* length of name */ + char d_name[MAXNAMLEN + 1]; + unsigned long long d_size; + unsigned long d_attribute; /* attributes (see above) */ + unsigned short d_time; /* modification time */ + unsigned short d_date; /* modification date */ }; typedef struct _dirdescr DIR;
--- a/win/dirent.c Sat Feb 25 23:35:59 2012 +0000 +++ b/win/dirent.c Sun Feb 26 09:21:35 2012 +0000 @@ -30,7 +30,7 @@ { static char cache[1+26]; char drive[3]; - ULONG unit; + UCHAR unit; char r; if (isalpha(path[0]) && path[1] == ':') { @@ -67,7 +67,7 @@ _chdrive((newdrive - 'A')+1); - if(getcwd(buffer, len)) + if(_getcwd(buffer, len)) { _chdrive(drive); return buffer; @@ -149,8 +149,8 @@ strcpy(dir->entry.d_name, dir->data.cFileName); dir->entry.d_ino = dummy_ino++; - dir->entry.d_reclen = strlen(dir->data.cFileName); - dir->entry.d_namlen = strlen(dir->data.cFileName); + dir->entry.d_reclen = (int)strlen(dir->data.cFileName); + dir->entry.d_namlen = (int)strlen(dir->data.cFileName); dir->entry.d_size = dir->data.nFileSizeLow; dir->entry.d_attribute = dir->data.dwFileAttributes; #if 0
--- a/win/dw.c Sat Feb 25 23:35:59 2012 +0000 +++ b/win/dw.c Sun Feb 26 09:21:35 2012 +0000 @@ -212,7 +212,7 @@ #if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); #endif -BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); +LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); void _resize_notebook_page(HWND handle, int pageid); void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); int _lookup_icon(HWND handle, HICON hicon, int type); @@ -347,7 +347,7 @@ else if(*tmp == ' ' && !inquotes) { *tmp = 0; - argv[loc] = strdup(argstart); + argv[loc] = _strdup(argstart); /* Push past any white space */ while(*(tmp+1) == ' ') @@ -365,7 +365,7 @@ tmp++; } if(*argstart) - argv[loc] = strdup(argstart); + argv[loc] = _strdup(argstart); } argv[loc+1] = NULL; return argv; @@ -447,7 +447,7 @@ /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */ void *_dw_load_gpbitmap( char *filename ) { - int i, wclen = (strlen(filename) + 6) * sizeof(wchar_t); + int i, wclen = (int)(strlen(filename) + 6) * sizeof(wchar_t); char *file = _alloca(strlen(filename) + 6); wchar_t *wfile = _alloca(wclen); void *image; @@ -460,7 +460,7 @@ if ( _access( file, 04 ) == 0 ) { /* Convert to wide format */ - MultiByteToWideChar(CP_ACP, 0, file, strlen(file)+1, wfile, wclen); + MultiByteToWideChar(CP_ACP, 0, file, (int)strlen(file)+1, wfile, wclen); if(!GdipCreateBitmapFromFile(wfile, &image)) return image; } @@ -595,7 +595,7 @@ for(z=0;z<SIGNALMAX;z++) { - if(stricmp(signame, SignalTranslate[z].name) == 0) + if(_stricmp(signame, SignalTranslate[z].name) == 0) return SignalTranslate[z].message; } return 0L; @@ -623,39 +623,39 @@ if(oldicon) DeleteObject(oldicon); - if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) { HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); if(oldbitmap) DeleteObject(oldbitmap); } - if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) { HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); if(oldbitmap) DeleteObject(oldbitmap); } - else if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) + else if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) { Box *box = (Box *)thiscinfo; if(box && box->count && box->items) free(box->items); } - else if(strnicmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) + else if(_strnicmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { void *data = dw_window_get_data(handle, "_dw_percent"); if(data) free(data); } - else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)==0) + else if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)==0) { dw_tree_clear(handle); } - else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL)+1)==0) /* Notebook */ + else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL)+1)==0) /* Notebook */ { NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); @@ -676,7 +676,7 @@ free(array); } } - else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) + else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) { /* for spinbuttons, we need to get the spinbutton's "buddy", the text window associated and destroy it */ ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -770,14 +770,14 @@ /* These are the window classes which can * obtain input focus. */ - if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1)==0 || /* Entryfield */ - strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0 || /* Button */ - strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ - strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1)==0 || /* List box */ - strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ - strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0 || /* Slider */ - strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || /* Container */ - strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */ + if(_strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1)==0 || /* Entryfield */ + _strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0 || /* Button */ + _strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ + _strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1)==0 || /* List box */ + _strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ + _strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0 || /* Slider */ + _strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || /* Container */ + _strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */ return 1; return 0; } @@ -787,14 +787,14 @@ char tmpbuf[100] = {0}; GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ + if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); if(cinfo && cinfo->buddy) return cinfo->buddy; } - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -907,7 +907,7 @@ return 1; } } - else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ + else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ { NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); @@ -925,7 +925,7 @@ } } } - else if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ + else if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA); @@ -1042,7 +1042,7 @@ return 1; } } - else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ + else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ { NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); @@ -1060,7 +1060,7 @@ } } } - else if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ + else if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA); @@ -1087,7 +1087,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)!=0) + if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)!=0) return; @@ -1366,13 +1366,13 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) { /* Handle special case Combobox */ MoveWindow(handle, currentx + pad, currenty + pad, width, height + 400, FALSE); } - else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) + else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) { /* Handle special case Spinbutton */ ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -1462,7 +1462,7 @@ if(percent && width > 0 && height > 0) _handle_splitbar_resize(handle, *percent, type, width, height); } - else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) + else if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) { /* Handle special case Vertically Center static text */ ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -1535,7 +1535,7 @@ } } /* So does the List View... handle delayed cursoring */ - if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0 && width > 10 && height > 10) + if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0 && width > 10 && height > 10) { int index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_cursor")); @@ -1593,7 +1593,7 @@ /*case SB_PAGEDOWN:*/ case SB_PAGERIGHT: pos = si.nPos + si.nPage; - if(pos > (si.nMax - si.nPage) + 1) + if(pos > (int)(si.nMax - si.nPage) + 1) pos = (si.nMax - si.nPage) + 1; return pos; /*case SB_LINEUP:*/ @@ -1605,7 +1605,7 @@ /*case SB_LINEDOWN:*/ case SB_LINERIGHT: pos = si.nPos + 1; - if(pos > (si.nMax - si.nPage) + 1) + if(pos > (int)(si.nMax - si.nPage) + 1) pos = (si.nMax - si.nPage) + 1; return pos; } @@ -1654,13 +1654,13 @@ int is_checked; sprintf( buffer, "_dw_ischecked%d", id ); is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); - is_checked = (is_checked) ? 0 : 1; - dw_menu_item_set_check( window, id, is_checked ); + is_checked = (is_checked) ? DW_MIS_UNCHECKED : DW_MIS_CHECKED; + dw_menu_item_set_state( window, id, is_checked ); } } /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ -BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { int result = -1, taskbar = FALSE; static int command_active = 0; @@ -1843,7 +1843,7 @@ if(origmsg == WM_CHAR && mp1 < 128) ch = (char)mp1; - result = keypressfunc(tmp->window, ch, mp1, special, tmp->data); + result = keypressfunc(tmp->window, ch, (int)mp1, special, tmp->data); tmp = NULL; } } @@ -1889,7 +1889,7 @@ GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); - if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) + if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) { if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) { @@ -1957,7 +1957,7 @@ } } } - else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0) + else if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0) { if((lem->hdr.code == LVN_ITEMCHANGED && (lem->uChanged & LVIF_STATE)) && tmp->message == TVN_SELCHANGED) { @@ -2066,7 +2066,7 @@ GetClassName(hWnd, tmpbuf, 99); } - if (strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0) + if (_strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0) { if (handle == tmp->window) @@ -2082,7 +2082,7 @@ tmp = NULL; } } - else if(strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1)==0) + else if(_strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1)==0) { if(handle == tmp->window) { @@ -2114,7 +2114,7 @@ #ifdef AEROGLASS case WM_DWMCOMPOSITIONCHANGED: { - DWORD styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE); + LONG_PTR styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE); if(_DwmIsCompositionEnabled) _DwmIsCompositionEnabled(&_dw_composition); @@ -2231,7 +2231,7 @@ char tmpbuf[100] = {0}; GetClassName( hWnd, tmpbuf, 99 ); - if ( strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1 ) == 0 ) + if ( _strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1 ) == 0 ) { _HandleScroller(hWnd, bar, (int)HIWORD(mp1), (int)LOWORD(mp1)); } @@ -2293,7 +2293,7 @@ _wndproc(hwnd, msg, (WPARAM)idEvent, 0); } -BOOL CALLBACK _framewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _framewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { switch( msg ) { @@ -2397,9 +2397,9 @@ return DefWindowProc(hWnd, msg, mp1, mp2); } -BOOL CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) -{ - BOOL rcode = TRUE; +LRESULT CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +{ + LRESULT rcode = TRUE; switch( msg ) { @@ -2435,7 +2435,7 @@ return rcode; } -BOOL CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { ColorInfo *cinfo; @@ -2453,7 +2453,7 @@ case WM_RBUTTONDOWN: case WM_KEYDOWN: { - BOOL ret; + LRESULT ret; if(!cinfo || !cinfo->pOldProc) ret = DefWindowProc(hWnd, msg, mp1, mp2); @@ -2475,7 +2475,7 @@ case WM_RBUTTONUP: case WM_KEYUP: { - BOOL ret; + LRESULT ret; if(!cinfo || !cinfo->pOldProc) ret = DefWindowProc(hWnd, msg, mp1, mp2); @@ -2497,7 +2497,7 @@ { if(mp1 == 100) { - BOOL ret; + LRESULT ret; if(cinfo && cinfo->buddy) SendMessage(cinfo->buddy, WM_USER+10, 0, 0); @@ -2548,7 +2548,7 @@ /* These are the window classes which can * obtain input focus. */ - if (strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) + if (_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) { /* Generate click on default item */ SignalHandler *tmp = Root; @@ -2575,12 +2575,12 @@ } /* Subclass function that will handle setting colors on controls */ -BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { ColorInfo *cinfo; char tmpbuf[100] = {0}; WNDPROC pOldProc = 0; - int ret = -1; + LRESULT ret = -1; cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -2810,7 +2810,7 @@ } /* Window procedure for container/listview */ -BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -2964,10 +2964,10 @@ return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2); } -BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { ContainerInfo *cinfo; - int ret = -1; + LRESULT ret = -1; cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -3079,7 +3079,7 @@ } /* This handles any activity on the scrollbox */ -BOOL CALLBACK _scrollwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _scrollwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) { switch (msg) { @@ -3119,7 +3119,7 @@ /*case SB_PAGEUP:*/ case SB_PAGERIGHT: si->nPos = si->nPos + si->nPage; - if(si->nPos > (si->nMax - si->nPage) + 1) + if(si->nPos > (int)(si->nMax - si->nPage) + 1) si->nPos = (si->nMax - si->nPage) + 1; break; /*case SB_LINEDOWN:*/ @@ -3131,7 +3131,7 @@ /*case SB_LINEUP:*/ case SB_LINERIGHT: si->nPos = si->nPos + 1; - if(si->nPos > (si->nMax - si->nPage) + 1) + if(si->nPos > (int)(si->nMax - si->nPage) + 1) si->nPos = (si->nMax - si->nPage) + 1; break; } @@ -3147,7 +3147,7 @@ } /* This handles any activity on the splitbars (sizers) */ -BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) { switch (msg) { @@ -3226,13 +3226,13 @@ { start = point.x - rect.left; if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) - *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; + *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * (float)100.0; } else { start = point.y - rect.top; if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) - *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0; + *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * (float)100.0; } _handle_splitbar_resize(hwnd, *percent, type, width, height); } @@ -3246,7 +3246,7 @@ } /* This handles drawing the status text areas */ -BOOL CALLBACK _statuswndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _statuswndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) { switch (msg) { @@ -3295,7 +3295,7 @@ #ifdef AEROGLASS /* Window procedure to handle drawing themed text when in composited mode */ -BOOL CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) { ColorInfo *parentcinfo, *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); WNDPROC pOldProc; @@ -3441,7 +3441,7 @@ * Abstract: Subclass procedure for buttons */ -BOOL CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) +LRESULT CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); WNDPROC pOldProc; @@ -4279,7 +4279,7 @@ int instring(char *text, char *buffer) { - int z, len = strlen(text), buflen = strlen(buffer); + int z, len = (int)strlen(text), buflen = (int)strlen(buffer); if(buflen > len) { @@ -4334,7 +4334,7 @@ /* * remove any font modifiers */ - myFontName = strdup(&fontname[z+1]); + myFontName = _strdup(&fontname[z+1]); if(Italic) myFontName[Italic] = 0; if(Bold) @@ -4456,9 +4456,9 @@ } /* Attempt to get bitmap from classes that can have them */ - if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1) == 0) + if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1) == 0) hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); - if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) + if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); /* If we got an image... set the sizes appropriately */ @@ -4472,7 +4472,7 @@ } /* Combobox */ - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0) { dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); thiswidth = 150; @@ -4481,11 +4481,11 @@ thisheight = 18; } /* Ranged: Percent, Slider, Scrollbar */ - else if(strnicmp(tmpbuf, PROGRESS_CLASS, strlen(PROGRESS_CLASS)+1) == 0 || - strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1) == 0 || - strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0) - { - if(strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0 && + else if(_strnicmp(tmpbuf, PROGRESS_CLASS, strlen(PROGRESS_CLASS)+1) == 0 || + _strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1) == 0 || + _strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0) + { + if(_strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0 && GetWindowLong(handle, GWL_STYLE) & SBS_VERT) { /* Vertical */ @@ -4500,14 +4500,14 @@ } } /* Spinbuttons */ - else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0) + else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0) { dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); thiswidth = 50; extraheight = 6; } /* Listbox */ - else if(strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1) == 0) + else if(_strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1) == 0) { char buf[1025] = {0}; int x, count = dw_listbox_count(handle); @@ -4541,8 +4541,8 @@ thisheight = _DW_SCROLLED_MAX_HEIGHT; } /* Entryfields and MLE */ - else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 || - strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0) + else if(_strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 || + _strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0) { LONG style = GetWindowLong(handle, GWL_STYLE); if((style & ES_MULTILINE)) @@ -4607,7 +4607,7 @@ } } /* Container */ - else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0) + else if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0) { DWORD result = ListView_ApproximateViewRect(handle, _DW_SCROLLED_MAX_WIDTH, _DW_SCROLLED_MAX_HEIGHT, -1); @@ -4624,13 +4624,13 @@ thisheight = _DW_SCROLLED_MAX_HEIGHT; } /* Tree */ - else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) + else if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) { thiswidth = (int)((_DW_SCROLLED_MAX_WIDTH + _DW_SCROLLED_MIN_WIDTH)/2); thisheight = (int)((_DW_SCROLLED_MAX_HEIGHT + _DW_SCROLLED_MIN_HEIGHT)/2); } /* Buttons */ - else if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) + else if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) { ULONG style = GetWindowLong(handle, GWL_STYLE); @@ -4653,7 +4653,7 @@ extraheight = 8; } } - else if(strnicmp(tmpbuf, StatusbarClassName, strlen(StatusbarClassName)+1) == 0) + else if(_strnicmp(tmpbuf, StatusbarClassName, strlen(StatusbarClassName)+1) == 0) { extrawidth = 4; extraheight = 2; @@ -4681,7 +4681,7 @@ cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); GetClassName(handle, tmpbuf, 99); - if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) + if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) { /* groupbox */ Box *thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); @@ -4794,7 +4794,7 @@ char tmpbuf[100] = {0}; GetClassName(handle, tmpbuf, 99); - if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) + if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) { /* groupbox */ thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); @@ -4843,7 +4843,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) + if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) { cinfo->fore = fore = _internal_color(fore); cinfo->back = back = _internal_color(back); @@ -4860,7 +4860,7 @@ InvalidateRgn(handle, NULL, TRUE); return TRUE; } - else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)) == 0 ) + else if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)) == 0 ) { /* groupbox */ thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); @@ -5465,7 +5465,7 @@ else mii.hSubMenu = 0; mii.dwTypeData = menutitle; - mii.cch = strlen(menutitle); + mii.cch = (UINT)strlen(menutitle); InsertMenuItem(mymenu, 65535, TRUE, &mii); @@ -6160,11 +6160,11 @@ } else { - unlink( file ); + _unlink( file ); free( file ); return 0; } - unlink( file ); + _unlink( file ); free( file ); } @@ -6548,11 +6548,11 @@ } else { - unlink( file ); + _unlink( file ); free( file ); return; } - unlink( file ); + _unlink( file ); free( file ); } if (icon == 0 && hbitmap == 0) @@ -6601,15 +6601,15 @@ SetWindowText(handle, text); /* Combobox */ - if ( strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 ) + if ( _strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 ) SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); - else if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) + else if ( _strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); if( cinfo && cinfo->buddy ) SetWindowText( cinfo->buddy, text ); } - else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) + else if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) { /* groupbox */ thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); @@ -6659,7 +6659,7 @@ GetClassName(handle, tmpbuf, 99); - if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) + if ( _strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -6767,7 +6767,7 @@ GetClassName(box, tmpbuf, 99); /* If we are in a scrolled box... extract the interal box */ - if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) + if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) { ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box, GWLP_USERDATA); if(cinfo) @@ -6776,7 +6776,7 @@ thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); } } - else //if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) + else //if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); if(thisbox) { @@ -6806,11 +6806,11 @@ if(hsize && !width) width = 1; - if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) tmpitem[index].type = TYPEBOX; else { - if(strnicmp(tmpbuf, "SysMonthCal32", 13)==0) + if(_strnicmp(tmpbuf, "SysMonthCal32", 13)==0) { RECT rc; MonthCal_GetMinReqRect(item, &rc); @@ -6927,8 +6927,8 @@ if(thisbox) { int depth = 0; - DWORD dwStyle = GetWindowLongPtr(handle, GWL_STYLE); - DWORD dwExStyle = GetWindowLongPtr(handle, GWL_EXSTYLE); + DWORD dwStyle = GetWindowLong(handle, GWL_STYLE); + DWORD dwExStyle = GetWindowLong(handle, GWL_EXSTYLE); HMENU menu = GetMenu(handle) ; RECT rc = { 0 } ; @@ -6976,7 +6976,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1) == 0) + if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1) == 0) { unsigned long thiswidth = 0, thisheight = 0; @@ -6987,7 +6987,7 @@ if(width) *width = (int)thiswidth; if(height) *height = (int)thisheight; } - else if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0) + else if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0) { Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); @@ -7228,13 +7228,13 @@ tmp ^= mask; tmp |= style; - if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)==0) + if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)==0) { tmp = tmp & 0xffff0000; #ifdef AEROGLASS if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition) { - DWORD styleex = GetWindowLongPtr(handle, GWL_EXSTYLE); + LONG_PTR styleex = GetWindowLongPtr(handle, GWL_EXSTYLE); if(style & DW_FCF_COMPOSITED) { @@ -7520,7 +7520,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) SendMessage(handle, CB_ADDSTRING, 0, (LPARAM)text); @@ -7545,7 +7545,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) listbox_type = CB_ADDSTRING; else listbox_type = LB_ADDSTRING; @@ -7567,7 +7567,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) SendMessage(handle, CB_INSERTSTRING, pos, (LPARAM)text); @@ -7588,7 +7588,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) { char *buf = dw_window_get_text(handle); @@ -7619,7 +7619,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) { SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); SendMessage(handle, CB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer); @@ -7645,7 +7645,7 @@ void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) { char tmpbuf[100] = {0}; - int len; + unsigned int len; if(!buffer || !length) return; @@ -7654,7 +7654,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) { len = (int)SendMessage(handle, CB_GETLBTEXTLEN, (WPARAM)index, 0); @@ -7683,7 +7683,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) return (unsigned int)SendMessage(handle, CB_GETCURSEL, 0, 0); @@ -7707,7 +7707,7 @@ GetClassName(handle, tmpbuf, 99); /* This doesn't work on comboboxes */ - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) return -1; count = (int)SendMessage(handle, LB_GETSELCOUNT, 0, 0); @@ -7749,7 +7749,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) SendMessage(handle, CB_SETCURSEL, (WPARAM)index, 0); else { @@ -7771,7 +7771,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); else SendMessage(handle, LB_DELETESTRING, (WPARAM)index, 0); @@ -7788,7 +7788,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) return (int)SendMessage(handle, CB_GETCOUNT,0L, 0L); @@ -7809,7 +7809,7 @@ GetClassName(handle, tmpbuf, 99); /* This doesn't work on comboboxes */ - if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) return; SendMessage(handle, LB_SETTOPINDEX, (WPARAM)top, 0); @@ -7830,7 +7830,7 @@ if(startpoint < 0) startpoint = 0; - if(!buffer || (textlen = strlen(buffer)) < 1) + if(!buffer || (textlen = (int)strlen(buffer)) < 1) return startpoint; tmpbuf = calloc(1, len + textlen + startpoint + 2); @@ -8010,7 +8010,7 @@ GetWindowText(handle, tmpbuf, len+1); - textlen = strlen(text); + textlen = (int)strlen(text); if(flags & DW_MLE_CASESENSITIVE) { @@ -8024,7 +8024,7 @@ { for(z=point;z<(len-textlen) && !retval;z++) { - if(strnicmp(&tmpbuf[z], text, textlen) == 0) + if(_strnicmp(&tmpbuf[z], text, textlen) == 0) retval = z + textlen; } } @@ -8242,7 +8242,7 @@ GetClassName(handle, tmpbuf, 99); - if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) + if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) { if(!dw_window_get_data(handle, "_dw_checkbox")) SendMessage(handle, BM_SETCHECK, 0, 0); @@ -8290,7 +8290,7 @@ tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.pszText = title; tvi.lParam = (LONG)ptrs; - tvi.cchTextMax = strlen(title); + tvi.cchTextMax = (int)strlen(title); tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); tvins.item = tvi; @@ -8324,7 +8324,7 @@ tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.pszText = title; tvi.lParam = (LONG)ptrs; - tvi.cchTextMax = strlen(title); + tvi.cchTextMax = (int)strlen(title); tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); tvins.item = tvi; @@ -8360,7 +8360,7 @@ tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.pszText = title; - tvi.cchTextMax = strlen(title); + tvi.cchTextMax = (int)strlen(title); tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); tvi.hItem = (HTREEITEM)item; @@ -8574,7 +8574,7 @@ { lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; lvc.pszText = titles[z]; - lvc.cchTextMax = strlen(titles[z]); + lvc.cchTextMax = (int)strlen(titles[z]); if(flags[z] & DW_CFA_RIGHT) lvc.fmt = LVCFMT_RIGHT; else if(flags[z] & DW_CFA_CENTER) @@ -8697,11 +8697,11 @@ } else { - unlink( file ); + _unlink( file ); free( file ); return 0; } - unlink( file ); + _unlink( file ); free( file ); } return (HICN)icon; @@ -8826,7 +8826,7 @@ lvi.iSubItem = 0; lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT; lvi.pszText = filename; - lvi.cchTextMax = strlen(filename); + lvi.cchTextMax = (int)strlen(filename); lvi.iImage = _lookup_icon(handle, (HICON)icon, 0); ListView_SetItem(handle, &lvi); @@ -8901,7 +8901,7 @@ tmp = ""; lvi.pszText = tmp; - lvi.cchTextMax = strlen(tmp); + lvi.cchTextMax = (int)strlen(tmp); } else if(flags[column] & DW_CFA_ULONG && data) { @@ -8909,7 +8909,7 @@ _snprintf(textbuffer, 100, "%lu", tmp); - lvi.cchTextMax = strlen(textbuffer); + lvi.cchTextMax = (int)strlen(textbuffer); } else if(flags[column] & DW_CFA_DATE && data) { @@ -8929,7 +8929,7 @@ strftime(textbuffer, 100, "%x", &curtm); } - lvi.cchTextMax = strlen(textbuffer); + lvi.cchTextMax = (int)strlen(textbuffer); } else if(flags[column] & DW_CFA_TIME && data) { @@ -8942,7 +8942,7 @@ strftime(textbuffer, 100, "%X", &curtm); - lvi.cchTextMax = strlen(textbuffer); + lvi.cchTextMax = (int)strlen(textbuffer); } ListView_SetItem(handle, &lvi); @@ -9330,9 +9330,10 @@ } else if(cinfo && cinfo->columns > 1) { - int z, index; ULONG *flags = cinfo->flags, *columns = calloc(sizeof(ULONG), cinfo->columns); char *text = malloc(1024); + unsigned int z; + int index; /* Initialize with sizes of column labels */ for(z=0;z<cinfo->columns;z++) @@ -9362,7 +9363,7 @@ { for(z=0;z<cinfo->columns;z++) { - int width; + unsigned int width; ListView_GetItemText(handle, index, z, text, 1023); width = ListView_GetStringWidth(handle, text); @@ -9718,7 +9719,7 @@ if(flags & DW_DRAW_FULL) Ellipse(hdcPaint, x1, y1, x2, y2); else - Arc(hdcPaint, xorigin-r, yorigin-r, xorigin+r, yorigin+r, x2, y2, x1, y1); + Arc(hdcPaint, xorigin-(int)r, yorigin-(int)r, xorigin+(int)r, yorigin+(int)r, x2, y2, x1, y1); SelectObject( hdcPaint, oldBrush ); SelectObject( hdcPaint, oldPen ); @@ -9773,7 +9774,7 @@ SetBkMode(hdc, OPAQUE); SetBkColor(hdc, background); } - TextOut(hdc, x, y, text, strlen(text)); + TextOut(hdc, x, y, text, (int)strlen(text)); if(oldFont) SelectObject(hdc, oldFont); if(mustdelete) @@ -9825,7 +9826,7 @@ } oldFont = SelectObject(hdc, hFont); - GetTextExtentPoint32(hdc, text, strlen(text), &sz); + GetTextExtentPoint32(hdc, text, (int)strlen(text), &sz); if(width) *width = sz.cx; @@ -10041,12 +10042,12 @@ } else { - unlink( file ); + _unlink( file ); free( file ); free( pixmap ); return NULL; } - unlink( file ); + _unlink( file ); free( file ); } @@ -10916,7 +10917,7 @@ if ( (tmp = GlobalLock(handle)) && strlen(tmp) ) { - ret = strdup(tmp); + ret = _strdup(tmp); GlobalUnlock(handle); } CloseClipboard(); @@ -11071,7 +11072,7 @@ // In C++: pMalloc->Free(pidl); pMalloc->Release(); pMalloc->lpVtbl->Free(pMalloc,pidl); pMalloc->lpVtbl->Release(pMalloc); - return strdup(filenamebuf); + return _strdup(filenamebuf); } } #else @@ -11083,7 +11084,7 @@ 1000, FALSE ) ) { - return strdup( filenamebuf ); + return _strdup( filenamebuf ); } #endif } @@ -11139,7 +11140,7 @@ } if (rc) - return strdup(of.lpstrFile); + return _strdup(of.lpstrFile); } return NULL; } @@ -11174,7 +11175,8 @@ } newparams[count] = NULL; - retcode = _spawnvp(P_NOWAIT, program, (const char * const *)newparams); + /* Why does this return intptr_t ... can the PID exceed an integer value? */ + retcode = (int)_spawnvp(P_NOWAIT, program, (const char * const *)newparams); for(z=0;z<count;z++) { @@ -11200,7 +11202,7 @@ int len, z; browseurl = &url[7]; - len = strlen(browseurl); + len = (int)strlen(browseurl); for(z=0;z<len;z++) { @@ -11392,7 +11394,7 @@ while(tmp) { - if(stricmp(tmp->varname, varname) == 0) + if(_stricmp(tmp->varname, varname) == 0) return tmp; tmp = tmp->next; } @@ -11413,7 +11415,7 @@ new = malloc(sizeof(UserData)); if(new) { - new->varname = strdup(varname); + new->varname = _strdup(varname); new->data = data; new->next = NULL; @@ -11443,7 +11445,7 @@ while(tmp) { - if(all || stricmp(tmp->varname, varname) == 0) + if(all || _stricmp(tmp->varname, varname) == 0) { if(!prev) { @@ -11542,7 +11544,10 @@ { if(sigfunc) { - int timerid = SetTimer(NULL, 0, interval, _TimerProc); + /* Warning: This seems to return UINT_PTR on some systems... + * which may exceed the storage of int that our API uses. + */ + int timerid = (int)SetTimer(NULL, 0, interval, _TimerProc); if(timerid) { @@ -11607,7 +11612,7 @@ if (window && signame && sigfunc) { - if (stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0) + if (_stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0) window = _normalize_handle(window); if ((message = _findsigmessage(signame)) != 0)