Commit 33ce8e04 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

regedit: Use the wcsdup function instead or reimplementing it.

parent 0a7084f4
...@@ -637,8 +637,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName) ...@@ -637,8 +637,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
} else { } else {
LPWSTR srcSubKey_copy; LPWSTR srcSubKey_copy;
parentPath = malloc((lstrlenW(keyPath) + 1) * sizeof(WCHAR)); parentPath = wcsdup(keyPath);
lstrcpyW(parentPath, keyPath);
srcSubKey_copy = wcsrchr(parentPath, '\\'); srcSubKey_copy = wcsrchr(parentPath, '\\');
*srcSubKey_copy = 0; *srcSubKey_copy = 0;
srcSubKey = srcSubKey_copy + 1; srcSubKey = srcSubKey_copy + 1;
......
...@@ -73,8 +73,7 @@ BOOL update_listview_path(const WCHAR *path) ...@@ -73,8 +73,7 @@ BOOL update_listview_path(const WCHAR *path)
{ {
free(g_currentPath); free(g_currentPath);
g_currentPath = malloc((lstrlenW(path) + 1) * sizeof(WCHAR)); g_currentPath = wcsdup(path);
lstrcpyW(g_currentPath, path);
return TRUE; return TRUE;
} }
...@@ -154,13 +153,7 @@ int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWOR ...@@ -154,13 +153,7 @@ int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWOR
linfo = malloc(sizeof(LINE_INFO)); linfo = malloc(sizeof(LINE_INFO));
linfo->dwValType = dwValType; linfo->dwValType = dwValType;
linfo->val_len = dwCount; linfo->val_len = dwCount;
linfo->name = wcsdup(Name);
if (Name)
{
linfo->name = malloc((lstrlenW(Name) + 1) * sizeof(WCHAR));
lstrcpyW(linfo->name, Name);
}
else linfo->name = NULL;
if (ValBuf && dwCount) if (ValBuf && dwCount)
{ {
......
...@@ -447,10 +447,7 @@ static LONG open_key(struct parser *parser, WCHAR *path) ...@@ -447,10 +447,7 @@ static LONG open_key(struct parser *parser, WCHAR *path)
KEY_ALL_ACCESS, NULL, &parser->hkey, NULL); KEY_ALL_ACCESS, NULL, &parser->hkey, NULL);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ parser->key_name = wcsdup(path);
parser->key_name = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
lstrcpyW(parser->key_name, path);
}
else else
parser->hkey = NULL; parser->hkey = NULL;
...@@ -699,8 +696,7 @@ static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos) ...@@ -699,8 +696,7 @@ static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos)
goto invalid; goto invalid;
/* copy the value name in case we need to parse multiple lines and the buffer is overwritten */ /* copy the value name in case we need to parse multiple lines and the buffer is overwritten */
parser->value_name = malloc((lstrlenW(val_name) + 1) * sizeof(WCHAR)); parser->value_name = wcsdup(val_name);
lstrcpyW(parser->value_name, val_name);
set_state(parser, DATA_START); set_state(parser, DATA_START);
return p; return p;
...@@ -1486,8 +1482,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode) ...@@ -1486,8 +1482,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
return FALSE; return FALSE;
} }
class_name = malloc((lstrlenW(reg_class_namesW[i]) + 1) * sizeof(WCHAR)); class_name = wcsdup(reg_class_namesW[i]);
lstrcpyW(class_name, reg_class_namesW[i]);
export_registry_data(fp, classes[i], class_name, unicode); export_registry_data(fp, classes[i], class_name, unicode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment