comctl32: Merge is_textT and is_textW into a single is_text.

This commit is contained in:
Gerald Pfeifer 2010-08-16 00:05:39 +02:00 committed by Alexandre Julliard
parent a0e7587419
commit ab575718ce
1 changed files with 14 additions and 20 deletions

View File

@ -474,20 +474,14 @@ static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *, INT, INT);
* W: Unicode, T: ANSI/Unicode - function of isW
*/
static inline BOOL is_textW(LPCWSTR text)
static inline BOOL is_text(LPCWSTR text)
{
return text != NULL && text != LPSTR_TEXTCALLBACKW;
}
static inline BOOL is_textT(LPCWSTR text, BOOL isW)
{
/* we can ignore isW since LPSTR_TEXTCALLBACKW == LPSTR_TEXTCALLBACKA */
return is_textW(text);
}
static inline int textlenT(LPCWSTR text, BOOL isW)
{
return !is_textT(text, isW) ? 0 :
return !is_text(text) ? 0 :
isW ? lstrlenW(text) : lstrlenA((LPCSTR)text);
}
@ -505,7 +499,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
{
LPWSTR wstr = (LPWSTR)text;
if (!isW && is_textT(text, isW))
if (!isW && is_text(text))
{
INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, NULL, 0);
wstr = Alloc(len * sizeof(WCHAR));
@ -517,7 +511,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
static inline void textfreeT(LPWSTR wstr, BOOL isW)
{
if (!isW && is_textT(wstr, isW)) Free (wstr);
if (!isW && is_text(wstr)) Free (wstr);
}
/*
@ -530,7 +524,7 @@ static BOOL textsetptrT(LPWSTR *dest, LPCWSTR src, BOOL isW)
if (src == LPSTR_TEXTCALLBACKW)
{
if (is_textW(*dest)) Free(*dest);
if (is_text(*dest)) Free(*dest);
*dest = LPSTR_TEXTCALLBACKW;
}
else
@ -946,7 +940,7 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT notificationCode
UINT realNotifCode;
LPWSTR pszTempBuf = NULL, savPszText = NULL;
if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW))
if ((pdi->item.mask & LVIF_TEXT) && is_text(pdi->item.pszText))
{
convertToAnsi = (isW && infoPtr->notifyFormat == NFR_ANSI);
convertToUnicode = (!isW && infoPtr->notifyFormat == NFR_UNICODE);
@ -2325,7 +2319,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
/* we need the text in non owner draw mode */
assert(lpLVItem->mask & LVIF_TEXT);
if (is_textT(lpLVItem->pszText, TRUE))
if (is_text(lpLVItem->pszText))
{
HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
HDC hdc = GetDC(infoPtr->hwndSelf);
@ -4320,7 +4314,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is
return FALSE;
/* For efficiency, we transform the lpLVItem->pszText to Unicode here */
if ((lpLVItem->mask & LVIF_TEXT) && is_textW(lpLVItem->pszText))
if ((lpLVItem->mask & LVIF_TEXT) && is_text(lpLVItem->pszText))
{
pszText = lpLVItem->pszText;
lpLVItem->pszText = textdupTtoW(lpLVItem->pszText, isW);
@ -5309,7 +5303,7 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++)
{
hdrItem = DPA_GetPtr(hdpaSubItems, j);
if (is_textW(hdrItem->pszText)) Free(hdrItem->pszText);
if (is_text(hdrItem->pszText)) Free(hdrItem->pszText);
Free(hdrItem);
}
DPA_Destroy(hdpaSubItems);
@ -5451,7 +5445,7 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
if (nSubItem > 0)
{
/* free string */
if (is_textW(lpDelItem->hdr.pszText))
if (is_text(lpDelItem->hdr.pszText))
Free(lpDelItem->hdr.pszText);
/* free item */
@ -5600,7 +5594,7 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
for (i = 0; i < DPA_GetPtrCount(hdpaSubItems); i++)
{
hdrItem = DPA_GetPtr(hdpaSubItems, i);
if (is_textW(hdrItem->pszText)) Free(hdrItem->pszText);
if (is_text(hdrItem->pszText)) Free(hdrItem->pszText);
Free(hdrItem);
}
DPA_Destroy(hdpaSubItems);
@ -6600,7 +6594,7 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
/* Apps depend on calling back for text if it is NULL or LPSTR_TEXTCALLBACKW */
if ((lpLVItem->mask & LVIF_TEXT) && !(lpLVItem->mask & LVIF_NORECOMPUTE) &&
!is_textW(pItemHdr->pszText))
!is_text(pItemHdr->pszText))
{
dispInfo.item.mask |= LVIF_TEXT;
dispInfo.item.pszText = lpLVItem->pszText;
@ -6648,7 +6642,7 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
else if (lpLVItem->mask & LVIF_TEXT)
{
/* if LVN_GETDISPINFO's disabled with LVIF_NORECOMPUTE return callback placeholder */
if (isW || !is_textW(pItemHdr->pszText)) lpLVItem->pszText = pItemHdr->pszText;
if (isW || !is_text(pItemHdr->pszText)) lpLVItem->pszText = pItemHdr->pszText;
else textcpynT(lpLVItem->pszText, isW, pItemHdr->pszText, TRUE, lpLVItem->cchTextMax);
}
@ -7355,7 +7349,7 @@ static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *infoPtr, LPCWSTR lpszTe
SIZE stringSize;
stringSize.cx = 0;
if (is_textT(lpszText, isW))
if (is_text(lpszText))
{
HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
HDC hdc = GetDC(infoPtr->hwndSelf);