Mercurial > dwindows
comparison os2/dw.c @ 116:bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
positions.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 19 Oct 2002 00:13:23 +0000 |
parents | 108674099806 |
children | d785ee5adf02 |
comparison
equal
deleted
inserted
replaced
115:2d121d4d90c0 | 116:bb039d7407f0 |
---|---|
1578 } | 1578 } |
1579 | 1579 |
1580 void _dw_int_set(HWND hwnd, int pos) | 1580 void _dw_int_set(HWND hwnd, int pos) |
1581 { | 1581 { |
1582 int inew, range = dw_percent_query_range(hwnd); | 1582 int inew, range = dw_percent_query_range(hwnd); |
1583 float fpos = (float)pos; | 1583 if(range) |
1584 float frange = (float)range; | 1584 { |
1585 float fnew = (fpos/frange)*1000.0; | 1585 float fpos = (float)pos; |
1586 inew = (int)fnew; | 1586 float frange = (float)range; |
1587 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); | 1587 float fnew = (fpos/frange)*1000.0; |
1588 inew = (int)fnew; | |
1589 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); | |
1590 } | |
1588 } | 1591 } |
1589 | 1592 |
1590 /* Handle size changes in the percent class */ | 1593 /* Handle size changes in the percent class */ |
1591 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1594 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1592 { | 1595 { |