Constify some statics and make them smaller.

oldstable
Jon Griffiths 2004-10-07 17:35:08 +00:00 committed by Alexandre Julliard
parent ce0fbb5b28
commit ecd78d780e
1 changed files with 24 additions and 20 deletions

View File

@ -96,7 +96,7 @@ static const WCHAR *sample_lang_text[]={
stKOI8,stIso88593,stIso88594,stIso885910,stCeltic}; stKOI8,stIso88593,stIso88594,stIso885910,stCeltic};
static const int CHARSET_ORDER[256]={ static const BYTE CHARSET_ORDER[256]={
CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -115,9 +115,9 @@ static const int CHARSET_ORDER[256]={
CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM), CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM),
}; };
struct { static const struct {
int mask; DWORD mask;
char *name; const char *name;
} cfflags[] = { } cfflags[] = {
#define XX(x) { x, #x }, #define XX(x) { x, #x },
XX(CF_SCREENFONTS) XX(CF_SCREENFONTS)
@ -146,17 +146,16 @@ struct {
XX(CF_NOSCRIPTSEL) XX(CF_NOSCRIPTSEL)
XX(CF_NOVERTFONTS) XX(CF_NOVERTFONTS)
#undef XX #undef XX
{0,NULL},
}; };
void _dump_cf_flags(DWORD cflags) void _dump_cf_flags(DWORD cflags)
{ {
int i; int i;
for (i=0;cfflags[i].name;i++) for (i = 0; i < sizeof(cfflags)/sizeof(cfflags[0]); i++)
if (cfflags[i].mask & cflags) if (cfflags[i].mask & cflags)
MESSAGE("%s|",cfflags[i].name); TRACE("%s|",cfflags[i].name);
MESSAGE("\n"); TRACE("\n");
} }
/*********************************************************************** /***********************************************************************
@ -168,7 +167,7 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
HRSRC hResInfo; HRSRC hResInfo;
HINSTANCE hDlginst; HINSTANCE hDlginst;
HGLOBAL hDlgTmpl; HGLOBAL hDlgTmpl;
static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_', static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_',
'F','O','N','T',0}; 'F','O','N','T',0};
@ -347,9 +346,9 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
{ {
int italic; int italic;
int weight; int weight;
char stname[20]; const char *stname;
}; };
static struct FONTSTYLE fontstyles[FSTYLES]={ static const struct FONTSTYLE fontstyles[FSTYLES]={
{ 0,FW_NORMAL,"Regular"}, { 1,FW_NORMAL,"Italic"}, { 0,FW_NORMAL,"Regular"}, { 1,FW_NORMAL,"Italic"},
{ 0,FW_BOLD,"Bold"}, { 1,FW_BOLD,"Bold Italic"} { 0,FW_BOLD,"Bold"}, { 1,FW_BOLD,"Bold Italic"}
}; };
@ -411,10 +410,10 @@ static int AddFontSizeToCombo3(HWND hwnd, UINT h, LPCHOOSEFONTA lpcf)
*/ */
static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf) static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf)
{ {
static const int sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72,0}; static const char sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
int i; int i;
for (i=0; sizes[i]; i++) for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1; if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
return 0; return 0;
} }
@ -482,7 +481,7 @@ INT AddFontStyle( const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM,
if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1; if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
i = SendMessageA( hcmb5, CB_FINDSTRINGEXACT, 0, i = SendMessageA( hcmb5, CB_FINDSTRINGEXACT, 0,
(LPARAM)lpElfex->elfScript); (LPARAM)lpElfex->elfScript);
if( i == CB_ERR) { if( i == CB_ERR) {
i = SendMessageA( hcmb5, CB_ADDSTRING, 0, i = SendMessageA( hcmb5, CB_ADDSTRING, 0,
(LPARAM)lpElfex->elfScript); (LPARAM)lpElfex->elfScript);
if( i != CB_ERR) if( i != CB_ERR)
@ -870,7 +869,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
pstyle = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, idx, 0); pstyle = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, idx, 0);
idx = SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); idx = SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0);
charset = SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, idx, 0); charset = SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, idx, 0);
SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0); SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0); SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageA(hDlg, cmb5, CB_RESETCONTENT, 0, 0); SendDlgItemMessageA(hDlg, cmb5, CB_RESETCONTENT, 0, 0);
@ -933,7 +932,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
lpcf->nFontType |= BOLD_FONTTYPE; lpcf->nFontType |= BOLD_FONTTYPE;
} }
i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
if( i != CB_ERR) if( i != CB_ERR)
lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageA(hDlg, cmb3, lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageA(hDlg, cmb3,
CB_GETITEMDATA , i, 0)); CB_GETITEMDATA , i, 0));
else else
@ -944,7 +943,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
lpxx->lfHeight = - MulDiv( lpcf->iPointSize , lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
GetDeviceCaps(hdc, LOGPIXELSY), 720); GetDeviceCaps(hdc, LOGPIXELSY), 720);
CFn_ReleaseDC(lpcf, hdc); CFn_ReleaseDC(lpcf, hdc);
} else } else
lpxx->lfHeight = -lpcf->iPointSize / 10; lpxx->lfHeight = -lpcf->iPointSize / 10;
i=SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); i=SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0);
if (i!=CB_ERR) if (i!=CB_ERR)
@ -1036,7 +1035,11 @@ LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
LOGFONTA lf = *(lpcf->lpLogFont); LOGFONTA lf = *(lpcf->lpLogFont);
MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2); MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2);
hdc=BeginPaint( hDlg, &ps ); hdc = BeginPaint( hDlg, &ps );
TRACE("erase %d, rect=(%ld,%ld)-(%ld,%ld)\n", ps.fErase,
ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right, ps.rcPaint.bottom);
/* Paint frame */ /* Paint frame */
MoveToEx( hdc, info.rcWindow.left, info.rcWindow.bottom, NULL ); MoveToEx( hdc, info.rcWindow.left, info.rcWindow.bottom, NULL );
@ -1057,7 +1060,7 @@ LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
info.rcWindow.left++; info.rcWindow.left++;
hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) ); hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) );
rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); rgbPrev=SetTextColor( hdc, lpcf->rgbColors );
DrawTextW( hdc, DrawTextW( hdc,
sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]], sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]],
-1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE ); -1, &info.rcWindow, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
@ -1065,7 +1068,6 @@ LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
DeleteObject(SelectObject( hdc, hOrigFont )); DeleteObject(SelectObject( hdc, hOrigFont ));
EndPaint( hDlg, &ps ); EndPaint( hDlg, &ps );
} }
return FALSE; return FALSE;
} }
@ -1077,6 +1079,7 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
{ {
LPCHOOSEFONTA lpcf; LPCHOOSEFONTA lpcf;
INT_PTR res = FALSE; INT_PTR res = FALSE;
if (uMsg!=WM_INITDIALOG) if (uMsg!=WM_INITDIALOG)
{ {
lpcf=(LPCHOOSEFONTA)GetPropA(hDlg, WINE_FONTDATA); lpcf=(LPCHOOSEFONTA)GetPropA(hDlg, WINE_FONTDATA);
@ -1127,6 +1130,7 @@ INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
{ {
LPCHOOSEFONTW lpcf32w; LPCHOOSEFONTW lpcf32w;
INT_PTR res = FALSE; INT_PTR res = FALSE;
if (uMsg!=WM_INITDIALOG) if (uMsg!=WM_INITDIALOG)
{ {
lpcf32w=(LPCHOOSEFONTW)GetPropA(hDlg, WINE_FONTDATA); lpcf32w=(LPCHOOSEFONTW)GetPropA(hDlg, WINE_FONTDATA);