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};
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,
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),
};
struct {
int mask;
char *name;
static const struct {
DWORD mask;
const char *name;
} cfflags[] = {
#define XX(x) { x, #x },
XX(CF_SCREENFONTS)
@ -146,17 +146,16 @@ struct {
XX(CF_NOSCRIPTSEL)
XX(CF_NOVERTFONTS)
#undef XX
{0,NULL},
};
void _dump_cf_flags(DWORD cflags)
{
int i;
for (i=0;cfflags[i].name;i++)
for (i = 0; i < sizeof(cfflags)/sizeof(cfflags[0]); i++)
if (cfflags[i].mask & cflags)
MESSAGE("%s|",cfflags[i].name);
MESSAGE("\n");
TRACE("%s|",cfflags[i].name);
TRACE("\n");
}
/***********************************************************************
@ -168,7 +167,7 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
HRSRC hResInfo;
HINSTANCE hDlginst;
HGLOBAL hDlgTmpl;
static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_',
'F','O','N','T',0};
@ -347,9 +346,9 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
{
int italic;
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_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 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;
for (i=0; sizes[i]; i++)
for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1;
return 0;
}
@ -482,7 +481,7 @@ INT AddFontStyle( const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM,
if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1;
i = SendMessageA( hcmb5, CB_FINDSTRINGEXACT, 0,
(LPARAM)lpElfex->elfScript);
if( i == CB_ERR) {
if( i == CB_ERR) {
i = SendMessageA( hcmb5, CB_ADDSTRING, 0,
(LPARAM)lpElfex->elfScript);
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);
idx = SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0);
charset = SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, idx, 0);
SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0);
SendDlgItemMessageA(hDlg, cmb3, 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;
}
i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);
if( i != CB_ERR)
if( i != CB_ERR)
lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageA(hDlg, cmb3,
CB_GETITEMDATA , i, 0));
else
@ -944,7 +943,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
lpxx->lfHeight = - MulDiv( lpcf->iPointSize ,
GetDeviceCaps(hdc, LOGPIXELSY), 720);
CFn_ReleaseDC(lpcf, hdc);
} else
} else
lpxx->lfHeight = -lpcf->iPointSize / 10;
i=SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0);
if (i!=CB_ERR)
@ -1036,7 +1035,11 @@ LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam,
LOGFONTA lf = *(lpcf->lpLogFont);
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 */
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++;
hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) );
rgbPrev=SetTextColor( hdc, lpcf->rgbColors );
DrawTextW( hdc,
sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]],
-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 ));
EndPaint( hDlg, &ps );
}
return FALSE;
}
@ -1077,6 +1079,7 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
{
LPCHOOSEFONTA lpcf;
INT_PTR res = FALSE;
if (uMsg!=WM_INITDIALOG)
{
lpcf=(LPCHOOSEFONTA)GetPropA(hDlg, WINE_FONTDATA);
@ -1127,6 +1130,7 @@ INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
{
LPCHOOSEFONTW lpcf32w;
INT_PTR res = FALSE;
if (uMsg!=WM_INITDIALOG)
{
lpcf32w=(LPCHOOSEFONTW)GetPropA(hDlg, WINE_FONTDATA);