Changeset 1943 for trunk/src


Ignore:
Timestamp:
Dec 2, 1999, 5:12:24 PM (26 years ago)
Author:
achimha
Message:

async gethostbyname fixes

Location:
trunk/src/wsock32/new
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/new/relaywin.cpp

    r1942 r1943  
    1 /* $Id: relaywin.cpp,v 1.5 1999-12-02 16:01:45 achimha Exp $ */
     1/* $Id: relaywin.cpp,v 1.6 1999-12-02 16:12:23 achimha Exp $ */
    22
    33/*
     
    216216        /* we need to convert the hostent structure here */
    217217        Whostent *WinHostent = (Whostent*)pHM->pvUserData1;
    218         hostent *OS2Hostent = (hostent*)pHM->pvUserData2;
    219         WinHostent->h_name = OS2Hostent->h_name;
    220         WinHostent->h_aliases = OS2Hostent->h_aliases;
    221         WinHostent->h_addrtype = (short)OS2Hostent->h_addrtype;
    222         WinHostent->h_length = (short)OS2Hostent->h_length;
    223         WinHostent->h_addr_list = OS2Hostent->h_addr_list;
    224         /* free our temporary OS2 hostent buffer */
    225   //TODO: how can we free this? we will end up with a memory leak :(
    226   // this memory block not only contains the hostent structure but also the strings it points to
    227   // I think we should copy the strings after the Whostent into the Win32 buffer
    228   //      free(pHM->pvUserData2);
     218        hostent *OS2Hostent = (hostent*)pHM->pvUserData1;
     219        short h_addrtype = (short)OS2Hostent->h_addrtype;
     220        WinHostent->h_addrtype = h_addrtype;
     221        short h_length = (short)OS2Hostent->h_length;
     222        WinHostent->h_length = h_length;
     223        char **h_addr_list = OS2Hostent->h_addr_list;
     224        WinHostent->h_addr_list = h_addr_list;
    229225  //TODO: the size of OS/2 hostent is 4 bytes bigger so the original buffer *might* be too small
    230226
  • trunk/src/wsock32/new/wsock32.cpp

    r1940 r1943  
    1 /* $Id: wsock32.cpp,v 1.9 1999-12-02 15:22:05 achimha Exp $ */
     1/* $Id: wsock32.cpp,v 1.10 1999-12-02 16:12:24 achimha Exp $ */
    22
    33/*
     
    12721272  HWND  hwndOS2 = Win32ToOS2Handle(hWnd);
    12731273  ULONG ulNewID;
    1274   char *OS2Hostent = (char*)malloc(MAXGETHOSTSTRUCT);
    12751274
    12761275  if (hwndRelay == NULL) // already initialized ?
     
    12851284  else
    12861285    // add entry to list, we need to store both our temp buffer and the apps buffer
    1287     ulNewID = RelayAlloc(hWnd, wMsg, ASYNCREQUEST_GETHOSTBYNAME, buf, OS2Hostent);
     1286    ulNewID = RelayAlloc(hWnd, wMsg, ASYNCREQUEST_GETHOSTBYNAME, buf);
    12881287
    12891288  // call pmwsock function, will fill our temp buffer
     
    12911290                             ulNewID,
    12921291                             name,
    1293                              OS2Hostent,
     1292                             buf,
    12941293                             buflen);
    12951294
Note: See TracChangeset for help on using the changeset viewer.