cleanup patch
Andreas Mohr
andi at rhlx01.fht-esslingen.de
Fri Nov 9 14:45:48 CST 2001
Hi all,
yet another cleanup patch.
- controls/EDIT.TODO: update obviously outdated info
- controls/listbox.c: an index goes from 0 to count-1. Thus use a logical
out-of-bounds check instead of the previous dainbramaged syntax
- spelling
--
Andreas Mohr Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604 http://home.nexgo.de/andi.mohr/
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: controls/EDIT.TODO
===================================================================
RCS file: /home/wine/wine/controls/EDIT.TODO,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 EDIT.TODO
--- controls/EDIT.TODO 24 Sep 1998 03:43:35 -0000 1.1.1.1
+++ controls/EDIT.TODO 9 Nov 2001 20:42:10 -0000
@@ -94,7 +94,7 @@
At the end of EditWndProc(), EDIT_ReleasePointer() is automatically called
which cleans up the initialized pointer. So you don't have to worry about
-unlocking the memory block. This way, the buffer gets locked / unlock only
+unlocking the memory block. This way, the buffer gets locked / unlocked only
once every message, although EDIT_GetPointer() may actually have been called
a hundred times. Only when the actual HLOCAL is needed (for example to
ReAlloc), an extra call (besides the cleanup at the end of EditWndProc()) to
@@ -192,12 +192,7 @@
D) Known bugs / Features
-- The control still calls GetTabbedTextExtent() and TabbedTextOut() in
- their 16 bit version (since the 32 bit versions don't yet exist).
- Therefore the tab list is 16 bits (should be 32).
- Scrollbar tracking is broken.
-- Lots of API calls are to 16 bit functions, because their 32 bit
- versions haven't been implemented yet (e.g. clipboard).
- Turning on WordWrap with 16-bit Notepad leaves part of the horizontal
scrollbar visible (problem with WM_ERASEBKGND ???).
- FIXME's (grep for them).
Index: controls/listbox.c
===================================================================
RCS file: /home/wine/wine/controls/listbox.c,v
retrieving revision 1.79
diff -u -r1.79 listbox.c
--- controls/listbox.c 7 Sep 2001 18:38:57 -0000 1.79
+++ controls/listbox.c 9 Nov 2001 20:42:12 -0000
@@ -434,7 +434,7 @@
static LRESULT LISTBOX_GetItemRect( LB_DESCR *descr, INT index, RECT *rect )
{
/* Index <= 0 is legal even on empty listboxes */
- if (index && (index >= descr->nb_items)) return -1;
+ if (index && (index > descr->nb_items-1)) return -1;
SetRect( rect, 0, 0, descr->width, descr->height );
if (descr->style & LBS_MULTICOLUMN)
{
@@ -449,7 +449,7 @@
{
INT i;
rect->right += descr->horz_pos;
- if ((index >= 0) && (index < descr->nb_items))
+ if ((index >= 0) && (index <= descr->nb_items-1))
{
if (index < descr->top_item)
{
@@ -492,7 +492,7 @@
INT pos = 0;
if (y >= 0)
{
- while (index < descr->nb_items)
+ while (index <= descr->nb_items-1)
{
if ((pos += descr->items[index].height) > y) break;
index++;
@@ -519,7 +519,7 @@
index += (y / descr->item_height);
}
if (index < 0) return 0;
- if (index >= descr->nb_items) return -1;
+ if (index > descr->nb_items-1) return -1;
return index;
}
@@ -533,7 +533,7 @@
const RECT *rect, INT index, UINT action, BOOL ignoreFocus )
{
LB_ITEMDATA *item = NULL;
- if (index < descr->nb_items) item = &descr->items[index];
+ if (index <= descr->nb_items-1) item = &descr->items[index];
if (IS_OWNERDRAW(descr))
{
@@ -750,7 +750,7 @@
*/
static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPARAM lParam, BOOL unicode )
{
- if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
+ if ((index < 0) || (index > descr->nb_items-1)) return LB_ERR;
if (HAS_STRINGS(descr))
{
if (!lParam)
@@ -875,7 +875,7 @@
INT i;
LB_ITEMDATA *item;
- if (start >= descr->nb_items) start = -1;
+ if (start > descr->nb_items-1) start = -1;
item = descr->items + start + 1;
if (HAS_STRINGS(descr))
{
@@ -1125,7 +1125,7 @@
{
if (descr->style & LBS_OWNERDRAWVARIABLE)
{
- if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
+ if ((index < 0) || (index > descr->nb_items-1)) return LB_ERR;
return descr->items[index].height;
}
else return descr->item_height;
@@ -1142,7 +1142,7 @@
if (descr->style & LBS_OWNERDRAWVARIABLE)
{
- if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
+ if ((index < 0) || (index > descr->nb_items-1)) return LB_ERR;
TRACE("[%04x]: item %d height = %d\n", hwnd, index, height );
descr->items[index].height = height;
LISTBOX_UpdateScroll( hwnd, descr );
@@ -1292,7 +1292,7 @@
INT oldfocus = descr->focus_item;
if (descr->style & LBS_NOSEL) return LB_ERR;
- if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
+ if ((index < 0) || (index > descr->nb_items-1)) return LB_ERR;
if (index == oldfocus) return LB_OKAY;
descr->focus_item = index;
if ((oldfocus != -1) && descr->caret_on && (descr->in_focus))
@@ -1322,8 +1322,8 @@
if ((last == -1) && (descr->nb_items == 0)) return LB_OKAY;
if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
if (last == -1) last = descr->nb_items - 1;
- if ((first < 0) || (first >= descr->nb_items)) return LB_ERR;
- if ((last < 0) || (last >= descr->nb_items)) return LB_ERR;
+ if ((first < 0) || (first > descr->nb_items-1)) return LB_ERR;
+ if ((last < 0) || (last > descr->nb_items-1)) return LB_ERR;
/* selected_item reflects last selected/unselected item on multiple sel */
descr->selected_item = last;
@@ -1358,7 +1358,7 @@
TRACE( "index=%d notify=%s\n", index, send_notify ? "YES" : "NO" );
if (descr->style & LBS_NOSEL) return LB_ERR;
- if ((index < -1) || (index >= descr->nb_items)) return LB_ERR;
+ if ((index < -1) || (index > descr->nb_items-1)) return LB_ERR;
if (descr->style & LBS_MULTIPLESEL)
{
if (index == -1) /* Select all items */
@@ -1395,7 +1395,7 @@
{
INT oldfocus = descr->focus_item;
- if ((index < 0) || (index >= descr->nb_items))
+ if ((index < 0) || (index > descr->nb_items-1))
return;
/* Important, repaint needs to be done in this order if
@@ -1598,7 +1598,7 @@
INT max_items;
if ((index == -1) && (descr->nb_items > 0)) index = descr->nb_items - 1;
- else if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
+ else if ((index < 0) || (index > descr->nb_items-1)) return LB_ERR;
/* We need to invalidate the original rect instead of the updated one. */
LISTBOX_InvalidateItems( hwnd, descr, index );
@@ -1645,7 +1645,7 @@
}
}
- if (descr->focus_item >= descr->nb_items)
+ if (descr->focus_item > descr->nb_items-1)
{
descr->focus_item = descr->nb_items - 1;
if (descr->focus_item < 0) descr->focus_item = 0;
@@ -2132,7 +2132,7 @@
case LB_TIMER_DOWN:
index = descr->top_item + LISTBOX_GetCurrentPageSize( descr );
if (index == descr->focus_item) index++;
- if (index >= descr->nb_items) index = descr->nb_items - 1;
+ if (index > descr->nb_items-1) index = descr->nb_items - 1;
break;
case LB_TIMER_RIGHT:
if (index + descr->page_size < descr->nb_items)
@@ -2256,7 +2256,7 @@
/* fall through */
case VK_DOWN:
caret = descr->focus_item + 1;
- if (caret >= descr->nb_items) caret = descr->nb_items - 1;
+ if (caret > descr->nb_items-1) caret = descr->nb_items - 1;
break;
case VK_PRIOR:
@@ -2277,7 +2277,7 @@
caret = descr->focus_item + (page * descr->page_size) - 1;
}
else caret = descr->focus_item + LISTBOX_GetCurrentPageSize(descr) - 1;
- if (caret >= descr->nb_items) caret = descr->nb_items - 1;
+ if (caret > descr->nb_items-1) caret = descr->nb_items - 1;
break;
case VK_HOME:
caret = 0;
@@ -2566,13 +2566,13 @@
case LB_GETITEMDATA16:
case LB_GETITEMDATA:
- if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
+ if (((INT)wParam < 0) || ((INT)wParam > descr->nb_items-1))
return LB_ERR;
return descr->items[wParam].data;
case LB_SETITEMDATA16:
case LB_SETITEMDATA:
- if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
+ if (((INT)wParam < 0) || ((INT)wParam > descr->nb_items-1))
return LB_ERR;
descr->items[wParam].data = (DWORD)lParam;
return LB_OKAY;
@@ -2590,7 +2590,7 @@
case LB_GETTEXTLEN16:
/* fall through */
case LB_GETTEXTLEN:
- if ((INT)wParam >= descr->nb_items || (INT)wParam < 0)
+ if (((INT)wParam < 0) || ((INT)wParam > descr->nb_items-1))
return LB_ERR;
return (HAS_STRINGS(descr) ? strlenW(descr->items[wParam].str)
: sizeof(DWORD));
@@ -2753,7 +2753,7 @@
wParam = (INT)(INT16)wParam;
/* fall through */
case LB_GETSEL:
- if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
+ if (((INT)wParam < 0) || ((INT)wParam > descr->nb_items-1))
return LB_ERR;
return descr->items[wParam].selected;
@@ -2813,7 +2813,7 @@
wParam = (INT)(INT16)wParam;
/* fall through */
case LB_SETANCHORINDEX:
- if (((INT)wParam < -1) || ((INT)wParam >= descr->nb_items))
+ if (((INT)wParam < -1) || ((INT)wParam > descr->nb_items-1))
return LB_ERR;
descr->anchor_item = (INT)wParam;
return LB_OKAY;
Index: dlls/ole32/storage32.h
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.h,v
retrieving revision 1.7
diff -u -r1.7 storage32.h
--- dlls/ole32/storage32.h 26 Sep 2000 00:00:56 -0000 1.7
+++ dlls/ole32/storage32.h 9 Nov 2001 20:42:13 -0000
@@ -179,15 +179,15 @@
/****************************************************************************
* Storage32BaseImpl definitions.
*
- * This stucture defines the base information contained in all implementations
- * of IStorage32 contained in this filee storage implementation.
+ * This structure defines the base information contained in all implementations
+ * of IStorage32 contained in this file storage implementation.
*
* In OOP terms, this is the base class for all the IStorage32 implementations
* contained in this file.
*/
struct StorageBaseImpl
{
- ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
+ ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */
/*
@@ -281,8 +281,8 @@
*/
struct StorageImpl
{
- ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
- * since we want to cast this in a Storage32 pointer */
+ ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
+ * since we want to cast this in a Storage32 pointer */
/*
* Declare the member of the Storage32BaseImpl class to allow
@@ -471,7 +471,7 @@
*/
struct StorageInternalImpl
{
- ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct
+ ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */
/*
@@ -515,7 +515,7 @@
*/
struct IEnumSTATSTGImpl
{
- ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct
+ ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the struct
* since we want to cast this in a IEnumSTATSTG pointer */
ULONG ref; /* Reference count */
@@ -600,7 +600,7 @@
*/
struct StgStreamImpl
{
- ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct
+ ICOM_VFIELD(IStream); /* Needs to be the first item in the struct
* since we want to cast this in a IStream pointer */
/*
Index: scheduler/pthread.c
===================================================================
RCS file: /home/wine/wine/scheduler/pthread.c,v
retrieving revision 1.17
diff -u -r1.17 pthread.c
--- scheduler/pthread.c 9 Oct 2001 21:59:16 -0000 1.17
+++ scheduler/pthread.c 9 Nov 2001 20:42:13 -0000
@@ -2,7 +2,7 @@
* pthread emulation for re-entrant libcs
*
* We can't use pthreads directly, so why not let libcs
- * that wants pthreads use Wine's own threading instead...
+ * that want pthreads use Wine's own threading instead...
*
* Copyright 1999 Ove K?ven
*/
More information about the wine-patches
mailing list