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
fc5e603c
Commit
fc5e603c
authored
Aug 08, 2021
by
Francois Gouget
Committed by
Alexandre Julliard
Aug 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Add support for longer currency symbols.
Signed-off-by:
Francois Gouget
<
fgouget@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9bd3e3fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
33 deletions
+30
-33
vartest.c
dlls/oleaut32/tests/vartest.c
+2
-2
variant.c
dlls/oleaut32/variant.c
+28
-18
variant.h
dlls/oleaut32/variant.h
+0
-13
No files found.
dlls/oleaut32/tests/vartest.c
View file @
fc5e603c
...
...
@@ -2439,10 +2439,10 @@ static void test_VarParseNumFromStrMisc(void)
/* Windows 8.1 incorrectly doubles the right-to-left mark:
* "\x62f.\x645.\x200f\x200f 5"
*/
todo_wine
ok
(
hres
==
S_OK
||
broken
(
hres
==
DISP_E_TYPEMISMATCH
),
"returned %08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
||
broken
(
hres
==
DISP_E_TYPEMISMATCH
),
"returned %08x
\n
"
,
hres
);
if
(
hres
==
S_OK
)
{
todo_wine
EXPECT
(
1
,
NUMPRS_CURRENCY
|
NUMPRS_USE_ALL
,
NUMPRS_CURRENCY
,
6
,
0
,
0
);
EXPECT
(
1
,
NUMPRS_CURRENCY
|
NUMPRS_USE_ALL
,
NUMPRS_CURRENCY
,
6
,
0
,
0
);
EXPECT2
(
5
,
FAILDIG
);
}
...
...
dlls/oleaut32/variant.c
View file @
fc5e603c
...
...
@@ -1499,6 +1499,19 @@ HRESULT WINAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *lpUdate)
return
S_OK
;
}
/* The localised characters that make up a valid number */
typedef
struct
tagVARIANT_NUMBER_CHARS
{
WCHAR
cNegativeSymbol
;
WCHAR
cPositiveSymbol
;
WCHAR
cDecimalPoint
;
WCHAR
cDigitSeparator
;
DWORD
sCurrencyLen
;
WCHAR
sCurrency
[
8
];
WCHAR
cCurrencyDecimalPoint
;
WCHAR
cCurrencyDigitSeparator
;
}
VARIANT_NUMBER_CHARS
;
#define GET_NUMBER_TEXT(fld,name) \
buff[0] = 0; \
if (!GetLocaleInfoW(lcid, lctype|fld, buff, 2)) \
...
...
@@ -1510,7 +1523,7 @@ HRESULT WINAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *lpUdate)
/* Get the valid number characters for an lcid */
static
void
VARIANT_GetLocalisedNumberChars
(
VARIANT_NUMBER_CHARS
*
lpChars
,
LCID
lcid
,
DWORD
dwFlags
)
{
static
const
VARIANT_NUMBER_CHARS
defaultChars
=
{
'-'
,
'+'
,
'.'
,
0
,
'$'
,
0
,
'.'
,
','
};
static
const
VARIANT_NUMBER_CHARS
defaultChars
=
{
'-'
,
'+'
,
'.'
,
0
,
1
,{
'$'
,
0
}
,
'.'
,
','
};
LCTYPE
lctype
=
dwFlags
&
LOCALE_NOUSEROVERRIDE
;
WCHAR
buff
[
4
];
...
...
@@ -1522,17 +1535,16 @@ static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID
GET_NUMBER_TEXT
(
LOCALE_SMONDECIMALSEP
,
cCurrencyDecimalPoint
);
GET_NUMBER_TEXT
(
LOCALE_SMONTHOUSANDSEP
,
cCurrencyDigitSeparator
);
/* Local currency symbols are often 2 characters */
lpChars
->
cCurrencyLocal2
=
'\0'
;
switch
(
GetLocaleInfoW
(
lcid
,
lctype
|
LOCALE_SCURRENCY
,
buff
,
ARRAY_SIZE
(
buff
)))
if
(
!
GetLocaleInfoW
(
lcid
,
lctype
|
LOCALE_SCURRENCY
,
lpChars
->
sCurrency
,
ARRAY_SIZE
(
lpChars
->
sCurrency
)))
{
case
3
:
lpChars
->
cCurrencyLocal2
=
buff
[
1
];
/* Fall through */
case
2
:
lpChars
->
cCurrencyLocal
=
buff
[
0
];
break
;
default:
WARN
(
"buffer too small for LOCALE_SCURRENCY
\n
"
);
if
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
WARN
(
"buffer too small for LOCALE_SCURRENCY
\n
"
);
*
lpChars
->
sCurrency
=
0
;
}
TRACE
(
"lcid 0x%x, cCurrencyLocal=%d,%d %s
\n
"
,
lcid
,
lpChars
->
cCurrencyLocal
,
lpChars
->
cCurrencyLocal2
,
wine_dbgstr_w
(
buff
));
if
(
!*
lpChars
->
sCurrency
)
wcscpy
(
lpChars
->
sCurrency
,
L"$"
);
lpChars
->
sCurrencyLen
=
wcslen
(
lpChars
->
sCurrency
);
TRACE
(
"lcid 0x%x, sCurrency=%u %s
\n
"
,
lcid
,
lpChars
->
sCurrencyLen
,
wine_dbgstr_w
(
lpChars
->
sCurrency
));
}
/* Number Parsing States */
...
...
@@ -1656,12 +1668,11 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
}
else
if
(
pNumprs
->
dwInFlags
&
NUMPRS_CURRENCY
&&
!
(
pNumprs
->
dwOutFlags
&
NUMPRS_CURRENCY
)
&&
*
lpszStr
==
chars
.
cCurrencyLocal
&&
(
!
chars
.
cCurrencyLocal2
||
lpszStr
[
1
]
==
chars
.
cCurrencyLocal2
))
wcsncmp
(
lpszStr
,
chars
.
sCurrency
,
chars
.
sCurrencyLen
)
==
0
)
{
pNumprs
->
dwOutFlags
|=
NUMPRS_CURRENCY
;
cchUsed
+=
chars
.
cCurrencyLocal2
?
2
:
1
;
lpszStr
+=
chars
.
cCurrencyLocal2
?
2
:
1
;
cchUsed
+=
chars
.
sCurrencyLen
;
lpszStr
+=
chars
.
sCurrencyLen
;
/* Only accept currency characters */
chars
.
cDecimalPoint
=
chars
.
cCurrencyDecimalPoint
;
}
...
...
@@ -1972,12 +1983,11 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla
pNumprs
->
dwOutFlags
|=
NUMPRS_NEG
;
}
else
if
(
pNumprs
->
dwInFlags
&
NUMPRS_CURRENCY
&&
*
lpszStr
==
chars
.
cCurrencyLocal
&&
(
!
chars
.
cCurrencyLocal2
||
lpszStr
[
1
]
==
chars
.
cCurrencyLocal2
))
wcsncmp
(
lpszStr
,
chars
.
sCurrency
,
chars
.
sCurrencyLen
)
==
0
)
{
pNumprs
->
dwOutFlags
|=
NUMPRS_CURRENCY
;
cchUsed
+=
chars
.
cCurrencyLocal2
?
2
:
1
;
lpszStr
+=
chars
.
cCurrencyLocal2
?
2
:
1
;
cchUsed
+=
chars
.
sCurrencyLen
;
lpszStr
+=
chars
.
sCurrencyLen
;
}
else
break
;
...
...
dlls/oleaut32/variant.h
View file @
fc5e603c
...
...
@@ -101,19 +101,6 @@
#define VAR_BOOLYESNO 0x0800
/* Convert bool to "Yes"/"No" */
#define VAR_NEGATIVE 0x1000
/* Number is negative */
/* The localised characters that make up a valid number */
typedef
struct
tagVARIANT_NUMBER_CHARS
{
WCHAR
cNegativeSymbol
;
WCHAR
cPositiveSymbol
;
WCHAR
cDecimalPoint
;
WCHAR
cDigitSeparator
;
WCHAR
cCurrencyLocal
;
WCHAR
cCurrencyLocal2
;
WCHAR
cCurrencyDecimalPoint
;
WCHAR
cCurrencyDigitSeparator
;
}
VARIANT_NUMBER_CHARS
;
unsigned
int
get_type_size
(
ULONG
*
,
VARTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
VARIANT_ClearInd
(
VARIANTARG
*
)
DECLSPEC_HIDDEN
;
BOOL
get_date_format
(
LCID
,
DWORD
,
const
SYSTEMTIME
*
,
...
...
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