Fixed int/HANDLE mismatches revealed by -DSTRICT.

Replaced the Win16 hmemcpy16 (obsolete) with memcpy.
This commit is contained in:
Francois Gouget 2000-07-23 19:33:42 +00:00 committed by Alexandre Julliard
parent 9620dfc61e
commit 56045a55d8
6 changed files with 35 additions and 39 deletions

View File

@ -117,8 +117,8 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
if (hGrpFile) LocalFree(hGrpFile);
return(0);
}
hmemcpy16(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
hmemcpy16(LocalLock(hGrpFile), lpszGrpFile, 1 + lstrlen(lpszGrpFile));
memcpy(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
memcpy(LocalLock(hGrpFile), lpszGrpFile, 1 + lstrlen(lpszGrpFile));
Globals.hActiveGroup = hGroup;

View File

@ -89,7 +89,7 @@ HLOCAL GRPFILE_ReadGroupFile(LPCSTR lpszPath)
static BOOL GRPFILE_ReadFileToBuffer(LPCSTR path, HLOCAL *phBuffer,
INT *piSize)
{
INT len, size;
UINT len, size;
LPSTR buffer;
HLOCAL hBuffer, hNewBuffer;
HFILE file;
@ -119,7 +119,7 @@ static BOOL GRPFILE_ReadFileToBuffer(LPCSTR path, HLOCAL *phBuffer,
_lclose(file);
if (len == HFILE_ERROR)
if (len == (UINT)HFILE_ERROR)
{
LocalFree(hBuffer);
return FALSE;
@ -563,7 +563,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 30, 0x0000); /* unknown */
PUT_SHORT(buffer, 32, NumProg);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 34)) return FALSE;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 34)) return FALSE;
/* Program table */
CurrProg = Progs;
@ -574,7 +574,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PROGRAM *program = LocalLock(hProgram);
PUT_SHORT(buffer, 0, CurrProg);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 2))
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 2))
return FALSE;
GRPFILE_CalculateSizes(program, &CurrProg, &CurrIcon);
@ -582,7 +582,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
}
/* Title */
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszTitle,
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszTitle,
lstrlen(lpszTitle) + 1))
return FALSE;
@ -616,10 +616,10 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
ptr += lstrlen(CmdLine) + 1;
PUT_SHORT(buffer, 22, ptr);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 24) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, Name, lstrlen(Name) + 1) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, CmdLine, lstrlen(CmdLine) + 1) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, IconFile, lstrlen(IconFile) + 1))
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 24) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, Name, lstrlen(Name) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, CmdLine, lstrlen(CmdLine) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, IconFile, lstrlen(IconFile) + 1))
return FALSE;
GRPFILE_CalculateSizes(program, &CurrProg, &CurrIcon);
@ -645,9 +645,9 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
buffer[10] = iconinfo->bPlanes;
buffer[11] = iconinfo->bBitsPerPixel;
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 12) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, AndBits, sizeAnd) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, XorBits, sizeXor)) return FALSE;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 12) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, AndBits, sizeAnd) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, XorBits, sizeXor)) return FALSE;
hProgram = program->hNext;
}
@ -660,7 +660,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 4, 0x000a);
buffer[6] = 'P', buffer[7] = 'M';
buffer[8] = 'C', buffer[9] = 'C';
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 10))
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 10))
return FALSE;
seqnum = 0;
@ -676,8 +676,8 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 0, 0x8101);
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 7 + lstrlen(lpszWorkDir));
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6) ||
HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszWorkDir, lstrlen(lpszWorkDir) + 1))
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszWorkDir, lstrlen(lpszWorkDir) + 1))
return FALSE;
}
@ -688,7 +688,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 8);
PUT_SHORT(buffer, 6, program->nHotKey);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
}
/* Show command */
@ -698,7 +698,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 8);
PUT_SHORT(buffer, 6, program->nCmdShow);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
}
seqnum++;
@ -709,7 +709,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, GROUP *group)
PUT_SHORT(buffer, 0, 0xffff);
PUT_SHORT(buffer, 2, 0xffff);
PUT_SHORT(buffer, 4, 0x0000);
if (HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6)) return FALSE;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6)) return FALSE;
}
checksum = GRPFILE_GetChecksum();

View File

@ -170,10 +170,10 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
if (hWorkDir) LocalFree(hWorkDir);
return(0);
}
hmemcpy16(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
hmemcpy16(LocalLock(hCmdLine), lpszCmdLine, 1 + lstrlen(lpszCmdLine));
hmemcpy16(LocalLock(hIconFile), lpszIconFile, 1 + lstrlen(lpszIconFile));
hmemcpy16(LocalLock(hWorkDir), lpszWorkDir, 1 + lstrlen(lpszWorkDir));
memcpy(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
memcpy(LocalLock(hCmdLine), lpszCmdLine, 1 + lstrlen(lpszCmdLine));
memcpy(LocalLock(hIconFile), lpszIconFile, 1 + lstrlen(lpszIconFile));
memcpy(LocalLock(hWorkDir), lpszWorkDir, 1 + lstrlen(lpszWorkDir));
group->hActiveProgram = hProgram;

View File

@ -142,7 +142,7 @@ static const BOOL commandSaveRegistry[COMMAND_COUNT] = {
/*
* Generic prototyes
*/
static HKEY getDataType(LPSTR *lpValue);
static DWORD getDataType(LPSTR *lpValue);
static LPSTR getRegKeyName(LPSTR lpLine);
static HKEY getRegClass(LPSTR lpLine);
static LPSTR getArg(LPSTR arg);
@ -231,10 +231,10 @@ static char helpText[] =
/******************************************************************************
* This function returns the HKEY associated with the data type encoded in the
* value. It modify the input parameter (key value) in order to skip this
* value. It modifies the input parameter (key value) in order to skip this
* "now useless" data type information.
*/
HKEY getDataType(LPSTR *lpValue)
DWORD getDataType(LPSTR *lpValue)
{
INT counter = 0;
DWORD dwReturn = REG_SZ;
@ -285,7 +285,7 @@ LPSTR getRegKeyName(LPSTR lpLine)
/******************************************************************************
* Extracts from a [HKEY/some/key/path] type of line the key class (what
* starts after the '[' and end before the first '\'
* starts after the '[' and ends before the first '\'
*/
static HKEY getRegClass(LPSTR lpClass)
{
@ -295,7 +295,7 @@ static HKEY getRegClass(LPSTR lpClass)
char lpClassCopy[KEY_MAX_LEN];
if (lpClass == NULL)
return ERROR_INVALID_PARAMETER;
return (HKEY)ERROR_INVALID_PARAMETER;
strcpy(lpClassCopy, lpClass);
@ -314,7 +314,7 @@ static HKEY getRegClass(LPSTR lpClass)
else if (strcmp( classNameBeg, "HKEY_CURRENT_USER") == IDENTICAL )
return HKEY_CURRENT_USER;
else
return ERROR_INVALID_PARAMETER;
return (HKEY)ERROR_INVALID_PARAMETER;
}
/******************************************************************************
@ -593,8 +593,8 @@ static HRESULT openKey( LPSTR stdInput)
/* Get the registry class */
currentKeyClass = getRegClass(stdInput); /* Sets global variable */
if (currentKeyClass == ERROR_INVALID_PARAMETER)
return ERROR_INVALID_PARAMETER;
if (currentKeyClass == (HKEY)ERROR_INVALID_PARAMETER)
return (HRESULT)ERROR_INVALID_PARAMETER;
/* Get the key name */
currentKeyName = getRegKeyName(stdInput); /* Sets global variable */
@ -1002,7 +1002,7 @@ static void doUnregisterDLL(LPSTR stdInput) {
* It then read the STDIN lines by lines forwarding their processing
* to the appropriate method.
*/
int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
LPSTR token = NULL; /* current token analized */
LPSTR stdInput = NULL; /* line read from stdin */

View File

@ -255,7 +255,7 @@ static FILE *file = 0;
HFILE WINAPI OpenFile( LPCSTR path, OFSTRUCT *ofs, UINT mode )
{
file = *path ? fopen(path, "r") : stdin;
return file ? 1 : HFILE_ERROR;
return file ? (HFILE)1 : HFILE_ERROR;
}
HFILE WINAPI _lclose( HFILE hFile )

View File

@ -37,7 +37,7 @@ static BOOL MacroTest = FALSE;
* WinMain
*/
int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
{
LPCSTR opt_lang = "En";
CHAR lang[3];
@ -78,10 +78,6 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
}
}
#ifdef WINELIB
opt_lang = Languages[Options.language].name;
#endif
/* Find language specific string table */
for (langnum = 0; langnum <= MAX_LANGUAGE_NUMBER; langnum++)
{