Commit c86bb606 authored by Alexandre Julliard's avatar Alexandre Julliard

comdlg32: Use nameless unions/structs.

parent 22c56f97
......@@ -52,8 +52,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
......@@ -3780,7 +3778,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
return;
cida = GlobalLock(medium.u.hGlobal);
cida = GlobalLock(medium.hGlobal);
nFileSelected = cida->cidl;
/* Allocate a buffer */
......@@ -3846,17 +3844,17 @@ static HRESULT COMDLG32_StrRetToStrNW (LPWSTR dest, DWORD len, LPSTRRET src, con
switch (src->uType)
{
case STRRET_WSTR:
lstrcpynW(dest, src->u.pOleStr, len);
CoTaskMemFree(src->u.pOleStr);
lstrcpynW(dest, src->pOleStr, len);
CoTaskMemFree(src->pOleStr);
break;
case STRRET_CSTR:
if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len)
if (!MultiByteToWideChar( CP_ACP, 0, src->cStr, -1, dest, len ) && len)
dest[len-1] = 0;
break;
case STRRET_OFFSET:
if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, dest, len ) && len)
if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->uOffset, -1, dest, len ) && len)
dest[len-1] = 0;
break;
......@@ -3911,8 +3909,8 @@ static void COMCTL32_ReleaseStgMedium (STGMEDIUM medium)
}
else
{
GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal);
GlobalUnlock(medium.hGlobal);
GlobalFree(medium.hGlobal);
}
}
......@@ -3938,7 +3936,7 @@ LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex)
/* Get the pidls from IDataObject */
if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
{
LPIDA cida = GlobalLock(medium.u.hGlobal);
LPIDA cida = GlobalLock(medium.hGlobal);
if(nPidlIndex <= cida->cidl)
{
pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex]]));
......@@ -3967,7 +3965,7 @@ static UINT GetNumSelected( IDataObject *doSelected )
/* Get the pidls from IDataObject */
if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
{
LPIDA cida = GlobalLock(medium.u.hGlobal);
LPIDA cida = GlobalLock(medium.hGlobal);
retVal = cida->cidl;
COMCTL32_ReleaseStgMedium(medium);
return retVal;
......
......@@ -24,8 +24,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
......@@ -155,19 +153,19 @@ static BOOL COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPCITE
switch (src->uType)
{
case STRRET_WSTR:
lstrcpynW(dest, src->u.pOleStr, len);
CoTaskMemFree(src->u.pOleStr);
lstrcpynW(dest, src->pOleStr, len);
CoTaskMemFree(src->pOleStr);
break;
case STRRET_CSTR:
if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ))
if (len && !MultiByteToWideChar( CP_ACP, 0, src->cStr, -1, dest, len ))
((LPWSTR)dest)[len-1] = 0;
break;
case STRRET_OFFSET:
if (pidl)
{
if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset,
if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->uOffset,
-1, dest, len ))
((LPWSTR)dest)[len-1] = 0;
}
......
......@@ -21,8 +21,6 @@
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
......
......@@ -29,8 +29,6 @@
#include <assert.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
......@@ -628,7 +626,7 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
lpdm->dmCollate =
(IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED);
if (lpdm->dmFields & DM_COPIES)
lpdm->u1.s1.dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
lpdm->dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
} else {
/* Application is responsible for multiple copies */
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
......@@ -637,7 +635,7 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
lppd->Flags &= ~PD_COLLATE;
lppd->nCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
/* multiple copies already included in the document. Driver must print only one copy */
lpdm->u1.s1.dmCopies = 1;
lpdm->dmCopies = 1;
}
/* Print quality, PrintDlg16 */
......@@ -650,7 +648,7 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
{
LONG dpi = SendMessageA(hQuality, CB_GETITEMDATA, Sel, 0);
lpdm->dmFields |= DM_PRINTQUALITY | DM_YRESOLUTION;
lpdm->u1.s1.dmPrintQuality = LOWORD(dpi);
lpdm->dmPrintQuality = LOWORD(dpi);
lpdm->dmYResolution = HIWORD(dpi);
}
}
......@@ -738,7 +736,7 @@ static BOOL PRINTDLG_UpdatePrintDlgW(HWND hDlg,
lpdm->dmCollate =
(IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED);
if (lpdm->dmFields & DM_COPIES)
lpdm->u1.s1.dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
lpdm->dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);
} else {
if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)
lppd->Flags |= PD_COLLATE;
......@@ -790,7 +788,7 @@ static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg,
}
if (dm)
newWord = (nIDComboBox == cmb2) ? dm->u1.s1.dmPaperSize : dm->u1.s1.dmDefaultSource;
newWord = (nIDComboBox == cmb2) ? dm->dmPaperSize : dm->dmDefaultSource;
if (nIDComboBox == cmb2) {
NamesSize = 64;
......@@ -852,9 +850,9 @@ static BOOL PRINTDLG_SetUpPaperComboBoxA(HWND hDlg,
if (dm)
{
if(nIDComboBox == cmb2)
dm->u1.s1.dmPaperSize = oldWord;
dm->dmPaperSize = oldWord;
else
dm->u1.s1.dmDefaultSource = oldWord;
dm->dmDefaultSource = oldWord;
}
Sel = old_Sel;
}
......@@ -900,7 +898,7 @@ static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg,
}
if (dm)
newWord = (nIDComboBox == cmb2) ? dm->u1.s1.dmPaperSize : dm->u1.s1.dmDefaultSource;
newWord = (nIDComboBox == cmb2) ? dm->dmPaperSize : dm->dmDefaultSource;
if (nIDComboBox == cmb2) {
NamesSize = 64;
......@@ -962,9 +960,9 @@ static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg,
if (dm)
{
if(nIDComboBox == cmb2)
dm->u1.s1.dmPaperSize = oldWord;
dm->dmPaperSize = oldWord;
else
dm->u1.s1.dmDefaultSource = oldWord;
dm->dmDefaultSource = oldWord;
}
Sel = old_Sel;
}
......@@ -1160,7 +1158,7 @@ static BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name, PRINT_PTRA *PrintStru
if (lppd->hDevMode == 0)
copies = lppd->nCopies;
else
copies = lpdm->u1.s1.dmCopies;
copies = lpdm->dmCopies;
if(copies == 0) copies = 1;
else if(copies < 0) copies = MAX_COPIES;
SetDlgItemInt(hDlg, edt3, copies, FALSE);
......@@ -1237,7 +1235,7 @@ static BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name, PRINT_PTRA *PrintStru
}
}
} else { /* PD_PRINTSETUP */
BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
BOOL bPortrait = (lpdm->dmOrientation == DMORIENT_PORTRAIT);
PRINTDLG_SetUpPaperComboBoxA(hDlg, cmb2,
PrintStructures->lpPrinterInfo->pPrinterName,
......@@ -1367,7 +1365,7 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
if (lppd->hDevMode == 0)
copies = lppd->nCopies;
else
copies = lpdm->u1.s1.dmCopies;
copies = lpdm->dmCopies;
if(copies == 0) copies = 1;
else if(copies < 0) copies = MAX_COPIES;
SetDlgItemInt(hDlg, edt3, copies, FALSE);
......@@ -1389,7 +1387,7 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE);
} else { /* PD_PRINTSETUP */
BOOL bPortrait = (lpdm->u1.s1.dmOrientation == DMORIENT_PORTRAIT);
BOOL bPortrait = (lpdm->dmOrientation == DMORIENT_PORTRAIT);
PRINTDLG_SetUpPaperComboBoxW(hDlg, cmb2,
PrintStructures->lpPrinterInfo->pPrinterName,
......@@ -1740,7 +1738,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
case rad1: /* Paperorientation */
if (lppd->Flags & PD_PRINTSETUP)
{
lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
lpdm->dmOrientation = DMORIENT_PORTRAIT;
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)(PrintStructures->hPortraitIcon));
}
......@@ -1749,7 +1747,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
case rad2: /* Paperorientation */
if (lppd->Flags & PD_PRINTSETUP)
{
lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
lpdm->dmOrientation = DMORIENT_LANDSCAPE;
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)(PrintStructures->hLandscapeIcon));
}
......@@ -1776,9 +1774,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
{
DWORD Sel = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);
if(Sel != CB_ERR) {
lpdm->u1.s1.dmPaperSize = SendDlgItemMessageA(hDlg, cmb2,
CB_GETITEMDATA,
Sel, 0);
lpdm->dmPaperSize = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, Sel, 0);
GetDlgItemTextA(hDlg, cmb2, (char *)lpdm->dmFormName, CCHFORMNAME);
}
}
......@@ -1788,9 +1784,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
{
DWORD Sel = SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
if(Sel != CB_ERR)
lpdm->u1.s1.dmDefaultSource = SendDlgItemMessageA(hDlg, cmb3,
CB_GETITEMDATA, Sel,
0);
lpdm->dmDefaultSource = SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, Sel, 0);
}
break;
}
......@@ -1799,16 +1793,16 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
case rad1: /* orientation */
case rad2:
if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED) {
if(lpdm->u1.s1.dmOrientation != DMORIENT_PORTRAIT) {
lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
if(lpdm->dmOrientation != DMORIENT_PORTRAIT) {
lpdm->dmOrientation = DMORIENT_PORTRAIT;
SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hPortraitIcon);
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hPortraitIcon);
}
} else {
if(lpdm->u1.s1.dmOrientation != DMORIENT_LANDSCAPE) {
lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
if(lpdm->dmOrientation != DMORIENT_LANDSCAPE) {
lpdm->dmOrientation = DMORIENT_LANDSCAPE;
SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hLandscapeIcon);
SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
......@@ -1900,7 +1894,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
case rad1: /* Paperorientation */
if (lppd->Flags & PD_PRINTSETUP)
{
lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
lpdm->dmOrientation = DMORIENT_PORTRAIT;
SendDlgItemMessageW(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)(PrintStructures->hPortraitIcon));
}
......@@ -1909,7 +1903,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
case rad2: /* Paperorientation */
if (lppd->Flags & PD_PRINTSETUP)
{
lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
lpdm->dmOrientation = DMORIENT_LANDSCAPE;
SendDlgItemMessageW(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)(PrintStructures->hLandscapeIcon));
}
......@@ -1934,9 +1928,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
{
DWORD Sel = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
if(Sel != CB_ERR) {
lpdm->u1.s1.dmPaperSize = SendDlgItemMessageW(hDlg, cmb2,
CB_GETITEMDATA,
Sel, 0);
lpdm->dmPaperSize = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, Sel, 0);
GetDlgItemTextW(hDlg, cmb2, lpdm->dmFormName, CCHFORMNAME);
}
}
......@@ -1946,9 +1938,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
{
DWORD Sel = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0);
if(Sel != CB_ERR)
lpdm->u1.s1.dmDefaultSource = SendDlgItemMessageW(hDlg, cmb3,
CB_GETITEMDATA, Sel,
0);
lpdm->dmDefaultSource = SendDlgItemMessageW(hDlg, cmb3, CB_GETITEMDATA, Sel, 0);
}
break;
}
......@@ -1957,16 +1947,16 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
case rad1: /* orientation */
case rad2:
if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED) {
if(lpdm->u1.s1.dmOrientation != DMORIENT_PORTRAIT) {
lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
if(lpdm->dmOrientation != DMORIENT_PORTRAIT) {
lpdm->dmOrientation = DMORIENT_PORTRAIT;
SendDlgItemMessageW(hDlg, stc10, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hPortraitIcon);
SendDlgItemMessageW(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hPortraitIcon);
}
} else {
if(lpdm->u1.s1.dmOrientation != DMORIENT_LANDSCAPE) {
lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
if(lpdm->dmOrientation != DMORIENT_LANDSCAPE) {
lpdm->dmOrientation = DMORIENT_LANDSCAPE;
SendDlgItemMessageW(hDlg, stc10, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)PrintStructures->hLandscapeIcon);
SendDlgItemMessageW(hDlg, ico1, STM_SETIMAGE, IMAGE_ICON,
......@@ -2654,11 +2644,11 @@ static void pagesetup_set_orientation(pagesetup_data *data, WORD orient)
assert(orient == DMORIENT_PORTRAIT || orient == DMORIENT_LANDSCAPE);
if(data->unicode)
dm->u1.s1.dmOrientation = orient;
dm->dmOrientation = orient;
else
{
DEVMODEA *dmA = (DEVMODEA *)dm;
dmA->u1.s1.dmOrientation = orient;
dmA->dmOrientation = orient;
}
GlobalUnlock(data->u.dlgw->hDevMode);
}
......@@ -2669,11 +2659,11 @@ static WORD pagesetup_get_orientation(const pagesetup_data *data)
WORD orient;
if(data->unicode)
orient = dm->u1.s1.dmOrientation;
orient = dm->dmOrientation;
else
{
DEVMODEA *dmA = (DEVMODEA *)dm;
orient = dmA->u1.s1.dmOrientation;
orient = dmA->dmOrientation;
}
GlobalUnlock(data->u.dlgw->hDevMode);
return orient;
......@@ -2684,11 +2674,11 @@ static void pagesetup_set_papersize(pagesetup_data *data, WORD paper)
DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
if(data->unicode)
dm->u1.s1.dmPaperSize = paper;
dm->dmPaperSize = paper;
else
{
DEVMODEA *dmA = (DEVMODEA *)dm;
dmA->u1.s1.dmPaperSize = paper;
dmA->dmPaperSize = paper;
}
GlobalUnlock(data->u.dlgw->hDevMode);
}
......@@ -2699,11 +2689,11 @@ static WORD pagesetup_get_papersize(const pagesetup_data *data)
WORD paper;
if(data->unicode)
paper = dm->u1.s1.dmPaperSize;
paper = dm->dmPaperSize;
else
{
DEVMODEA *dmA = (DEVMODEA *)dm;
paper = dmA->u1.s1.dmPaperSize;
paper = dmA->dmPaperSize;
}
GlobalUnlock(data->u.dlgw->hDevMode);
return paper;
......@@ -2714,11 +2704,11 @@ static void pagesetup_set_defaultsource(pagesetup_data *data, WORD source)
DEVMODEW *dm = GlobalLock(data->u.dlgw->hDevMode);
if(data->unicode)
dm->u1.s1.dmDefaultSource = source;
dm->dmDefaultSource = source;
else
{
DEVMODEA *dmA = (DEVMODEA *)dm;
dmA->u1.s1.dmDefaultSource = source;
dmA->dmDefaultSource = source;
}
GlobalUnlock(data->u.dlgw->hDevMode);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment