shell32: Constify some variables.

This commit is contained in:
Andrew Talbot 2007-11-01 22:15:02 +00:00 committed by Alexandre Julliard
parent 4c516e63d3
commit 36d32df5e6
1 changed files with 26 additions and 25 deletions

View File

@ -931,10 +931,10 @@ static inline void grow_list(FILE_LIST *list)
/* adds a file to the FILE_ENTRY struct /* adds a file to the FILE_ENTRY struct
*/ */
static void add_file_to_entry(FILE_ENTRY *feFile, LPWSTR szFile) static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
{ {
DWORD dwLen = lstrlenW(szFile) + 1; DWORD dwLen = lstrlenW(szFile) + 1;
LPWSTR ptr; LPCWSTR ptr;
feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR)); feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
lstrcpyW(feFile->szFullPath, szFile); lstrcpyW(feFile->szFullPath, szFile);
@ -953,9 +953,10 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPWSTR szFile)
feFile->bFromWildcard = FALSE; feFile->bFromWildcard = FALSE;
} }
static LPWSTR wildcard_to_file(LPWSTR szWildCard, LPWSTR szFileName) static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName)
{ {
LPWSTR szFullPath, ptr; LPCWSTR ptr;
LPWSTR szFullPath;
DWORD dwDirLen, dwFullLen; DWORD dwDirLen, dwFullLen;
ptr = StrRChrW(szWildCard, NULL, '\\'); ptr = StrRChrW(szWildCard, NULL, '\\');
@ -970,7 +971,7 @@ static LPWSTR wildcard_to_file(LPWSTR szWildCard, LPWSTR szFileName)
return szFullPath; return szFullPath;
} }
static void parse_wildcard_files(FILE_LIST *flList, LPWSTR szFile, LPDWORD pdwListIndex) static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwListIndex)
{ {
WIN32_FIND_DATAW wfd; WIN32_FIND_DATAW wfd;
HANDLE hFile = FindFirstFileW(szFile, &wfd); HANDLE hFile = FindFirstFileW(szFile, &wfd);
@ -1080,7 +1081,7 @@ static void destroy_file_list(FILE_LIST *flList)
HeapFree(GetProcessHeap(), 0, flList->feFiles); HeapFree(GetProcessHeap(), 0, flList->feFiles);
} }
static void copy_dir_to_dir(FILE_OPERATION *op, FILE_ENTRY *feFrom, LPWSTR szDestPath) static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
{ {
WCHAR szFrom[MAX_PATH], szTo[MAX_PATH]; WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
SHFILEOPSTRUCTW fileOp; SHFILEOPSTRUCTW fileOp;
@ -1124,7 +1125,7 @@ static void copy_dir_to_dir(FILE_OPERATION *op, FILE_ENTRY *feFrom, LPWSTR szDes
SHFileOperationW(&fileOp); SHFileOperationW(&fileOp);
} }
static BOOL copy_file_to_file(FILE_OPERATION *op, WCHAR *szFrom, WCHAR *szTo) static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCHAR *szTo)
{ {
if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo)) if (!(op->req->fFlags & FOF_NOCONFIRMATION) && PathFileExistsW(szTo))
{ {
@ -1136,7 +1137,7 @@ static BOOL copy_file_to_file(FILE_OPERATION *op, WCHAR *szFrom, WCHAR *szTo)
} }
/* copy a file or directory to another directory */ /* copy a file or directory to another directory */
static void copy_to_dir(FILE_OPERATION *op, FILE_ENTRY *feFrom, FILE_ENTRY *feTo) static void copy_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
{ {
if (!PathFileExistsW(feTo->szFullPath)) if (!PathFileExistsW(feTo->szFullPath))
SHNotifyCreateDirectoryW(feTo->szFullPath, NULL); SHNotifyCreateDirectoryW(feTo->szFullPath, NULL);
@ -1152,10 +1153,10 @@ static void copy_to_dir(FILE_OPERATION *op, FILE_ENTRY *feFrom, FILE_ENTRY *feTo
copy_dir_to_dir(op, feFrom, feTo->szFullPath); copy_dir_to_dir(op, feFrom, feTo->szFullPath);
} }
static void create_dest_dirs(LPWSTR szDestDir) static void create_dest_dirs(LPCWSTR szDestDir)
{ {
WCHAR dir[MAX_PATH]; WCHAR dir[MAX_PATH];
LPWSTR ptr = StrChrW(szDestDir, '\\'); LPCWSTR ptr = StrChrW(szDestDir, '\\');
/* make sure all directories up to last one are created */ /* make sure all directories up to last one are created */
while (ptr && (ptr = StrChrW(ptr + 1, '\\'))) while (ptr && (ptr = StrChrW(ptr + 1, '\\')))
@ -1172,11 +1173,11 @@ static void create_dest_dirs(LPWSTR szDestDir)
} }
/* the FO_COPY operation */ /* the FO_COPY operation */
static HRESULT copy_files(FILE_OPERATION *op, FILE_LIST *flFrom, FILE_LIST *flTo) static HRESULT copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, const FILE_LIST *flTo)
{ {
DWORD i; DWORD i;
FILE_ENTRY *entryToCopy; const FILE_ENTRY *entryToCopy;
FILE_ENTRY *fileDest = &flTo->feFiles[0]; const FILE_ENTRY *fileDest = &flTo->feFiles[0];
BOOL bCancelIfAnyDirectories = FALSE; BOOL bCancelIfAnyDirectories = FALSE;
if (flFrom->bAnyDontExist) if (flFrom->bAnyDontExist)
@ -1269,7 +1270,7 @@ static HRESULT copy_files(FILE_OPERATION *op, FILE_LIST *flFrom, FILE_LIST *flTo
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, FILE_LIST *flFrom) static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, const FILE_LIST *flFrom)
{ {
if (flFrom->dwNumFiles > 1) if (flFrom->dwNumFiles > 1)
{ {
@ -1281,7 +1282,7 @@ static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, FILE_LIST
} }
else else
{ {
FILE_ENTRY *fileEntry = &flFrom->feFiles[0]; const FILE_ENTRY *fileEntry = &flFrom->feFiles[0];
if (IsAttribFile(fileEntry->attributes)) if (IsAttribFile(fileEntry->attributes))
return SHELL_ConfirmDialogW(hWnd, (fTrash?ASK_TRASH_FILE:ASK_DELETE_FILE), fileEntry->szFullPath, NULL); return SHELL_ConfirmDialogW(hWnd, (fTrash?ASK_TRASH_FILE:ASK_DELETE_FILE), fileEntry->szFullPath, NULL);
@ -1292,9 +1293,9 @@ static BOOL confirm_delete_list(HWND hWnd, DWORD fFlags, BOOL fTrash, FILE_LIST
} }
/* the FO_DELETE operation */ /* the FO_DELETE operation */
static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom) static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom)
{ {
FILE_ENTRY *fileEntry; const FILE_ENTRY *fileEntry;
DWORD i; DWORD i;
BOOL bPathExists; BOOL bPathExists;
BOOL bTrash; BOOL bTrash;
@ -1354,7 +1355,7 @@ static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static void move_dir_to_dir(LPSHFILEOPSTRUCTW lpFileOp, FILE_ENTRY *feFrom, LPWSTR szDestPath) static void move_dir_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
{ {
WCHAR szFrom[MAX_PATH], szTo[MAX_PATH]; WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
SHFILEOPSTRUCTW fileOp; SHFILEOPSTRUCTW fileOp;
@ -1380,7 +1381,7 @@ static void move_dir_to_dir(LPSHFILEOPSTRUCTW lpFileOp, FILE_ENTRY *feFrom, LPWS
} }
/* moves a file or directory to another directory */ /* moves a file or directory to another directory */
static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, FILE_ENTRY *feFrom, FILE_ENTRY *feTo) static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
{ {
WCHAR szDestPath[MAX_PATH]; WCHAR szDestPath[MAX_PATH];
@ -1393,11 +1394,11 @@ static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, FILE_ENTRY *feFrom, FILE_ENT
} }
/* the FO_MOVE operation */ /* the FO_MOVE operation */
static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const FILE_LIST *flTo)
{ {
DWORD i; DWORD i;
FILE_ENTRY *entryToMove; const FILE_ENTRY *entryToMove;
FILE_ENTRY *fileDest; const FILE_ENTRY *fileDest;
if (!flFrom->dwNumFiles || !flTo->dwNumFiles) if (!flFrom->dwNumFiles || !flTo->dwNumFiles)
return ERROR_CANCELLED; return ERROR_CANCELLED;
@ -1445,10 +1446,10 @@ static HRESULT move_files(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LI
} }
/* the FO_RENAME files */ /* the FO_RENAME files */
static HRESULT rename_files(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) static HRESULT rename_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const FILE_LIST *flTo)
{ {
FILE_ENTRY *feFrom; const FILE_ENTRY *feFrom;
FILE_ENTRY *feTo; const FILE_ENTRY *feTo;
if (flFrom->dwNumFiles != 1) if (flFrom->dwNumFiles != 1)
return ERROR_GEN_FAILURE; return ERROR_GEN_FAILURE;