remove superfluous casting when pass const paramer 'filename' to LZOpenFile
Mikhail Maroukhine
mikolg at yandex.ru
Sun Mar 28 06:29:50 CDT 2010
---
dlls/lz32/tests/lzexpand_main.c | 44 +++++++++++++++++++-------------------
dlls/oleaut32/typelib.c | 5 ++-
dlls/setupapi/misc.c | 6 ++--
dlls/ver.dll16/version.c | 4 +-
dlls/version/info.c | 4 +-
5 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/dlls/lz32/tests/lzexpand_main.c b/dlls/lz32/tests/lzexpand_main.c
index 3e46fb0..6387c74 100644
--- a/dlls/lz32/tests/lzexpand_main.c
+++ b/dlls/lz32/tests/lzexpand_main.c
@@ -28,27 +28,27 @@
#include "wine/test.h"
/* Compressed file names end with underscore. */
-static char filename [] = "testfile.xxx";
-static char filename_[] = "testfile.xx_";
-static WCHAR filenameW [] = {'t','e','s','t','f','i','l','e','.','x','x','x',0};
-static WCHAR filenameW_[] = {'t','e','s','t','f','i','l','e','.','x','x','_',0};
+static const char filename [] = "testfile.xxx";
+static const char filename_[] = "testfile.xx_";
+static const WCHAR filenameW [] = {'t','e','s','t','f','i','l','e','.','x','x','x',0};
+static const WCHAR filenameW_[] = {'t','e','s','t','f','i','l','e','.','x','x','_',0};
-static char dotless [] = "dotless";
-static char dotless_[] = "dotless._";
-static WCHAR dotlessW [] = {'d','o','t','l','e','s','s', 0};
-static WCHAR dotlessW_[] = {'d','o','t','l','e','s','s','.','_', 0};
+static const char dotless [] = "dotless";
+static const char dotless_[] = "dotless._";
+static const WCHAR dotlessW [] = {'d','o','t','l','e','s','s', 0};
+static const WCHAR dotlessW_[] = {'d','o','t','l','e','s','s','.','_', 0};
-static char extless [] = "extless.";
-static char extless_[] = "extless._";
-static WCHAR extlessW [] = {'e','x','t','l','e','s','s','.', 0};
-static WCHAR extlessW_[] = {'e','x','t','l','e','s','s','.','_', 0};
+static const char extless [] = "extless.";
+static const char extless_[] = "extless._";
+static const WCHAR extlessW [] = {'e','x','t','l','e','s','s','.', 0};
+static const WCHAR extlessW_[] = {'e','x','t','l','e','s','s','.','_', 0};
-static char _terminated [] = "_terminated.xxxx_";
-static char _terminated_[] = "_terminated.xxxx_";
-static WCHAR _terminatedW [] = {'_','t','e','r','m','i','n','a','t','e','d','.','x','x','x','x','_', 0};
-static WCHAR _terminatedW_[] = {'_','t','e','r','m','i','n','a','t','e','d','.','x','x','x','x','_', 0};
+static const char _terminated [] = "_terminated.xxxx_";
+static const char _terminated_[] = "_terminated.xxxx_";
+static const WCHAR _terminatedW [] = {'_','t','e','r','m','i','n','a','t','e','d','.','x','x','x','x','_', 0};
+static const WCHAR _terminatedW_[] = {'_','t','e','r','m','i','n','a','t','e','d','.','x','x','x','x','_', 0};
-static char filename2[] = "testfile.yyy";
+static const char filename2[] = "testfile.yyy";
/* This is the hex string representation of the file created by compressing
a simple text file with the contents "This is a test file."
@@ -89,7 +89,7 @@ static void full_file_path_name_in_a_CWD(const char *src, char *dst, BOOL expect
}
}
-static void create_file(char *fname)
+static void create_file(const char *fname)
{
INT file;
OFSTRUCT ofs;
@@ -102,7 +102,7 @@ static void create_file(char *fname)
ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA('%s'): error %d\n", ofs.szPathName, GetLastError());
}
-static void delete_file(char *fname)
+static void delete_file(const char *fname)
{
INT file;
OFSTRUCT ofs;
@@ -555,7 +555,7 @@ static void test_LZCopy(void)
ok(ret, "DeleteFileA: error %d\n", GetLastError());
}
-static void create_fileW(WCHAR *fnameW)
+static void create_fileW(const WCHAR *fnameW)
{
INT file;
OFSTRUCT ofs;
@@ -568,7 +568,7 @@ static void create_fileW(WCHAR *fnameW)
ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributesW('%s'): error %d\n", ofs.szPathName, GetLastError());
}
-static void delete_fileW(WCHAR *fnameW)
+static void delete_fileW(const WCHAR *fnameW)
{
INT file;
OFSTRUCT ofs;
@@ -764,7 +764,7 @@ static void test_LZOpenFileW(void)
OFSTRUCT test;
DWORD retval;
INT file;
- static WCHAR badfilenameW[] = {'b','a','d','f','i','l','e','n','a','m','e','.','x','t','n',0};
+ static const WCHAR badfilenameW[] = {'b','a','d','f','i','l','e','n','a','m','e','.','x','t','n',0};
char expected[MAX_PATH];
SetLastError(0xfaceabee);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index c1fa321..0ae5973 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2567,7 +2567,7 @@ static HRESULT TLB_NEFile_Open(LPCWSTR path, INT index, LPVOID *ppBase, DWORD *p
This->refs = 1;
This->typelib_base = NULL;
- lzfd = LZOpenFileW( (LPWSTR)path, &ofs, OF_READ );
+ lzfd = LZOpenFileW( path, &ofs, OF_READ );
if ( lzfd >= 0 && read_xx_header( lzfd ) == IMAGE_OS2_SIGNATURE )
{
DWORD reslen, offset;
@@ -2694,7 +2694,8 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
ITypeLibImpl *entry;
HRESULT ret;
INT index = 1;
- LPWSTR index_str, file = (LPWSTR)pszFileName;
+ LPCWSTR index_str;
+ LPWSTR file = (LPWSTR)pszFileName;
LPVOID pBase = NULL;
DWORD dwTLBLength = 0;
IUnknown *pFile = NULL;
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c
index 08c0c79..8301d5b 100644
--- a/dlls/setupapi/misc.c
+++ b/dlls/setupapi/misc.c
@@ -1206,7 +1206,7 @@ static BOOL get_file_sizes_lz( LPCWSTR source, DWORD *source_size, DWORD *target
INT file;
OFSTRUCT of;
- if ((file = LZOpenFileW( (LPWSTR)source, &of, OF_READ )) < 0)
+ if ((file = LZOpenFileW( source, &of, OF_READ )) < 0)
{
ERR("cannot open source file for reading\n");
return FALSE;
@@ -1433,12 +1433,12 @@ static DWORD decompress_file_lz( LPCWSTR source, LPCWSTR target )
INT src, dst;
OFSTRUCT sof, dof;
- if ((src = LZOpenFileW( (LPWSTR)source, &sof, OF_READ )) < 0)
+ if ((src = LZOpenFileW( source, &sof, OF_READ )) < 0)
{
ERR("cannot open source file for reading\n");
return ERROR_FILE_NOT_FOUND;
}
- if ((dst = LZOpenFileW( (LPWSTR)target, &dof, OF_CREATE )) < 0)
+ if ((dst = LZOpenFileW( target, &dof, OF_CREATE )) < 0)
{
ERR("cannot open target file for writing\n");
LZClose( src );
diff --git a/dlls/ver.dll16/version.c b/dlls/ver.dll16/version.c
index 950b650..269145e 100644
--- a/dlls/ver.dll16/version.c
+++ b/dlls/ver.dll16/version.c
@@ -420,7 +420,7 @@ DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType,
TRACE("(%s,type=%p,id=%p,off=%p)\n",
debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId );
- lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
+ lzfd = LZOpenFileA( lpszFileName, &ofs, OF_READ );
if (lzfd >= 0)
{
if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, lpdwFileOffset )) reslen = 0;
@@ -445,7 +445,7 @@ DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType,
debugstr_a(lpszFileName), lpszResType, lpszResId,
dwFileOffset, dwResLen, lpvData );
- lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
+ lzfd = LZOpenFileA( lpszFileName, &ofs, OF_READ );
if ( lzfd < 0 ) return 0;
if ( !dwFileOffset )
diff --git a/dlls/version/info.c b/dlls/version/info.c
index e7f7077..f3de19e 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -258,7 +258,7 @@ DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
return 0;
}
- if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
+ if ((lzfd = LZOpenFileW( filename, &ofs, OF_READ )) != HFILE_ERROR)
{
magic = find_version_resource( lzfd, &len, &offset );
LZClose( lzfd );
@@ -351,7 +351,7 @@ BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle,
return FALSE;
}
- if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
+ if ((lzfd = LZOpenFileW( filename, &ofs, OF_READ )) != HFILE_ERROR)
{
if ((magic = find_version_resource( lzfd, &len, &offset )) > 1)
{
--
1.6.3.3
------------hm22ov20GUrx01bW2DK4OQ--
More information about the wine-patches
mailing list