Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
05a2c566
Commit
05a2c566
authored
Aug 22, 2008
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Aug 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Fix negative number handling in VarFormat.
parent
b8b3a7d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
varformat.c
dlls/oleaut32/tests/varformat.c
+2
-2
varformat.c
dlls/oleaut32/varformat.c
+25
-1
No files found.
dlls/oleaut32/tests/varformat.c
View file @
05a2c566
...
@@ -369,9 +369,9 @@ static void test_VarFormat(void)
...
@@ -369,9 +369,9 @@ static void test_VarFormat(void)
VARFMT
(
VT_R8
,
V_R8
,
47
.
11
,
".0000E+0"
,
S_OK
,
".4711E+2"
);
VARFMT
(
VT_R8
,
V_R8
,
47
.
11
,
".0000E+0"
,
S_OK
,
".4711E+2"
);
VARFMT
(
VT_R8
,
V_R8
,
3.0401e-13
,
"#####.####e-0%"
,
S_OK
,
"30401.e-15%"
);
VARFMT
(
VT_R8
,
V_R8
,
3.0401e-13
,
"#####.####e-0%"
,
S_OK
,
"30401.e-15%"
);
VARFMT
(
VT_R8
,
V_R8
,
1
.
57
,
"0.00"
,
S_OK
,
"1.57"
);
VARFMT
(
VT_R8
,
V_R8
,
1
.
57
,
"0.00"
,
S_OK
,
"1.57"
);
todo_wine
{
VARFMT
(
VT_R8
,
V_R8
,
-
1
.
57
,
"0.00"
,
S_OK
,
"-1.57"
);
VARFMT
(
VT_R8
,
V_R8
,
-
1
.
57
,
"0.00"
,
S_OK
,
"-1.57"
);
}
VARFMT
(
VT_R8
,
V_R8
,
-
1
.
57
,
"#.##"
,
S_OK
,
"-1.57"
);
VARFMT
(
VT_R8
,
V_R8
,
-
0
.
1
,
".#"
,
S_OK
,
"-.1"
);
/* 'out' is not cleared */
/* 'out' is not cleared */
...
...
dlls/oleaut32/varformat.c
View file @
05a2c566
/*
/*
* Variant formatting functions
* Variant formatting functions
*
*
* Copyright 2008 Damjan Jovanovic
* Copyright 2003 Jon Griffiths
* Copyright 2003 Jon Griffiths
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
...
@@ -1181,6 +1182,7 @@ HRESULT WINAPI VarTokenizeFormatString(LPOLESTR lpszFormat, LPBYTE rgbTok,
...
@@ -1181,6 +1182,7 @@ HRESULT WINAPI VarTokenizeFormatString(LPOLESTR lpszFormat, LPBYTE rgbTok,
/* Number formatting state flags */
/* Number formatting state flags */
#define NUM_WROTE_DEC 0x01
/* Written the decimal separator */
#define NUM_WROTE_DEC 0x01
/* Written the decimal separator */
#define NUM_WRITE_ON 0x02
/* Started to write the number */
#define NUM_WRITE_ON 0x02
/* Started to write the number */
#define NUM_WROTE_SIGN 0x04
/* Written the negative sign */
/* Format a variant using a number format */
/* Format a variant using a number format */
static
HRESULT
VARIANT_FormatNumber
(
LPVARIANT
pVarIn
,
LPOLESTR
lpszFormat
,
static
HRESULT
VARIANT_FormatNumber
(
LPVARIANT
pVarIn
,
LPOLESTR
lpszFormat
,
...
@@ -1320,6 +1322,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
...
@@ -1320,6 +1322,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
{
{
WCHAR
defaultChar
=
'?'
;
WCHAR
defaultChar
=
'?'
;
DWORD
boolFlag
,
localeValue
=
0
;
DWORD
boolFlag
,
localeValue
=
0
;
BOOL
shouldAdvance
=
TRUE
;
if
(
pToken
-
rgbTok
>
header
->
size
)
if
(
pToken
-
rgbTok
>
header
->
size
)
{
{
...
@@ -1377,6 +1380,16 @@ VARIANT_FormatNumber_Bool:
...
@@ -1377,6 +1380,16 @@ VARIANT_FormatNumber_Bool:
break
;
break
;
case
FMT_NUM_DECIMAL
:
case
FMT_NUM_DECIMAL
:
if
((
np
.
dwOutFlags
&
NUMPRS_NEG
)
&&
!
(
dwState
&
NUM_WROTE_SIGN
))
{
/* last chance for a negative sign in the .# case */
TRACE
(
"write negative sign
\n
"
);
localeValue
=
LOCALE_SNEGATIVESIGN
;
defaultChar
=
'-'
;
dwState
|=
NUM_WROTE_SIGN
;
shouldAdvance
=
FALSE
;
break
;
}
TRACE
(
"write decimal separator
\n
"
);
TRACE
(
"write decimal separator
\n
"
);
localeValue
=
LOCALE_SDECIMAL
;
localeValue
=
LOCALE_SDECIMAL
;
defaultChar
=
'.'
;
defaultChar
=
'.'
;
...
@@ -1452,6 +1465,16 @@ VARIANT_FormatNumber_Bool:
...
@@ -1452,6 +1465,16 @@ VARIANT_FormatNumber_Bool:
{
{
int
count
,
count_max
;
int
count
,
count_max
;
if
((
np
.
dwOutFlags
&
NUMPRS_NEG
)
&&
!
(
dwState
&
NUM_WROTE_SIGN
))
{
TRACE
(
"write negative sign
\n
"
);
localeValue
=
LOCALE_SNEGATIVESIGN
;
defaultChar
=
'-'
;
dwState
|=
NUM_WROTE_SIGN
;
shouldAdvance
=
FALSE
;
break
;
}
need_int
-=
pToken
[
1
];
need_int
-=
pToken
[
1
];
count_max
=
have_int
+
pad
-
need_int
;
count_max
=
have_int
+
pad
-
need_int
;
if
(
count_max
<
0
)
if
(
count_max
<
0
)
...
@@ -1504,7 +1527,8 @@ VARIANT_FormatNumber_Bool:
...
@@ -1504,7 +1527,8 @@ VARIANT_FormatNumber_Bool:
*
pBuff
++
=
defaultChar
;
*
pBuff
++
=
defaultChar
;
}
}
}
}
pToken
++
;
if
(
shouldAdvance
)
pToken
++
;
}
}
VARIANT_FormatNumber_Exit:
VARIANT_FormatNumber_Exit:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment