Alignment issue in NE_InitResourceHandler

Gregg Mattinson gm138242 at scot.canada.sun.com
Tue Jun 11 10:51:50 CDT 2002


Fixed alignment issue in NE_InitResourceHandler.  The code was originally a 
PUT_UA_WORD, and was changed to memcpy, but this doesn't work in this case 
because the compiler optimizes out the memcpy call.

Gregg Mattinson
Co-op Developer
Sun Microsystems of Canada

-------------- next part --------------
*** wine-20020605/loader/ne/resource.c  Tue Jun 11 11:44:56 2002
--- wine/loader/ne/resource.c  Tue Jun 11 11:44:06 2002
***************
*** 274,280 ****
--- 274,287 ----
  
      while(pTypeInfo->type_id)
      {
+         // Due to a bug in the compiler that causes alignment issues,
+         //   memcpy can't be used here.
+ #ifdef ALLOW_UNALIGNED_ACCESS
          memcpy( &pTypeInfo->resloader, &DefResourceHandlerProc, sizeof(FARPROC16) );
+ #else
+         ((WORD*)&pTypeInfo->resloader)[0] = ((WORD*)&DefResourceHandlerProc)[0];
+         ((WORD*)&pTypeInfo->resloader)[1] = ((WORD*)&DefResourceHandlerProc)[1];
+ #endif
        pTypeInfo = NEXT_TYPEINFO(pTypeInfo);
      }
      return TRUE;


More information about the wine-patches mailing list