ICU-4689 Check return count from uscript_getCode() to detect bad script name. Don't continue if building the font map fails.

X-SVN-Rev: 18350
This commit is contained in:
Eric Mader 2005-07-25 23:53:32 +00:00
parent c899b908ff
commit 62bbc0ae15
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/* /*
****************************************************************************** ******************************************************************************
* Copyright (C) 1998-2003, International Business Machines Corporation and * * Copyright (C) 1998-2005, International Business Machines Corporation and *
* others. All Rights Reserved. * * others. All Rights Reserved. *
****************************************************************************** ******************************************************************************
*/ */
@ -66,10 +66,10 @@ FontMap::FontMap(const char *fileName, le_int16 pointSize, GUISupport *guiSuppor
continue; continue;
} }
uscript_getCode(scriptName, &scriptCode, 1, &scriptStatus); le_int32 fillCount = uscript_getCode(scriptName, &scriptCode, 1, &scriptStatus);
if (U_FAILURE(scriptStatus) || scriptStatus == U_USING_FALLBACK_WARNING || if (U_FAILURE(scriptStatus) || fillCount <= 0 ||
scriptStatus == U_USING_DEFAULT_WARNING) { scriptStatus == U_USING_FALLBACK_WARNING || scriptStatus == U_USING_DEFAULT_WARNING) {
sprintf(errorMessage, "The script name %s is invalid.", line); sprintf(errorMessage, "The script name %s is invalid.", line);
fGUISupport->postErrorMessage(errorMessage, "Font Map Error"); fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
status = LE_ILLEGAL_ARGUMENT_ERROR; status = LE_ILLEGAL_ARGUMENT_ERROR;

View File

@ -1,7 +1,7 @@
/* /*
******************************************************************************* *******************************************************************************
* *
* Copyright (C) 1999-2003, International Business Machines * Copyright (C) 1999-2005, International Business Machines
* Corporation and others. All Rights Reserved. * Corporation and others. All Rights Reserved.
* *
******************************************************************************* *******************************************************************************
@ -137,7 +137,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (LE_FAILURE(fontStatus)) { if (LE_FAILURE(fontStatus)) {
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
return 0; return -1;
} }
context = new Context(); context = new Context();
@ -321,7 +321,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_HELP_ABOUTLAYOUTSAMPLE: case IDM_HELP_ABOUTLAYOUTSAMPLE:
MessageBox(hwnd, TEXT("Windows Layout Sample 0.1\n") MessageBox(hwnd, TEXT("Windows Layout Sample 0.1\n")
TEXT("Copyright (C) 1998-2002 By International Business Machines Corporation and others.\n") TEXT("Copyright (C) 1998-2005 By International Business Machines Corporation and others.\n")
TEXT("Author: Eric Mader"), TEXT("Author: Eric Mader"),
szAppName, MB_ICONINFORMATION | MB_OK); szAppName, MB_ICONINFORMATION | MB_OK);
return 0; return 0;
@ -334,7 +334,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
context = (Context *) GetWindowLong(hwnd, 0); context = (Context *) GetWindowLong(hwnd, 0);
if (context->paragraph != NULL) { if (context != NULL && context->paragraph != NULL) {
delete context->paragraph; delete context->paragraph;
} }