mirror of
https://github.com/reactos/reactos.git
synced 2024-10-30 11:35:58 +00:00
calc_buffer_display():
eliminate unnecessary copying ( and potential buffer overrun ) eliminate variable naming conflicts svn path=/trunk/; revision=18550
This commit is contained in:
parent
67d9667289
commit
547d458153
|
@ -2938,7 +2938,6 @@ void calc_buffer_format(CALC *calc) {
|
||||||
void calc_buffer_display(CALC *calc) {
|
void calc_buffer_display(CALC *calc) {
|
||||||
TCHAR *p;
|
TCHAR *p;
|
||||||
TCHAR s[CALC_BUF_SIZE];
|
TCHAR s[CALC_BUF_SIZE];
|
||||||
TCHAR r[CALC_BUF_SIZE] = TEXT("0");
|
|
||||||
int point=0;
|
int point=0;
|
||||||
calcfloat real;
|
calcfloat real;
|
||||||
|
|
||||||
|
@ -2966,11 +2965,10 @@ void calc_buffer_display(CALC *calc) {
|
||||||
else {
|
else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int lz = 0;
|
int lz = 0;
|
||||||
calcfloat r;
|
|
||||||
int exp = 0;
|
int exp = 0;
|
||||||
|
|
||||||
r = calc_atof(calc->buffer, calc->numBase);
|
real = calc_atof(calc->buffer, calc->numBase);
|
||||||
_stprintf(s, FMT_DESC_EXP, r);
|
_stprintf(s, FMT_DESC_EXP, real);
|
||||||
// remove leading zeros in exponent
|
// remove leading zeros in exponent
|
||||||
p = s;
|
p = s;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
|
@ -3026,13 +3024,11 @@ void calc_buffer_display(CALC *calc) {
|
||||||
if (!point && calc->numBase == NBASE_DECIMAL)
|
if (!point && calc->numBase == NBASE_DECIMAL)
|
||||||
_tcscat(s, TEXT("."));
|
_tcscat(s, TEXT("."));
|
||||||
|
|
||||||
if (*s == TEXT('.')) {
|
if (*s == TEXT('.'))
|
||||||
_tcscat(r, s);
|
_tcscpy(calc->display, TEXT("0"));
|
||||||
_tcscpy(calc->display, r);
|
else
|
||||||
}
|
calc->display[0] = 0;
|
||||||
else {
|
_tcscat(calc->display, s);
|
||||||
_tcscpy(calc->display, s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InvalidateRect(calc->hWnd, NULL, FALSE);
|
InvalidateRect(calc->hWnd, NULL, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue