Gets rid of the arch-dependent bit operations (tested on Linux and
Solaris/x86).
This commit is contained in:
parent
982f139d19
commit
d09136f0ce
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "commctrl.h"
|
#include "commctrl.h"
|
||||||
#include "treeview.h"
|
#include "treeview.h"
|
||||||
|
@ -32,14 +33,15 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
/* ffs should be in <string.h>. */
|
||||||
#include <bitstring.h>
|
|
||||||
#define test_bit(bit,name) bit_test(name,bit)
|
/* Defines, since they do not need to return previous state, and nr
|
||||||
#define set_bit(bit,name) bit_set(name,bit)
|
* has no side effects in this file.
|
||||||
#define clear_bit(bit,name) bit_clear(name,bit)
|
*/
|
||||||
#else
|
#define tv_test_bit(nr,bf) (((LPBYTE)bf)[nr>>8]&(1<<(nr&7)))
|
||||||
#include <asm/bitops.h> /* FIXME: linux specific */
|
#define tv_set_bit(nr,bf) ((LPBYTE)bf)[nr>>8]|=(1<<(nr&7))
|
||||||
#endif
|
#define tv_clear_bit(nr,bf) ((LPBYTE)bf)[nr>>8]&=~(1<<(nr&7))
|
||||||
|
|
||||||
|
|
||||||
#define TREEVIEW_GetInfoPtr(wndPtr) ((TREEVIEW_INFO *)wndPtr->wExtra[0])
|
#define TREEVIEW_GetInfoPtr(wndPtr) ((TREEVIEW_INFO *)wndPtr->wExtra[0])
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ TREEVIEW_ValidItem (TREEVIEW_INFO *infoPtr,int handle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((!handle) || (handle>infoPtr->uMaxHandle)) return NULL;
|
if ((!handle) || (handle>infoPtr->uMaxHandle)) return NULL;
|
||||||
if (test_bit (handle, infoPtr->freeList)) return NULL;
|
if (tv_test_bit (handle, infoPtr->freeList)) return NULL;
|
||||||
|
|
||||||
return & infoPtr->items[handle];
|
return & infoPtr->items[handle];
|
||||||
}
|
}
|
||||||
|
@ -136,7 +138,7 @@ TREEVIEW_RemoveItem (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
|
||||||
INT32 iItem;
|
INT32 iItem;
|
||||||
|
|
||||||
iItem=wineItem->hItem;
|
iItem=wineItem->hItem;
|
||||||
set_bit ( iItem & 31, &infoPtr->freeList[iItem >>5]);
|
tv_set_bit(iItem,infoPtr->freeList);
|
||||||
infoPtr->uNumItems--;
|
infoPtr->uNumItems--;
|
||||||
parentItem=NULL;
|
parentItem=NULL;
|
||||||
if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
||||||
|
@ -178,7 +180,7 @@ static void TREEVIEW_RemoveAllChildren (TREEVIEW_INFO *infoPtr,
|
||||||
|
|
||||||
kill=parentItem->firstChild;
|
kill=parentItem->firstChild;
|
||||||
while (kill) {
|
while (kill) {
|
||||||
set_bit ( kill & 31, &infoPtr->freeList[kill >>5]);
|
tv_set_bit ( kill, infoPtr->freeList);
|
||||||
killItem=& infoPtr->items[kill];
|
killItem=& infoPtr->items[kill];
|
||||||
if (killItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
if (killItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
||||||
HeapFree (GetProcessHeap (), 0, killItem->pszText);
|
HeapFree (GetProcessHeap (), 0, killItem->pszText);
|
||||||
|
@ -200,7 +202,7 @@ static void TREEVIEW_RemoveTree (TREEVIEW_INFO *infoPtr)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=1; i<=infoPtr->uMaxHandle; i++)
|
for (i=1; i<=infoPtr->uMaxHandle; i++)
|
||||||
if (!test_bit (i, infoPtr->freeList)) {
|
if (!tv_test_bit (i, infoPtr->freeList)) {
|
||||||
killItem=& infoPtr->items [i];
|
killItem=& infoPtr->items [i];
|
||||||
if (killItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
if (killItem->pszText!=LPSTR_TEXTCALLBACK32A)
|
||||||
HeapFree (GetProcessHeap (), 0, killItem->pszText);
|
HeapFree (GetProcessHeap (), 0, killItem->pszText);
|
||||||
|
@ -868,7 +870,7 @@ TREEVIEW_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
|
||||||
for (i=0; i<infoPtr->uNumPtrsAlloced>>5; i++) {
|
for (i=0; i<infoPtr->uNumPtrsAlloced>>5; i++) {
|
||||||
if (infoPtr->freeList[i]) {
|
if (infoPtr->freeList[i]) {
|
||||||
iItem=ffs (infoPtr->freeList[i]);
|
iItem=ffs (infoPtr->freeList[i]);
|
||||||
clear_bit (iItem & 31, & infoPtr->freeList[i]);
|
tv_clear_bit(iItem,&infoPtr->freeList[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue