[FONTVIEW]

Fix some MSVC/x64 warnings

svn path=/trunk/; revision=58316
This commit is contained in:
Timo Kreuzer 2013-02-16 11:46:05 +00:00
parent 413592e946
commit aa173340b2
2 changed files with 19 additions and 19 deletions

View file

@ -88,7 +88,7 @@ Display_DrawText(HDC hDC, DISPLAYDATA* pData, int nYPos)
GetTextMetrics(hDC, &tm); GetTextMetrics(hDC, &tm);
swprintf(szCaption, L"%s%s", pData->szTypeFaceName, pData->szFormat); swprintf(szCaption, L"%s%s", pData->szTypeFaceName, pData->szFormat);
TextOutW(hDC, 0, y, szCaption, wcslen(szCaption)); TextOutW(hDC, 0, y, szCaption, (INT)wcslen(szCaption));
y += tm.tmHeight + SPACING1; y += tm.tmHeight + SPACING1;
/* Draw a seperation Line */ /* Draw a seperation Line */
@ -103,15 +103,15 @@ Display_DrawText(HDC hDC, DISPLAYDATA* pData, int nYPos)
SelectObject(hDC, pData->hCharSetFont); SelectObject(hDC, pData->hCharSetFont);
GetTextMetrics(hDC, &tm); GetTextMetrics(hDC, &tm);
swprintf(szCaption, L"abcdefghijklmnopqrstuvwxyz"); swprintf(szCaption, L"abcdefghijklmnopqrstuvwxyz");
TextOutW(hDC, 0, y, szCaption, wcslen(szCaption)); TextOutW(hDC, 0, y, szCaption, (INT)wcslen(szCaption));
y += tm.tmHeight + 1; y += tm.tmHeight + 1;
swprintf(szCaption, L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); swprintf(szCaption, L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
TextOutW(hDC, 0, y, szCaption, wcslen(szCaption)); TextOutW(hDC, 0, y, szCaption, (INT)wcslen(szCaption));
y += tm.tmHeight + 1; y += tm.tmHeight + 1;
swprintf(szCaption, L"0123456789.:,;(\"~!@#$%^&*')"); swprintf(szCaption, L"0123456789.:,;(\"~!@#$%^&*')");
TextOutW(hDC, 0, y, szCaption, wcslen(szCaption)); TextOutW(hDC, 0, y, szCaption, (INT)wcslen(szCaption));
y += tm.tmHeight + 1; y += tm.tmHeight + 1;
/* Draw a seperation Line */ /* Draw a seperation Line */
@ -124,12 +124,12 @@ Display_DrawText(HDC hDC, DISPLAYDATA* pData, int nYPos)
for (i = 0; i < MAX_SIZES; i++) for (i = 0; i < MAX_SIZES; i++)
{ {
SelectObject(hDC, pData->hFonts[i]); SelectObject(hDC, pData->hFonts[i]);
TextOutW(hDC, 20, y, pData->szString, wcslen(pData->szString)); TextOutW(hDC, 20, y, pData->szString, (INT)wcslen(pData->szString));
GetTextMetrics(hDC, &tm); GetTextMetrics(hDC, &tm);
y += tm.tmHeight + 1; y += tm.tmHeight + 1;
SelectObject(hDC, pData->hSizeFont); SelectObject(hDC, pData->hSizeFont);
swprintf(szSize, L"%d", pData->nSizes[i]); swprintf(szSize, L"%d", pData->nSizes[i]);
TextOutW(hDC, 0, y - 13 - tm.tmDescent, szSize, wcslen(szSize)); TextOutW(hDC, 0, y - 13 - tm.tmDescent, szSize, (INT)wcslen(szSize));
} }
SelectObject(hDC, hOldFont); SelectObject(hDC, hOldFont);
@ -157,7 +157,7 @@ EnumFontFamProcW(
} }
return TRUE; return TRUE;
} }
static LRESULT static LRESULT
Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont) Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont)
{ {
@ -418,7 +418,7 @@ Display_OnPrint(HWND hwnd)
TEXTMETRIC tm; TEXTMETRIC tm;
int copies, yPos; int copies, yPos;
DISPLAYDATA* pData; DISPLAYDATA* pData;
pData = malloc(sizeof(DISPLAYDATA)); pData = malloc(sizeof(DISPLAYDATA));
ZeroMemory(pData, sizeof(DISPLAYDATA)); ZeroMemory(pData, sizeof(DISPLAYDATA));

View file

@ -104,14 +104,14 @@ WinMain (HINSTANCE hThisInstance,
OPENFILENAMEW fontOpen; OPENFILENAMEW fontOpen;
WCHAR szFileName[MAX_PATH] = L""; WCHAR szFileName[MAX_PATH] = L"";
HLOCAL dialogTitle = NULL; HLOCAL dialogTitle = NULL;
/* Gets the title for the dialog box ready */ /* Gets the title for the dialog box ready */
FormatString(FORMAT_MESSAGE_ALLOCATE_BUFFER, FormatString(FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL, IDS_OPEN, 0, (LPWSTR)&dialogTitle, 0, NULL); NULL, IDS_OPEN, 0, (LPWSTR)&dialogTitle, 0, NULL);
/* Clears out any values of fontOpen before we use it */ /* Clears out any values of fontOpen before we use it */
ZeroMemory(&fontOpen, sizeof(fontOpen)); ZeroMemory(&fontOpen, sizeof(fontOpen));
/* Sets up the open dialog box */ /* Sets up the open dialog box */
fontOpen.lStructSize = sizeof(fontOpen); fontOpen.lStructSize = sizeof(fontOpen);
fontOpen.hwndOwner = NULL; fontOpen.hwndOwner = NULL;
@ -122,7 +122,7 @@ WinMain (HINSTANCE hThisInstance,
fontOpen.nMaxFile = MAX_PATH; fontOpen.nMaxFile = MAX_PATH;
fontOpen.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; fontOpen.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
fontOpen.lpstrDefExt = L"ttf"; fontOpen.lpstrDefExt = L"ttf";
/* Opens up the Open File dialog box in order to chose a font file. */ /* Opens up the Open File dialog box in order to chose a font file. */
if(GetOpenFileNameW(&fontOpen)) if(GetOpenFileNameW(&fontOpen))
{ {
@ -133,7 +133,7 @@ WinMain (HINSTANCE hThisInstance,
exiting the program altogether */ exiting the program altogether */
return 0; return 0;
} }
LocalFree(dialogTitle); LocalFree(dialogTitle);
} }
else else
@ -142,7 +142,7 @@ WinMain (HINSTANCE hThisInstance,
fileName = argv[1]; fileName = argv[1];
g_fileName = fileName; g_fileName = fileName;
} }
if (!AddFontResourceW(fileName)) if (!AddFontResourceW(fileName))
{ {
ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, fileName); ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, fileName);
@ -221,7 +221,7 @@ WinMain (HINSTANCE hThisInstance,
RemoveFontResourceW(argv[1]); RemoveFontResourceW(argv[1]);
return msg.wParam; return (int)msg.wParam;
} }
static LRESULT static LRESULT
@ -326,7 +326,7 @@ static LRESULT
MainWnd_OnInstall(HWND hwnd) MainWnd_OnInstall(HWND hwnd)
{ {
DWORD fontExists; DWORD fontExists;
/* First, we have to find out if the font still exists. */ /* First, we have to find out if the font still exists. */
fontExists = GetFileAttributes((LPCSTR)g_fileName); fontExists = GetFileAttributes((LPCSTR)g_fileName);
if (fontExists != 0xFFFFFFFF) /* If the file does not exist */ if (fontExists != 0xFFFFFFFF) /* If the file does not exist */
@ -334,11 +334,11 @@ MainWnd_OnInstall(HWND hwnd)
ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, g_fileName); ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, g_fileName);
return -1; return -1;
} }
//CopyFile(g_fileName, NULL, TRUE); //CopyFile(g_fileName, NULL, TRUE);
MessageBox(hwnd, TEXT("This function is unimplemented"), TEXT("Unimplemented"), MB_OK); MessageBox(hwnd, TEXT("This function is unimplemented"), TEXT("Unimplemented"), MB_OK);
return 0; return 0;
} }