Alexander Nicolaysen Sørnes : regedit: Remove an ANSI function.
Alexandre Julliard
julliard at winehq.org
Tue Sep 2 08:33:11 CDT 2008
Module: wine
Branch: master
Commit: 0035421e455f38cc481599631f5d8a4607931282
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0035421e455f38cc481599631f5d8a4607931282
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Sun Aug 31 16:58:27 2008 +0200
regedit: Remove an ANSI function.
---
programs/regedit/framewnd.c | 12 +++++-------
programs/regedit/listview.c | 31 +++----------------------------
programs/regedit/main.h | 2 +-
3 files changed, 9 insertions(+), 36 deletions(-)
diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index b0631b7..0fef96e 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -639,7 +639,6 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HKEY hKeyRoot = 0;
- LPCTSTR valueName;
DWORD valueType;
int curIndex;
BOOL firstItem = TRUE;
@@ -693,9 +692,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
while(curIndex != -1) {
- WCHAR* valueNameW;
+ WCHAR* valueName = GetItemText(g_pChildWnd->hListWnd, curIndex);
- valueName = GetItemText(g_pChildWnd->hListWnd, curIndex);
curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, curIndex, LVNI_SELECTED);
if(curIndex != -1 && firstItem) {
if (MessageBoxW(hWnd, MAKEINTRESOURCEW(IDS_DELETE_BOX_TEXT_MULTIPLE),
@@ -703,14 +701,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MB_YESNO | MB_ICONEXCLAMATION) != IDYES)
break;
}
- valueNameW = GetWideString(valueName);
- if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueNameW, curIndex==-1 && firstItem))
+
+ if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueName, curIndex==-1 && firstItem))
{
- HeapFree(GetProcessHeap(), 0, valueNameW);
+ HeapFree(GetProcessHeap(), 0, valueName);
break;
}
firstItem = FALSE;
- HeapFree(GetProcessHeap(), 0, valueNameW);
+ HeapFree(GetProcessHeap(), 0, valueName);
}
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL);
HeapFree(GetProcessHeap(), 0, keyPath);
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c
index accfc65..04f63ac 100644
--- a/programs/regedit/listview.c
+++ b/programs/regedit/listview.c
@@ -22,11 +22,9 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
-#include <tchar.h>
#include <stdio.h>
#include "main.h"
-#include "regproc.h"
#include "wine/unicode.h"
static INT Image_String;
@@ -56,30 +54,7 @@ static WCHAR g_szValueNotSet[64];
static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
-LPTSTR GetItemText(HWND hwndLV, UINT item)
-{
- LPTSTR newStr, curStr;
- unsigned int maxLen = 128;
-
- curStr = HeapAlloc(GetProcessHeap(), 0, maxLen);
- if (!curStr) return NULL;
- if (item == 0) { /* first item is ALWAYS a default */
- HeapFree(GetProcessHeap(), 0, curStr);
- return NULL;
- }
- do {
- ListView_GetItemText(hwndLV, item, 0, curStr, maxLen);
- if (_tcslen(curStr) < maxLen - 1) return curStr;
- newStr = HeapReAlloc(GetProcessHeap(), 0, curStr, maxLen * 2);
- if (!newStr) break;
- curStr = newStr;
- maxLen *= 2;
- } while (TRUE);
- HeapFree(GetProcessHeap(), 0, curStr);
- return NULL;
-}
-
-LPWSTR GetItemTextW(HWND hwndLV, UINT item)
+LPWSTR GetItemText(HWND hwndLV, UINT item)
{
LPWSTR newStr, curStr;
unsigned int maxLen = 128;
@@ -113,7 +88,7 @@ LPCWSTR GetValueName(HWND hwndLV)
item = ListView_GetNextItem(hwndLV, -1, LVNI_FOCUSED);
if (item == -1) return NULL;
- g_valueName = GetItemTextW(hwndLV, item);
+ g_valueName = GetItemText(hwndLV, item);
return g_valueName;
}
@@ -422,7 +397,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
break;
case LVN_ENDLABELEDITW: {
LPNMLVDISPINFOW dispInfo = (LPNMLVDISPINFOW)lParam;
- LPWSTR oldName = GetItemTextW(hWnd, dispInfo->item.iItem);
+ LPWSTR oldName = GetItemText(hWnd, dispInfo->item.iItem);
LONG ret;
if (!oldName) return -1; /* cannot rename a default value */
ret = RenameValue(hWnd, g_currentRootKey, g_currentPath, oldName, dispInfo->item.pszText);
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index ec2cf98..3c40515 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -120,7 +120,7 @@ extern void UpdateStatusBar(void);
extern HWND CreateListView(HWND hwndParent, UINT id);
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
extern HWND StartValueRename(HWND hwndLV);
-extern LPTSTR GetItemText(HWND hwndLV, UINT item);
+extern LPWSTR GetItemText(HWND hwndLV, UINT item);
extern LPCWSTR GetValueName(HWND hwndLV);
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
extern BOOL IsDefaultValue(HWND hwndLV, int i);
More information about the wine-cvs
mailing list