Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
506ff74b
Commit
506ff74b
authored
Aug 25, 2008
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Aug 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Thousands separator support for VarFormat.
parent
b31766fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
4 deletions
+49
-4
varformat.c
dlls/oleaut32/tests/varformat.c
+3
-2
varformat.c
dlls/oleaut32/varformat.c
+46
-2
No files found.
dlls/oleaut32/tests/varformat.c
View file @
506ff74b
...
...
@@ -324,9 +324,10 @@ static void test_VarFormat(void)
VARFMT
(
VT_I4
,
V_I4
,
1
,
"000###"
,
S_OK
,
"000001"
);
VARFMT
(
VT_I4
,
V_I4
,
1
,
"#00##00#0"
,
S_OK
,
"00000001"
);
VARFMT
(
VT_I4
,
V_I4
,
1
,
"1#####0000"
,
S_OK
,
"10001"
);
todo_wine
{
VARFMT
(
VT_I4
,
V_I4
,
100000
,
"#,###,###,###"
,
S_OK
,
"100,000"
);
}
VARFMT
(
VT_I4
,
V_I4
,
1
,
"0,000,000,000"
,
S_OK
,
"0,000,000,001"
);
VARFMT
(
VT_I4
,
V_I4
,
123456789
,
"#,#.#"
,
S_OK
,
"123,456,789."
);
VARFMT
(
VT_I4
,
V_I4
,
123456789
,
"###, ###, ###"
,
S_OK
,
"123, 456, 789"
);
VARFMT
(
VT_R8
,
V_R8
,
1
.
23456789
,
"0#.0#0#0#0#0"
,
S_OK
,
"01.234567890"
);
VARFMT
(
VT_R8
,
V_R8
,
1
.
2
,
"0#.0#0#0#0#0"
,
S_OK
,
"01.200000000"
);
VARFMT
(
VT_R8
,
V_R8
,
9
.
87654321
,
"#0.#0#0#0#0#"
,
S_OK
,
"9.87654321"
);
...
...
dlls/oleaut32/varformat.c
View file @
506ff74b
...
...
@@ -1193,6 +1193,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
NUMPARSE
np
;
int
have_int
,
need_int
=
0
,
have_frac
,
need_frac
,
exponent
=
0
,
pad
=
0
;
WCHAR
buff
[
256
],
*
pBuff
=
buff
;
WCHAR
thousandSeparator
[
32
];
VARIANT
vString
,
vBool
;
DWORD
dwState
=
0
;
FMT_HEADER
*
header
=
(
FMT_HEADER
*
)
rgbTok
;
...
...
@@ -1315,6 +1316,16 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
have_int
,
need_int
,
have_frac
,
need_frac
,
pad
,
exponent
);
}
if
(
numHeader
->
flags
&
FMT_FLAG_THOUSANDS
)
{
if
(
!
GetLocaleInfoW
(
lcid
,
LOCALE_STHOUSAND
,
thousandSeparator
,
sizeof
(
thousandSeparator
)
/
sizeof
(
WCHAR
)))
{
thousandSeparator
[
0
]
=
','
;
thousandSeparator
[
1
]
=
0
;
}
}
pToken
=
(
const
BYTE
*
)
numHeader
+
sizeof
(
FMT_NUMBER_HEADER
);
prgbDig
=
rgbDig
;
...
...
@@ -1463,7 +1474,7 @@ VARIANT_FormatNumber_Bool:
}
else
{
int
count
,
count_max
;
int
count
,
count_max
,
position
;
if
((
np
.
dwOutFlags
&
NUMPRS_NEG
)
&&
!
(
dwState
&
NUM_WROTE_SIGN
))
{
...
...
@@ -1475,6 +1486,9 @@ VARIANT_FormatNumber_Bool:
break
;
}
position
=
have_int
+
pad
;
if
(
dwState
&
NUM_WRITE_ON
)
position
=
max
(
position
,
need_int
);
need_int
-=
pToken
[
1
];
count_max
=
have_int
+
pad
-
need_int
;
if
(
count_max
<
0
)
...
...
@@ -1484,25 +1498,55 @@ VARIANT_FormatNumber_Bool:
count
=
pToken
[
1
]
-
count_max
;
TRACE
(
"write %d leading zeros
\n
"
,
count
);
while
(
count
--
>
0
)
{
*
pBuff
++
=
'0'
;
if
((
numHeader
->
flags
&
FMT_FLAG_THOUSANDS
)
&&
position
>
1
&&
(
--
position
%
3
)
==
0
)
{
int
k
;
TRACE
(
"write thousand separator
\n
"
);
for
(
k
=
0
;
thousandSeparator
[
k
];
k
++
)
*
pBuff
++
=
thousandSeparator
[
k
];
}
}
}
if
(
*
pToken
==
FMT_NUM_COPY_ZERO
||
have_int
>
1
||
(
have_int
>
0
&&
*
prgbDig
>
0
))
{
dwState
|=
NUM_WRITE_ON
;
count
=
min
(
count_max
,
have_int
);
count_max
-=
count
;
have_int
-=
count
;
TRACE
(
"write %d whole number digits
\n
"
,
count
);
while
(
count
--
)
{
dwState
|=
NUM_WRITE_ON
;
*
pBuff
++
=
'0'
+
*
prgbDig
++
;
if
((
numHeader
->
flags
&
FMT_FLAG_THOUSANDS
)
&&
position
>
1
&&
(
--
position
%
3
)
==
0
)
{
int
k
;
TRACE
(
"write thousand separator
\n
"
);
for
(
k
=
0
;
thousandSeparator
[
k
];
k
++
)
*
pBuff
++
=
thousandSeparator
[
k
];
}
}
}
count
=
min
(
count_max
,
pad
);
count_max
-=
count
;
pad
-=
count
;
TRACE
(
"write %d whole trailing 0's
\n
"
,
count
);
while
(
count
--
)
{
*
pBuff
++
=
'0'
;
if
((
numHeader
->
flags
&
FMT_FLAG_THOUSANDS
)
&&
position
>
1
&&
(
--
position
%
3
)
==
0
)
{
int
k
;
TRACE
(
"write thousand separator
\n
"
);
for
(
k
=
0
;
thousandSeparator
[
k
];
k
++
)
*
pBuff
++
=
thousandSeparator
[
k
];
}
}
}
pToken
++
;
break
;
...
...
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