Re: NumericBox unsafe double conversion

2013-03-22 Thread Zolnai Tamás
Hi Kendy, Yes, I give it a try. Great, thanks a lot! :-) Well, I said I'm interested in this cleanup, but just until it is not too far from my tasks. :) I used NumericBox to derive from it while implementing LimitBox and I'd like to allow the user adding values unlimitedly, so the only limit

Re: NumericBox unsafe double conversion

2013-03-22 Thread Stephan Bergmann
On 03/22/2013 11:44 AM, Zolnai Tamás wrote: Otherwise in ImplNumericGetValue() the problem of overflow/underflow can be avoid with these lines sal_Int64 nValue = aStr.toInt64() if( OUString::valueOf(nValue) != aStr ) { if( bNegative ) rValue = SAL_MIN_INT64; else

Re: NumericBox unsafe double conversion

2013-03-22 Thread Zolnai Tamás
2013/3/22 Stephan Bergmann sberg...@redhat.com On 03/22/2013 11:44 AM, Zolnai Tamás wrote: Otherwise in ImplNumericGetValue() the problem of overflow/underflow can be avoid with these lines sal_Int64 nValue = aStr.toInt64() if( OUString::valueOf(nValue) != aStr ) { if( bNegative )

Re: NumericBox unsafe double conversion

2013-03-22 Thread Stephan Bergmann
On 03/22/2013 02:50 PM, Zolnai Tamás wrote: From that matter, why is that the toInt64() function doesn't pay attention on overflow/underflow? Maybe it would simpler to handle these flows in that function. Yes, letting the toIntegral functions return zero in case of overflow, similarly to the

Re: NumericBox unsafe double conversion

2013-03-21 Thread Jan Holesovsky
Hi Tamás, Zolnai Tamás píše v St 20. 03. 2013 v 22:33 +0100: Yes, I give it a try. Great, thanks a lot! :-) I think the mentioned multiplication is in MetricField::ConvertDoubleValue(), which not need to change, as I see. So whenever we are converting to and from double, there is the risk

Re: NumericBox unsafe double conversion

2013-03-20 Thread Jan Holesovsky
Hi Tamás, Zolnai Tamás píše v Po 18. 03. 2013 v 17:56 +0100: And the problem was found in this function, in line 199: double nValue = rtl::OUString(aStr).toDouble(); In general the NumericBox store its data in an sal_Int64 variable, but here this OUString-double conversion cause changes

Re: NumericBox unsafe double conversion

2013-03-20 Thread Zolnai Tamás
Hi Kendy, 2013/3/20 Jan Holesovsky ke...@suse.cz Hi Tamás, Zolnai Tamás píše v Po 18. 03. 2013 v 17:56 +0100: And the problem was found in this function, in line 199: double nValue = rtl::OUString(aStr).toDouble(); In general the NumericBox store its data in an sal_Int64 variable,

Re: NumericBox unsafe double conversion

2013-03-18 Thread Jan Holesovsky
Hi Tamás, Zolnai Tamás píše v Pá 15. 03. 2013 v 13:39 +0100: I'm working with NumericBox nowadays and I recognised a problem belong to it. This class is a ComboBox which allows only numeric values. It use sal_Int64 for store its value but use double conversion internal for remformating.

NumericBox unsafe double conversion

2013-03-15 Thread Zolnai Tamás
Hi All, . I'm working with NumericBox nowadays and I recognised a problem belong to it. This class is a ComboBox which allows only numeric values. It use sal_Int64 for store its value but use double conversion internal for remformating. The problem is that this concept allows adding such