Fixed SEGPTR_GET usage.

This commit is contained in:
Alexandre Julliard 2000-11-27 22:02:08 +00:00
parent 3062240db4
commit 62469b21b6
2 changed files with 19 additions and 27 deletions

View File

@ -26,7 +26,6 @@
#include "wine/winbase16.h"
#include "heap.h"
#include "selectors.h"
#include "file.h"
#include "mmsystem.h"
#include "debugtools.h"
#include "winemm.h"
@ -63,7 +62,7 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage,
/* if filename NULL, assume open file handle in adwInfo[0] */
if (!szFileName) {
if (lParam2)
lpmmioinfo->adwInfo[0] = FILE_GetHandle(lpmmioinfo->adwInfo[0]);
lpmmioinfo->adwInfo[0] = DosFileHandleToWin32Handle(lpmmioinfo->adwInfo[0]);
break;
}
@ -340,11 +339,9 @@ static LRESULT MMIO_Map32To16(DWORD wMsg, LPARAM* lp1, LPARAM* lp2)
switch (wMsg) {
case MMIOM_OPEN:
{
void* lp = SEGPTR_ALLOC(strlen((LPSTR)*lp1) + 1);
char *lp = SEGPTR_STRDUP( (LPSTR)*lp1 );
if (!lp) return MMSYSERR_NOMEM;
strcpy((void*)SEGPTR_GET(lp), (LPSTR)*lp1);
*lp1 = (LPARAM)lp;
*lp1 = SEGPTR_GET(lp);
}
break;
case MMIOM_CLOSE:
@ -359,8 +356,8 @@ static LRESULT MMIO_Map32To16(DWORD wMsg, LPARAM* lp1, LPARAM* lp2)
if (!lp) return MMSYSERR_NOMEM;
if (wMsg != MMIOM_READ)
memcpy((void*)SEGPTR_GET(lp), (void*)*lp1, *lp2);
*lp1 = (LPARAM)lp;
memcpy(lp, (void*)*lp1, *lp2);
*lp1 = SEGPTR_GET(lp);
}
break;
default:
@ -386,11 +383,11 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
/* nothing to do */
break;
case MMIOM_READ:
memcpy((void*)lParam1, (void*)SEGPTR_GET((void*)lp1), lp2);
memcpy((void*)lParam1, PTR_SEG_TO_LIN(lp1), lp2);
/* fall thru */
case MMIOM_WRITE:
case MMIOM_WRITEFLUSH:
if (!SEGPTR_FREE((void*)lp1)) {
if (!SEGPTR_FREE(PTR_SEG_TO_LIN(lp1))) {
FIXME("bad free line=%d\n", __LINE__);
}
break;
@ -405,18 +402,17 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
*/
static SEGPTR MMIO_GenerateInfoForIOProc(const WINE_MMIO* wm)
{
SEGPTR lp = (SEGPTR)SEGPTR_ALLOC(sizeof(MMIOINFO16));
LPMMIOINFO16 mmioInfo16 = (LPMMIOINFO16)SEGPTR_GET((void*)lp);
LPMMIOINFO16 mmioInfo16 = SEGPTR_ALLOC(sizeof(MMIOINFO16));
memset(mmioInfo16, 0, sizeof(MMIOINFO16));
mmioInfo16->lDiskOffset = wm->info.lDiskOffset;
mmioInfo16->lDiskOffset = wm->info.lDiskOffset;
mmioInfo16->adwInfo[0] = wm->info.adwInfo[0];
mmioInfo16->adwInfo[1] = wm->info.adwInfo[1];
mmioInfo16->adwInfo[2] = wm->info.adwInfo[2];
mmioInfo16->adwInfo[3] = wm->info.adwInfo[3];
return lp;
return SEGPTR_GET(mmioInfo16);
}
/****************************************************************
@ -424,9 +420,7 @@ static SEGPTR MMIO_GenerateInfoForIOProc(const WINE_MMIO* wm)
*/
static LRESULT MMIO_UpdateInfoForIOProc(WINE_MMIO* wm, SEGPTR segmmioInfo16)
{
const MMIOINFO16* mmioInfo16;
mmioInfo16 = (const MMIOINFO16*)SEGPTR_GET((void*)segmmioInfo16);
MMIOINFO16* mmioInfo16 = PTR_SEG_TO_LIN(segmmioInfo16);
wm->info.lDiskOffset = mmioInfo16->lDiskOffset;
wm->info.adwInfo[0] = mmioInfo16->adwInfo[0];
@ -434,9 +428,7 @@ static LRESULT MMIO_UpdateInfoForIOProc(WINE_MMIO* wm, SEGPTR segmmioInfo16)
wm->info.adwInfo[2] = mmioInfo16->adwInfo[2];
wm->info.adwInfo[3] = mmioInfo16->adwInfo[3];
if (!SEGPTR_FREE((void*)segmmioInfo16)) {
FIXME("bad free line=%d\n", __LINE__);
}
if (!SEGPTR_FREE(mmioInfo16)) FIXME("bad free\n");
return MMSYSERR_NOERROR;
}

View File

@ -1339,7 +1339,7 @@ char* WINAPI WSOCK32_inet_ntoa(struct in_addr in)
SEGPTR WINAPI WINSOCK_inet_ntoa16(struct in_addr in)
{
char* retVal = WSOCK32_inet_ntoa(in);
return retVal ? SEGPTR_GET(retVal) : (SEGPTR)NULL;
return SEGPTR_GET(retVal);
}
@ -2373,7 +2373,7 @@ SEGPTR WINAPI WINSOCK_gethostbyaddr16(const char *addr, INT16 len, INT16 type)
TRACE("ptr %08x, len %d, type %d\n",
(unsigned) addr, len, type);
retval = __ws_gethostbyaddr( addr, len, type, WS_DUP_SEGPTR );
return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
return SEGPTR_GET(retval);
}
WIN_hostent* WINAPI WSOCK32_gethostbyaddr(const char *addr, INT len,
@ -2434,7 +2434,7 @@ SEGPTR WINAPI WINSOCK_gethostbyname16(const char *name)
WIN_hostent* retval;
TRACE("%s\n", (name)?name:NULL_STRING);
retval = __ws_gethostbyname( name, WS_DUP_SEGPTR );
return (retval)? SEGPTR_GET(retval) : ((SEGPTR)NULL) ;
return SEGPTR_GET(retval);
}
WIN_hostent* WINAPI WSOCK32_gethostbyname(const char* name)
@ -2477,7 +2477,7 @@ SEGPTR WINAPI WINSOCK_getprotobyname16(const char *name)
WIN_protoent* retval;
TRACE("%s\n", (name)?name:NULL_STRING);
retval = __ws_getprotobyname(name, WS_DUP_SEGPTR);
return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
return SEGPTR_GET(retval);
}
WIN_protoent* WINAPI WSOCK32_getprotobyname(const char* name)
@ -2520,7 +2520,7 @@ SEGPTR WINAPI WINSOCK_getprotobynumber16(INT16 number)
WIN_protoent* retval;
TRACE("%i\n", number);
retval = __ws_getprotobynumber(number, WS_DUP_SEGPTR);
return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
return SEGPTR_GET(retval);
}
WIN_protoent* WINAPI WSOCK32_getprotobynumber(INT number)
@ -2572,7 +2572,7 @@ SEGPTR WINAPI WINSOCK_getservbyname16(const char *name, const char *proto)
TRACE("'%s', '%s'\n",
(name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
retval = __ws_getservbyname(name, proto, WS_DUP_SEGPTR);
return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
return SEGPTR_GET(retval);
}
WIN_servent* WINAPI WSOCK32_getservbyname(const char *name, const char *proto)
@ -2620,7 +2620,7 @@ SEGPTR WINAPI WINSOCK_getservbyport16(INT16 port, const char *proto)
TRACE("%d (i.e. port %d), '%s'\n",
(int)port, (int)ntohl(port), (proto)?proto:NULL_STRING);
retval = __ws_getservbyport(port, proto, WS_DUP_SEGPTR);
return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
return SEGPTR_GET(retval);
}
WIN_servent* WINAPI WSOCK32_getservbyport(INT port, const char *proto)