At least I tried. ;)
Magnus Olsen wrote:
Hi you fix are not right
the problem is for convert was
1. it did not rember wich format it should convert from
2. it did not convert the text buffer to right format
3. Bin did need complete bit translate
it have been fix in lates trunks. and it have been on my todo list pretty
long time.
----- Original Message -----
From: "Jerry" <crashfourit(a)gmail.com>
To: <ros-dev(a)reactos.org>
Sent: den 18 December 2005 06:17
Subject: [ros-dev] Re: [ros-bugs] [Bug 1149] Calculator bug
I think I got it fixed. Hear's the diff:
Index: subsys/system/calc/winecalc.c
===================================================================
--- subsys/system/calc/winecalc.c (revision 20239)
+++ subsys/system/calc/winecalc.c (working copy)
@@ -755,32 +755,34 @@
{
int i;
int w = LOWORD(wParam);
+ int Base;
+ calcfloat r;
+
+ r = calc_atof(calc.buffer, calc.numBase);
if (w == ID_CALC_NS_HEX) {
- if (calc.numBase == NBASE_HEX)
- return 0;
- else
- calc.numBase = NBASE_HEX;
+ Base = NBASE_HEX;
}
else if (w == ID_CALC_NS_DEC) {
- if (calc.numBase == NBASE_DECIMAL)
- return 0;
- else
- calc.numBase = NBASE_DECIMAL;
+ Base = NBASE_DECIMAL;
+
}
else if (w == ID_CALC_NS_OCT) {
- if (calc.numBase == NBASE_OCTAL)
- return 0;
- else
- calc.numBase = NBASE_OCTAL;
+ Base = NBASE_OCTAL;
}
else if (w == ID_CALC_NS_BIN) {
- if (calc.numBase == NBASE_BINARY)
+ Base = NBASE_BINARY;
+ }
+
+ if (calc.numBase == Base){
return 0;
- else
- calc.numBase = NBASE_BINARY;
+ } else {
+ calc.numBase = Base;
}
+
+ calc_ftoa(&calc, r, calc.buffer);
+
for (i=0;i<CALC_NS_COUNT;i++)
SendMessage(calc.cb[60+i].hBtn, BM_SETCHECK, w ==
(ID_CALC_NS_HEX + i) ? 1 : 0, 0);
@@ -2944,16 +2946,23 @@
switch (calc->numBase) {
case NBASE_HEX:
- real = calc_atof(calc->buffer, calc->numBase);
- _stprintf(calc->display, TEXT("%lx"), (long)real);
+ //real = calc_atof(calc->buffer, calc->numBase);
+ //_stprintf(calc->display, TEXT("%lx"), (long)real);
+ //_stprintf(calc->display, TEXT("%lX"), calc->buffer);
+ _stprintf(calc->display, TEXT("%s"), calc->buffer);
break;
case NBASE_OCTAL:
- _stprintf(calc->display, TEXT("%lo"), (long)calc->buffer);
+ //real = calc_atof(calc->buffer, calc->numBase);
+ //_stprintf(calc->display, TEXT("%lo"), (long)real);
+ //_stprintf(calc->display, TEXT("%lo"), (long)calc->buffer);
+ _stprintf(calc->display, TEXT("%s"), calc->buffer);
break;
case NBASE_BINARY:
- _stprintf(calc->display, TEXT("%lx"), (long)calc->buffer);
+
+ //_stprintf(calc->display, TEXT("%lx"), (long)calc->buffer);
+ _stprintf(calc->display, TEXT("%s"), calc->buffer);
break;
case NBASE_DECIMAL:
@@ -3229,8 +3238,15 @@
case NBASE_OCTAL:
_stprintf(buf, TEXT("%lo"), (long)r);
break;
- case NBASE_BINARY: // 911 - need routine here
-
+ case NBASE_BINARY: // 911 - need routine here
+ {
+ int x;
+ for(x=0; x < sizeof(calcfloat); x++){
+ if (( (long)r & (1<<( (sizeof(calcfloat)-1) -x ))) == 1<<(
(sizeof(calcfloat)-1) -x ) ) buf[x] = '1'; else buf[x] = '0';
+
+ };
+ buf[sizeof(calcfloat)]='\0';
+ }
break;
default:
break;
/* End of Diff */
Tell me if it works or not, please. Thanks.
ReactOS.Bugzilla(a)reactos.org wrote:
>http://www.reactos.org/bugzilla/show_bug.cgi?id=1149
>
>
>
>
>
>------- Additional Comments From crashfourit(a)gmail.com 2005-12-18 05:27
>
>
CET -------
No, I hadd
the same problem in WinXP. I'm in the process of fixing it.
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev