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
4d1ad4f9
Commit
4d1ad4f9
authored
Feb 06, 2024
by
Daniel Lehman
Committed by
Alexandre Julliard
Feb 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Use scientific notation only for larger numbers in VarBstrFromR[48].
parent
55e4aa7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
vartype.c
dlls/oleaut32/tests/vartype.c
+8
-14
vartype.c
dlls/oleaut32/vartype.c
+13
-5
No files found.
dlls/oleaut32/tests/vartype.c
View file @
4d1ad4f9
...
...
@@ -4525,7 +4525,6 @@ struct r4_test
{
float
val
;
const
wchar_t
*
expect
;
BOOL
todo
;
};
static
void
test_VarBstrFromR4
(
void
)
...
...
@@ -4536,8 +4535,8 @@ static void test_VarBstrFromR4(void)
{
0
.
05
,
L"0.05"
},
{
0
.
005
,
L"0.005"
},
{
0
.
0005
,
L"0.0005"
},
{
0
.
00005
,
L"0.00005"
,
TRUE
},
{
0
.
000005
,
L"0.000005"
,
TRUE
},
{
0
.
00005
,
L"0.00005"
},
{
0
.
000005
,
L"0.000005"
},
{
1.0e8
,
L"1E+08"
},
{
1.0e12
,
L"1E+12"
},
...
...
@@ -4564,8 +4563,8 @@ static void test_VarBstrFromR4(void)
{
0
.
05
,
L"0,05"
},
{
0
.
005
,
L"0,005"
},
{
0
.
0005
,
L"0,0005"
},
{
0
.
00005
,
L"0,00005"
,
TRUE
},
{
0
.
000005
,
L"0,000005"
,
TRUE
},
{
0
.
00005
,
L"0,00005"
},
{
0
.
000005
,
L"0,000005"
},
{
1.0e8
,
L"1E+08"
},
{
1.0e12
,
L"1E+12"
},
...
...
@@ -4648,7 +4647,6 @@ static void test_VarBstrFromR4(void)
ok
(
hres
==
S_OK
,
"got hres 0x%08lx
\n
"
,
hres
);
if
(
bstr
)
{
todo_wine_if
(
cur
->
todo
)
ok
(
wcscmp
(
bstr
,
cur
->
expect
)
==
0
,
"expected '%ls', got '%ls'
\n
"
,
cur
->
expect
,
bstr
);
SysFreeString
(
bstr
);
}
...
...
@@ -4664,7 +4662,6 @@ static void test_VarBstrFromR4(void)
ok
(
hres
==
S_OK
,
"got hres 0x%08lx
\n
"
,
hres
);
if
(
bstr
)
{
todo_wine_if
(
cur
->
todo
)
ok
(
wcscmp
(
bstr
,
cur
->
expect
)
==
0
,
"expected '%ls', got '%ls'
\n
"
,
cur
->
expect
,
bstr
);
SysFreeString
(
bstr
);
}
...
...
@@ -4676,7 +4673,6 @@ struct r8_test
{
double
val
;
const
wchar_t
*
expect
;
BOOL
todo
;
};
static
void
test_VarBstrFromR8
(
void
)
...
...
@@ -4687,8 +4683,8 @@ static void test_VarBstrFromR8(void)
{
0
.
05
,
L"0.05"
},
{
0
.
005
,
L"0.005"
},
{
0
.
0005
,
L"0.0005"
},
{
0
.
00005
,
L"0.00005"
,
TRUE
},
{
0
.
000005
,
L"0.000005"
,
TRUE
},
{
0
.
00005
,
L"0.00005"
},
{
0
.
000005
,
L"0.000005"
},
{
1.0e8
,
L"100000000"
},
{
1.0e12
,
L"1000000000000"
},
...
...
@@ -4715,8 +4711,8 @@ static void test_VarBstrFromR8(void)
{
0
.
05
,
L"0,05"
},
{
0
.
005
,
L"0,005"
},
{
0
.
0005
,
L"0,0005"
},
{
0
.
00005
,
L"0,00005"
,
TRUE
},
{
0
.
000005
,
L"0,000005"
,
TRUE
},
{
0
.
00005
,
L"0,00005"
},
{
0
.
000005
,
L"0,000005"
},
{
1.0e8
,
L"100000000"
},
{
1.0e12
,
L"1000000000000"
},
...
...
@@ -4751,7 +4747,6 @@ static void test_VarBstrFromR8(void)
ok
(
hres
==
S_OK
,
"got hres 0x%08lx
\n
"
,
hres
);
if
(
bstr
)
{
todo_wine_if
(
cur
->
todo
)
ok
(
wcscmp
(
bstr
,
cur
->
expect
)
==
0
,
"expected '%ls', got '%ls'
\n
"
,
cur
->
expect
,
bstr
);
SysFreeString
(
bstr
);
}
...
...
@@ -4767,7 +4762,6 @@ static void test_VarBstrFromR8(void)
ok
(
hres
==
S_OK
,
"got hres 0x%08lx
\n
"
,
hres
);
if
(
bstr
)
{
todo_wine_if
(
cur
->
todo
)
ok
(
wcscmp
(
bstr
,
cur
->
expect
)
==
0
,
"expected '%ls', got '%ls'
\n
"
,
cur
->
expect
,
bstr
);
SysFreeString
(
bstr
);
}
...
...
dlls/oleaut32/vartype.c
View file @
4d1ad4f9
...
...
@@ -6538,16 +6538,24 @@ static BSTR VARIANT_BstrReplaceDecimal(const WCHAR * buff, LCID lcid, ULONG dwFl
}
static
HRESULT
VARIANT_BstrFromReal
(
DOUBLE
dblIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR
*
pbstrOut
,
LPCWSTR
lpszFormat
)
BSTR
*
pbstrOut
,
int
ndigits
)
{
_locale_t
locale
;
WCHAR
buff
[
256
];
WCHAR
*
e
,
buff
[
256
];
int
len
;
if
(
!
pbstrOut
)
return
E_INVALIDARG
;
if
(
!
(
locale
=
_create_locale
(
LC_ALL
,
"C"
)))
return
E_OUTOFMEMORY
;
_swprintf_l
(
buff
,
ARRAY_SIZE
(
buff
),
lpszFormat
,
locale
,
dblIn
);
len
=
_swprintf_l
(
buff
,
ARRAY_SIZE
(
buff
),
L"%.*G"
,
locale
,
ndigits
,
dblIn
);
e
=
wcschr
(
buff
,
'E'
);
if
(
e
&&
labs
(
wcstol
(
e
+
1
,
NULL
,
10
))
<
ndigits
)
{
len
=
_swprintf_l
(
buff
,
ARRAY_SIZE
(
buff
),
L"%.*f"
,
locale
,
ndigits
,
dblIn
);
while
(
len
>
0
&&
(
buff
[
len
-
1
]
==
'0'
))
len
--
;
}
buff
[
len
]
=
0
;
_free_locale
(
locale
);
/* Negative zeroes are disallowed (some applications depend on this).
...
...
@@ -6598,7 +6606,7 @@ static HRESULT VARIANT_BstrFromReal(DOUBLE dblIn, LCID lcid, ULONG dwFlags,
*/
HRESULT
WINAPI
VarBstrFromR4
(
FLOAT
fltIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR
*
pbstrOut
)
{
return
VARIANT_BstrFromReal
(
fltIn
,
lcid
,
dwFlags
,
pbstrOut
,
L"%.7G"
);
return
VARIANT_BstrFromReal
(
fltIn
,
lcid
,
dwFlags
,
pbstrOut
,
7
);
}
/******************************************************************************
...
...
@@ -6619,7 +6627,7 @@ HRESULT WINAPI VarBstrFromR4(FLOAT fltIn, LCID lcid, ULONG dwFlags, BSTR* pbstrO
*/
HRESULT
WINAPI
VarBstrFromR8
(
double
dblIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR
*
pbstrOut
)
{
return
VARIANT_BstrFromReal
(
dblIn
,
lcid
,
dwFlags
,
pbstrOut
,
L"%.15G"
);
return
VARIANT_BstrFromReal
(
dblIn
,
lcid
,
dwFlags
,
pbstrOut
,
15
);
}
/******************************************************************************
...
...
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