wordpad: Fixed the font size validation for the toolbar's combobox.
This commit is contained in:
parent
536edd7bfc
commit
6fab4754d7
|
@ -219,20 +219,22 @@ static void set_caption(LPCWSTR wszNewFileName)
|
||||||
|
|
||||||
static BOOL validate_endptr(LPCSTR endptr, BOOL units)
|
static BOOL validate_endptr(LPCSTR endptr, BOOL units)
|
||||||
{
|
{
|
||||||
if(!endptr || !*endptr)
|
if(!endptr)
|
||||||
|
return FALSE;
|
||||||
|
if(!*endptr)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
while(*endptr == ' ')
|
while(*endptr == ' ')
|
||||||
endptr++;
|
endptr++;
|
||||||
|
|
||||||
if(!units)
|
if(!units)
|
||||||
return *endptr != '\0';
|
return *endptr == '\0';
|
||||||
|
|
||||||
/* FIXME: Allow other units and convert between them */
|
/* FIXME: Allow other units and convert between them */
|
||||||
if(!lstrcmpA(endptr, units_cmA))
|
if(!lstrcmpA(endptr, units_cmA))
|
||||||
endptr += 2;
|
endptr += 2;
|
||||||
|
|
||||||
return *endptr != '\0';
|
return *endptr == '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL number_from_string(LPCWSTR string, float *num, BOOL units)
|
static BOOL number_from_string(LPCWSTR string, float *num, BOOL units)
|
||||||
|
@ -246,7 +248,7 @@ static BOOL number_from_string(LPCWSTR string, float *num, BOOL units)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
ret = strtod(buffer, &endptr);
|
ret = strtod(buffer, &endptr);
|
||||||
|
|
||||||
if((ret == 0 && errno != 0) || endptr == buffer || validate_endptr(endptr, units))
|
if((ret == 0 && errno != 0) || endptr == buffer || !validate_endptr(endptr, units))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
|
@ -1795,7 +1797,8 @@ static LRESULT OnNotify( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
if(lstrcmpW(sizeBuffer, (LPWSTR)endEdit->szText))
|
if(lstrcmpW(sizeBuffer, (LPWSTR)endEdit->szText))
|
||||||
{
|
{
|
||||||
float size = 0;
|
float size = 0;
|
||||||
if(number_from_string((LPWSTR)endEdit->szText, &size, FALSE))
|
if(number_from_string((LPWSTR)endEdit->szText, &size, FALSE)
|
||||||
|
&& size > 0)
|
||||||
{
|
{
|
||||||
set_size(size);
|
set_size(size);
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue