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
5a290897
Commit
5a290897
authored
Nov 27, 2002
by
Bill Medland
Committed by
Alexandre Julliard
Nov 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct GetNumberFormatA for zero decimals and for zero grouping.
parent
04b10544
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
locale.c
dlls/kernel/tests/locale.c
+18
-0
ole2nls.c
ole/ole2nls.c
+4
-1
No files found.
dlls/kernel/tests/locale.c
View file @
5a290897
...
@@ -285,6 +285,7 @@ void TestGetNumberFormat()
...
@@ -285,6 +285,7 @@ void TestGetNumberFormat()
int
ret
,
error
,
cmp
;
int
ret
,
error
,
cmp
;
char
buffer
[
BUFFER_SIZE
],
Expected
[
BUFFER_SIZE
],
input
[
BUFFER_SIZE
];
char
buffer
[
BUFFER_SIZE
],
Expected
[
BUFFER_SIZE
],
input
[
BUFFER_SIZE
];
LCID
lcid
;
LCID
lcid
;
NUMBERFMTA
format
;
lcid
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
lcid
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
);
...
@@ -319,6 +320,23 @@ LCID lcid;
...
@@ -319,6 +320,23 @@ LCID lcid;
cmp
=
strncmp
(
Expected
,
buffer
,
BUFFER_SIZE
);
cmp
=
strncmp
(
Expected
,
buffer
,
BUFFER_SIZE
);
ok
(
cmp
==
0
,
"GetNumberFormat got %s instead of %s"
,
buffer
,
Expected
);
ok
(
cmp
==
0
,
"GetNumberFormat got %s instead of %s"
,
buffer
,
Expected
);
eq
(
ret
,
strlen
(
Expected
)
+
1
,
"GetNumberFormat"
,
"%d"
);
eq
(
ret
,
strlen
(
Expected
)
+
1
,
"GetNumberFormat"
,
"%d"
);
/* If the number of decimals is zero there should be no decimal
* separator.
* If the grouping size is zero there should be no grouping symbol
*/
format
.
NumDigits
=
0
;
format
.
LeadingZero
=
0
;
format
.
Grouping
=
0
;
format
.
NegativeOrder
=
0
;
format
.
lpDecimalSep
=
"."
;
format
.
lpThousandSep
=
","
;
strcpy
(
Expected
,
"123456789"
);
memset
(
buffer
,
'x'
,
sizeof
(
buffer
)
/
sizeof
(
buffer
[
0
])
);
ret
=
GetNumberFormatA
(
0
,
0
,
"123456789.0"
,
&
format
,
buffer
,
sizeof
(
buffer
));
cmp
=
strncmp
(
Expected
,
buffer
,
sizeof
(
buffer
));
ok
(
cmp
==
0
,
"GetNumberFormat got %s instead of %s"
,
buffer
,
Expected
);
}
}
...
...
ole/ole2nls.c
View file @
5a290897
...
@@ -2230,6 +2230,7 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
...
@@ -2230,6 +2230,7 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
sprintf
(
sNumberDigits
,
"%d"
,
lpFormat
->
NumDigits
);
sprintf
(
sNumberDigits
,
"%d"
,
lpFormat
->
NumDigits
);
strcpy
(
sDecimalSymbol
,
lpFormat
->
lpDecimalSep
);
strcpy
(
sDecimalSymbol
,
lpFormat
->
lpDecimalSep
);
sprintf
(
sDigitsInGroup
,
"%d;0"
,
lpFormat
->
Grouping
);
sprintf
(
sDigitsInGroup
,
"%d;0"
,
lpFormat
->
Grouping
);
/* Win95-WinME only allow 0-9 for grouping, no matter what MSDN says. */
strcpy
(
sDigitGroupSymbol
,
lpFormat
->
lpThousandSep
);
strcpy
(
sDigitGroupSymbol
,
lpFormat
->
lpThousandSep
);
sprintf
(
sILZero
,
"%d"
,
lpFormat
->
LeadingZero
);
sprintf
(
sILZero
,
"%d"
,
lpFormat
->
LeadingZero
);
sprintf
(
sNegNumber
,
"%d"
,
lpFormat
->
NegativeOrder
);
sprintf
(
sNegNumber
,
"%d"
,
lpFormat
->
NegativeOrder
);
...
@@ -2275,6 +2276,8 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
...
@@ -2275,6 +2276,8 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
nStep
=
nCounter
=
i
=
j
=
0
;
nStep
=
nCounter
=
i
=
j
=
0
;
nRuleIndex
=
1
;
nRuleIndex
=
1
;
nGrouping
=
OLE_GetGrouping
(
sRule
,
nRuleIndex
);
nGrouping
=
OLE_GetGrouping
(
sRule
,
nRuleIndex
);
if
(
nGrouping
==
0
)
/* If the first grouping is zero */
nGrouping
=
nNumberDecimal
;
/* Don't do grouping */
/* Here, we will loop until we reach the end of the string.
/* Here, we will loop until we reach the end of the string.
* An internal counter (j) is used in order to know when to
* An internal counter (j) is used in order to know when to
...
@@ -2343,7 +2346,7 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
...
@@ -2343,7 +2346,7 @@ INT WINAPI GetNumberFormatA(LCID locale, DWORD dwflags,
for
(
i
=
0
;
i
<
j
;
i
++
)
for
(
i
=
0
;
i
<
j
;
i
++
)
memcpy
(
sNumber
+
nCounter
+
i
+
strlen
(
sDecimalSymbol
),
sDigitsAfterDecimal
+
i
,
1
);
memcpy
(
sNumber
+
nCounter
+
i
+
strlen
(
sDecimalSymbol
),
sDigitsAfterDecimal
+
i
,
1
);
memcpy
(
sNumber
+
nCounter
+
i
+
strlen
(
sDecimalSymbol
),
"
\0
"
,
1
);
memcpy
(
sNumber
+
nCounter
+
i
+
(
i
?
strlen
(
sDecimalSymbol
)
:
0
),
"
\0
"
,
1
);
/* Is it a negative number */
/* Is it a negative number */
if
(
bNegative
==
TRUE
)
if
(
bNegative
==
TRUE
)
...
...
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