diff --git a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp index 40224ccfe1cd..ffa4432704ac 100644 --- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp +++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp @@ -205,7 +205,6 @@ MapPaperSizeToNativeEnum(LPDEVMODEW aDevMode, #endif const double kThreshold = 0.05; - PRBool foundEnum = PR_FALSE; for (PRInt32 i=0;i(aPrintName); @@ -863,7 +861,6 @@ ShowNativePrintDialog(HWND aHWnd, //NS_ENSURE_ARG_POINTER(aHWnd); NS_ENSURE_ARG_POINTER(aPrintSettings); - nsresult rv = NS_ERROR_FAILURE; gDialogWasExtended = PR_FALSE; HGLOBAL hGlobalDevMode = NULL; @@ -895,13 +892,12 @@ ShowNativePrintDialog(HWND aHWnd, hDevNames = (HGLOBAL)::GlobalAlloc(GHND, sizeof(wchar_t) * (len + 1) + sizeof(DEVNAMES)); DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames); - pDevNames->wDriverOffset = sizeof(DEVNAMES); - pDevNames->wDeviceOffset = sizeof(DEVNAMES); - pDevNames->wOutputOffset = sizeof(DEVNAMES)+len+1; + pDevNames->wDriverOffset = sizeof(DEVNAMES)/sizeof(wchar_t); + pDevNames->wDeviceOffset = sizeof(DEVNAMES)/sizeof(wchar_t); + pDevNames->wOutputOffset = sizeof(DEVNAMES)/sizeof(wchar_t)+len; pDevNames->wDefault = 0; - wchar_t* device = &(((wchar_t*)pDevNames)[pDevNames->wDeviceOffset]); - wcscpy(device, printerName); + memcpy(pDevNames+1, printerName, (len + 1) * sizeof(wchar_t)); ::GlobalUnlock(hDevNames); // Create a Moveable Memory Object that holds a new DevMode