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
c09f9ef4
Commit
c09f9ef4
authored
Apr 20, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Removed pf_vnsprintf internal function.
parent
bfc2f5f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
695 deletions
+0
-695
msvcrt.h
dlls/msvcrt/msvcrt.h
+0
-18
wcs.c
dlls/msvcrt/wcs.c
+0
-677
No files found.
dlls/msvcrt/msvcrt.h
View file @
c09f9ef4
...
...
@@ -916,24 +916,6 @@ void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_
#define MSVCRT_CHECK_PMT(x) ((x) || (MSVCRT_INVALID_PMT(0),FALSE))
#endif
typedef
struct
pf_output_t
{
int
used
;
int
len
;
BOOL
unicode
;
union
{
LPWSTR
W
;
LPSTR
A
;
}
buf
;
union
{
LPWSTR
W
;
LPSTR
A
;
}
grow
;
}
pf_output
;
int
pf_vsnprintf
(
pf_output
*
out
,
const
WCHAR
*
format
,
MSVCRT__locale_t
locale
,
BOOL
valid
,
__ms_va_list
valist
);
typedef
int
(
*
puts_clbk_a
)(
void
*
,
int
,
const
char
*
);
typedef
int
(
*
puts_clbk_w
)(
void
*
,
int
,
const
MSVCRT_wchar_t
*
);
typedef
union
_printf_arg
...
...
dlls/msvcrt/wcs.c
View file @
c09f9ef4
...
...
@@ -413,683 +413,6 @@ double CDECL MSVCRT__wtof_l(const MSVCRT_wchar_t *str, MSVCRT__locale_t locale)
return
MSVCRT__wcstod_l
(
str
,
NULL
,
locale
);
}
typedef
struct
pf_flags_t
{
char
Sign
,
LeftAlign
,
Alternate
,
PadZero
;
int
FieldLength
,
Precision
;
char
IntegerLength
,
IntegerDouble
;
char
WideString
;
char
Format
;
}
pf_flags
;
static
inline
BOOL
pf_is_auto_grow
(
pf_output
*
out
)
{
return
(
out
->
unicode
)
?
!!
out
->
grow
.
W
:
!!
out
->
grow
.
A
;
}
static
inline
int
pf_check_auto_grow
(
pf_output
*
out
,
unsigned
delta
)
{
if
(
pf_is_auto_grow
(
out
)
&&
out
->
used
+
delta
>
out
->
len
)
{
out
->
len
=
max
(
out
->
len
*
2
,
out
->
used
+
delta
);
if
(
out
->
unicode
)
{
WCHAR
*
ptr
;
if
(
out
->
buf
.
W
!=
out
->
grow
.
W
)
{
if
(
!
(
ptr
=
MSVCRT_realloc
(
out
->
buf
.
W
,
out
->
len
*
sizeof
(
WCHAR
))))
return
-
1
;
}
else
{
if
(
!
(
ptr
=
MSVCRT_malloc
(
out
->
len
*
sizeof
(
WCHAR
))))
return
-
1
;
memcpy
(
ptr
,
out
->
buf
.
W
,
out
->
used
*
sizeof
(
WCHAR
));
}
out
->
buf
.
W
=
ptr
;
}
else
{
char
*
ptr
;
if
(
out
->
buf
.
A
!=
out
->
grow
.
A
)
{
if
(
!
(
ptr
=
MSVCRT_realloc
(
out
->
buf
.
A
,
out
->
len
*
sizeof
(
char
))))
return
-
1
;
}
else
{
if
(
!
(
ptr
=
MSVCRT_malloc
(
out
->
len
*
sizeof
(
char
))))
return
-
1
;
memcpy
(
ptr
,
out
->
buf
.
A
,
out
->
used
*
sizeof
(
char
));
}
out
->
buf
.
A
=
ptr
;
}
}
return
0
;
}
/*
* writes a string of characters to the output
* returns -1 if the string doesn't fit in the output buffer
* return the length of the string if all characters were written
*/
static
inline
int
pf_output_stringW
(
pf_output
*
out
,
LPCWSTR
str
,
int
len
)
{
int
space
;
if
(
len
<
0
)
len
=
strlenW
(
str
);
if
(
out
->
unicode
)
{
LPWSTR
p
;
if
(
pf_check_auto_grow
(
out
,
len
)
==
-
1
)
return
-
1
;
space
=
out
->
len
-
out
->
used
;
p
=
out
->
buf
.
W
+
out
->
used
;
if
(
space
>=
len
)
{
if
(
out
->
buf
.
W
)
memcpy
(
p
,
str
,
len
*
sizeof
(
WCHAR
)
);
out
->
used
+=
len
;
return
len
;
}
if
(
space
>
0
&&
out
->
buf
.
W
)
memcpy
(
p
,
str
,
space
*
sizeof
(
WCHAR
)
);
out
->
used
+=
len
;
}
else
{
int
n
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
,
NULL
,
NULL
);
LPSTR
p
;
if
(
pf_check_auto_grow
(
out
,
n
)
==
-
1
)
return
-
1
;
space
=
out
->
len
-
out
->
used
;
p
=
out
->
buf
.
A
+
out
->
used
;
if
(
space
>=
n
)
{
if
(
out
->
buf
.
A
)
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
len
,
p
,
n
,
NULL
,
NULL
);
out
->
used
+=
n
;
return
len
;
}
if
(
space
>
0
&&
out
->
buf
.
A
)
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
len
,
p
,
space
,
NULL
,
NULL
);
out
->
used
+=
n
;
}
return
-
1
;
}
static
inline
int
pf_output_stringA
(
pf_output
*
out
,
LPCSTR
str
,
int
len
)
{
int
space
;
if
(
len
<
0
)
len
=
strlen
(
str
);
if
(
!
out
->
unicode
)
{
LPSTR
p
;
if
(
pf_check_auto_grow
(
out
,
len
)
==
-
1
)
return
-
1
;
p
=
out
->
buf
.
A
+
out
->
used
;
space
=
out
->
len
-
out
->
used
;
if
(
space
>=
len
)
{
if
(
out
->
buf
.
A
)
memcpy
(
p
,
str
,
len
);
out
->
used
+=
len
;
return
len
;
}
if
(
space
>
0
&&
out
->
buf
.
A
)
memcpy
(
p
,
str
,
space
);
out
->
used
+=
len
;
}
else
{
int
n
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
NULL
,
0
);
LPWSTR
p
;
if
(
pf_check_auto_grow
(
out
,
n
)
==
-
1
)
return
-
1
;
p
=
out
->
buf
.
W
+
out
->
used
;
space
=
out
->
len
-
out
->
used
;
if
(
space
>=
n
)
{
if
(
out
->
buf
.
W
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
p
,
n
);
out
->
used
+=
n
;
return
len
;
}
if
(
space
>
0
&&
out
->
buf
.
W
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
len
,
p
,
space
);
out
->
used
+=
n
;
}
return
-
1
;
}
/* pf_fill: takes care of signs, alignment, zero and field padding */
static
inline
int
pf_fill
(
pf_output
*
out
,
int
len
,
pf_flags
*
flags
,
char
left
)
{
int
i
,
r
=
0
;
if
(
flags
->
Sign
&&
!
(
flags
->
Format
==
'd'
||
flags
->
Format
==
'i'
)
)
flags
->
Sign
=
0
;
if
(
left
&&
flags
->
Sign
)
{
flags
->
FieldLength
--
;
if
(
flags
->
PadZero
)
r
=
pf_output_stringA
(
out
,
&
flags
->
Sign
,
1
);
}
if
(
(
!
left
&&
flags
->
LeftAlign
)
||
(
left
&&
!
flags
->
LeftAlign
))
{
for
(
i
=
0
;
(
i
<
(
flags
->
FieldLength
-
len
))
&&
(
r
>=
0
);
i
++
)
{
if
(
left
&&
flags
->
PadZero
)
r
=
pf_output_stringA
(
out
,
"0"
,
1
);
else
r
=
pf_output_stringA
(
out
,
" "
,
1
);
}
}
if
(
left
&&
flags
->
Sign
&&
!
flags
->
PadZero
)
r
=
pf_output_stringA
(
out
,
&
flags
->
Sign
,
1
);
return
r
;
}
static
inline
int
pf_output_format_W
(
pf_output
*
out
,
LPCWSTR
str
,
int
len
,
pf_flags
*
flags
)
{
int
r
=
0
;
if
(
len
<
0
)
len
=
strlenW
(
str
);
if
(
flags
->
Precision
>=
0
&&
flags
->
Precision
<
len
)
len
=
flags
->
Precision
;
r
=
pf_fill
(
out
,
len
,
flags
,
1
);
if
(
r
>=
0
)
r
=
pf_output_stringW
(
out
,
str
,
len
);
if
(
r
>=
0
)
r
=
pf_fill
(
out
,
len
,
flags
,
0
);
return
r
;
}
static
inline
int
pf_output_format_A
(
pf_output
*
out
,
LPCSTR
str
,
int
len
,
pf_flags
*
flags
)
{
int
r
=
0
;
if
(
len
<
0
)
len
=
strlen
(
str
);
if
(
flags
->
Precision
>=
0
&&
flags
->
Precision
<
len
)
len
=
flags
->
Precision
;
r
=
pf_fill
(
out
,
len
,
flags
,
1
);
if
(
r
>=
0
)
r
=
pf_output_stringA
(
out
,
str
,
len
);
if
(
r
>=
0
)
r
=
pf_fill
(
out
,
len
,
flags
,
0
);
return
r
;
}
static
int
pf_handle_string_format
(
pf_output
*
out
,
const
void
*
str
,
int
len
,
pf_flags
*
flags
,
BOOL
capital_letter
)
{
if
(
str
==
NULL
)
/* catch NULL pointer */
return
pf_output_format_A
(
out
,
"(null)"
,
-
1
,
flags
);
/* prefixes take priority over %c,%s vs. %C,%S, so we handle them first */
if
(
flags
->
WideString
||
flags
->
IntegerLength
==
'l'
)
return
pf_output_format_W
(
out
,
str
,
len
,
flags
);
if
(
flags
->
IntegerLength
==
'h'
)
return
pf_output_format_A
(
out
,
str
,
len
,
flags
);
/* %s,%c -> chars in ansi functions & wchars in unicode
* %S,%C -> wchars in ansi functions & chars in unicode */
if
(
capital_letter
==
out
->
unicode
)
/* either both TRUE or both FALSE */
return
pf_output_format_A
(
out
,
str
,
len
,
flags
);
else
return
pf_output_format_W
(
out
,
str
,
len
,
flags
);
}
static
inline
BOOL
pf_is_integer_format
(
char
fmt
)
{
static
const
char
float_fmts
[]
=
"diouxX"
;
if
(
!
fmt
)
return
FALSE
;
return
strchr
(
float_fmts
,
fmt
)
?
TRUE
:
FALSE
;
}
static
inline
BOOL
pf_is_double_format
(
char
fmt
)
{
static
const
char
float_fmts
[]
=
"aeEfgG"
;
if
(
!
fmt
)
return
FALSE
;
return
strchr
(
float_fmts
,
fmt
)
?
TRUE
:
FALSE
;
}
static
inline
BOOL
pf_is_valid_format
(
char
fmt
)
{
static
const
char
float_fmts
[]
=
"acCdeEfgGinouxX"
;
if
(
!
fmt
)
return
FALSE
;
return
strchr
(
float_fmts
,
fmt
)
?
TRUE
:
FALSE
;
}
static
void
pf_rebuild_format_string
(
char
*
p
,
pf_flags
*
flags
)
{
*
p
++
=
'%'
;
if
(
flags
->
Sign
)
*
p
++
=
flags
->
Sign
;
if
(
flags
->
LeftAlign
)
*
p
++
=
flags
->
LeftAlign
;
if
(
flags
->
Alternate
)
*
p
++
=
flags
->
Alternate
;
if
(
flags
->
PadZero
)
*
p
++
=
flags
->
PadZero
;
if
(
flags
->
FieldLength
)
{
sprintf
(
p
,
"%d"
,
flags
->
FieldLength
);
p
+=
strlen
(
p
);
}
if
(
flags
->
Precision
>=
0
)
{
sprintf
(
p
,
".%d"
,
flags
->
Precision
);
p
+=
strlen
(
p
);
}
*
p
++
=
flags
->
Format
;
*
p
++
=
0
;
}
/* pf_integer_conv: prints x to buf, including alternate formats and
additional precision digits, but not field characters or the sign */
static
void
pf_integer_conv
(
char
*
buf
,
int
buf_len
,
pf_flags
*
flags
,
LONGLONG
x
)
{
unsigned
int
base
;
const
char
*
digits
;
int
i
,
j
,
k
;
char
number
[
40
],
*
tmp
=
number
;
if
(
buf_len
>
sizeof
number
)
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buf_len
);
base
=
10
;
if
(
flags
->
Format
==
'o'
)
base
=
8
;
else
if
(
flags
->
Format
==
'x'
||
flags
->
Format
==
'X'
)
base
=
16
;
if
(
flags
->
Format
==
'X'
)
digits
=
"0123456789ABCDEFX"
;
else
digits
=
"0123456789abcdefx"
;
if
(
x
<
0
&&
(
flags
->
Format
==
'd'
||
flags
->
Format
==
'i'
)
)
{
x
=
-
x
;
flags
->
Sign
=
'-'
;
}
/* Do conversion (backwards) */
i
=
0
;
if
(
x
==
0
&&
flags
->
Precision
)
tmp
[
i
++
]
=
'0'
;
else
while
(
x
!=
0
)
{
j
=
(
ULONGLONG
)
x
%
base
;
x
=
(
ULONGLONG
)
x
/
base
;
tmp
[
i
++
]
=
digits
[
j
];
}
k
=
flags
->
Precision
-
i
;
while
(
k
--
>
0
)
tmp
[
i
++
]
=
'0'
;
if
(
flags
->
Alternate
)
{
if
(
base
==
16
)
{
tmp
[
i
++
]
=
digits
[
16
];
tmp
[
i
++
]
=
'0'
;
}
else
if
(
base
==
8
&&
tmp
[
i
-
1
]
!=
'0'
)
tmp
[
i
++
]
=
'0'
;
}
/* Reverse for buf */
j
=
0
;
while
(
i
--
>
0
)
buf
[
j
++
]
=
tmp
[
i
];
buf
[
j
]
=
'\0'
;
/* Adjust precision so pf_fill won't truncate the number later */
flags
->
Precision
=
strlen
(
buf
);
if
(
tmp
!=
number
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
return
;
}
/* pf_fixup_exponent: convert a string containing a 2 digit exponent
to 3 digits, accounting for padding, in place. Needed to match
the native printf's which always use 3 digits. */
static
void
pf_fixup_exponent
(
char
*
buf
)
{
char
*
tmp
=
buf
;
while
(
tmp
[
0
]
&&
toupper
(
tmp
[
0
])
!=
'E'
)
tmp
++
;
if
(
tmp
[
0
]
&&
(
tmp
[
1
]
==
'+'
||
tmp
[
1
]
==
'-'
)
&&
isdigit
(
tmp
[
2
])
&&
isdigit
(
tmp
[
3
]))
{
char
final
;
if
(
isdigit
(
tmp
[
4
]))
return
;
/* Exponent already 3 digits */
/* We have a 2 digit exponent. Prepend '0' to make it 3 */
tmp
+=
2
;
final
=
tmp
[
2
];
tmp
[
2
]
=
tmp
[
1
];
tmp
[
1
]
=
tmp
[
0
];
tmp
[
0
]
=
'0'
;
if
(
final
==
'\0'
)
{
/* We didn't expand into trailing space, so this string isn't left
* justified. Terminate the string and strip a ' ' at the start of
* the string if there is one (as there may be if the string is
* right justified).
*/
tmp
[
3
]
=
'\0'
;
if
(
buf
[
0
]
==
' '
)
memmove
(
buf
,
buf
+
1
,
(
tmp
-
buf
)
+
3
);
}
/* Otherwise, we expanded into trailing space -> nothing to do */
}
}
/*********************************************************************
* pf_vsnprintf (INTERNAL)
*
* implements both A and W vsnprintf functions
*/
int
pf_vsnprintf
(
pf_output
*
out
,
const
WCHAR
*
format
,
MSVCRT__locale_t
locale
,
BOOL
valid
,
__ms_va_list
valist
)
{
int
r
;
LPCWSTR
q
,
p
=
format
;
pf_flags
flags
;
if
(
!
locale
)
locale
=
get_locale
();
TRACE
(
"format is %s
\n
"
,
debugstr_w
(
format
));
while
(
*
p
)
{
q
=
strchrW
(
p
,
'%'
);
/* there's no % characters left, output the rest of the string */
if
(
!
q
)
{
r
=
pf_output_stringW
(
out
,
p
,
-
1
);
if
(
r
<
0
)
return
r
;
p
+=
r
;
continue
;
}
/* there's characters before the %, output them */
if
(
q
!=
p
)
{
r
=
pf_output_stringW
(
out
,
p
,
q
-
p
);
if
(
r
<
0
)
return
r
;
p
=
q
;
}
/* we must be at a % now, skip over it */
assert
(
*
p
==
'%'
);
p
++
;
/* output a single % character */
if
(
*
p
==
'%'
)
{
r
=
pf_output_stringW
(
out
,
p
++
,
1
);
if
(
r
<
0
)
return
r
;
continue
;
}
/* parse the flags */
memset
(
&
flags
,
0
,
sizeof
flags
);
while
(
*
p
)
{
if
(
*
p
==
'+'
||
*
p
==
' '
)
{
if
(
flags
.
Sign
!=
'+'
)
flags
.
Sign
=
*
p
;
}
else
if
(
*
p
==
'-'
)
flags
.
LeftAlign
=
*
p
;
else
if
(
*
p
==
'0'
)
flags
.
PadZero
=
*
p
;
else
if
(
*
p
==
'#'
)
flags
.
Alternate
=
*
p
;
else
break
;
p
++
;
}
/* deal with the field width specifier */
flags
.
FieldLength
=
0
;
if
(
*
p
==
'*'
)
{
flags
.
FieldLength
=
va_arg
(
valist
,
int
);
if
(
flags
.
FieldLength
<
0
)
{
flags
.
LeftAlign
=
'-'
;
flags
.
FieldLength
=
-
flags
.
FieldLength
;
}
p
++
;
}
else
while
(
isdigit
(
*
p
)
)
{
flags
.
FieldLength
*=
10
;
flags
.
FieldLength
+=
*
p
++
-
'0'
;
}
/* deal with precision */
flags
.
Precision
=
-
1
;
if
(
*
p
==
'.'
)
{
flags
.
Precision
=
0
;
p
++
;
if
(
*
p
==
'*'
)
{
flags
.
Precision
=
va_arg
(
valist
,
int
);
p
++
;
}
else
while
(
isdigit
(
*
p
)
)
{
flags
.
Precision
*=
10
;
flags
.
Precision
+=
*
p
++
-
'0'
;
}
}
/* deal with integer width modifier */
while
(
*
p
)
{
if
(
*
p
==
'l'
&&
*
(
p
+
1
)
==
'l'
)
{
flags
.
IntegerDouble
++
;
p
+=
2
;
}
else
if
(
*
p
==
'h'
||
*
p
==
'l'
||
*
p
==
'L'
)
{
flags
.
IntegerLength
=
*
p
;
p
++
;
}
else
if
(
*
p
==
'I'
)
{
if
(
*
(
p
+
1
)
==
'6'
&&
*
(
p
+
2
)
==
'4'
)
{
flags
.
IntegerDouble
++
;
p
+=
3
;
}
else
if
(
*
(
p
+
1
)
==
'3'
&&
*
(
p
+
2
)
==
'2'
)
p
+=
3
;
else
if
(
isdigit
(
*
(
p
+
1
))
||
*
(
p
+
1
)
==
0
)
break
;
else
p
++
;
}
else
if
(
*
p
==
'w'
)
flags
.
WideString
=
*
p
++
;
else
if
(
*
p
==
'F'
)
p
++
;
/* ignore */
else
break
;
}
flags
.
Format
=
*
p
;
r
=
0
;
if
(
flags
.
Format
==
'$'
)
{
FIXME
(
"Positional parameters are not supported (%s)
\n
"
,
wine_dbgstr_w
(
format
));
return
-
1
;
}
/* output a string */
if
(
flags
.
Format
==
's'
||
flags
.
Format
==
'S'
)
r
=
pf_handle_string_format
(
out
,
va_arg
(
valist
,
const
void
*
),
-
1
,
&
flags
,
(
flags
.
Format
==
'S'
)
);
/* output a single character */
else
if
(
flags
.
Format
==
'c'
||
flags
.
Format
==
'C'
)
{
INT
ch
=
va_arg
(
valist
,
int
);
r
=
pf_handle_string_format
(
out
,
&
ch
,
1
,
&
flags
,
(
flags
.
Format
==
'C'
)
);
}
/* output a pointer */
else
if
(
flags
.
Format
==
'p'
)
{
char
pointer
[
32
];
void
*
ptr
=
va_arg
(
valist
,
void
*
);
flags
.
PadZero
=
0
;
if
(
flags
.
Alternate
)
sprintf
(
pointer
,
"0X%0*lX"
,
2
*
(
int
)
sizeof
(
ptr
),
(
ULONG_PTR
)
ptr
);
else
sprintf
(
pointer
,
"%0*lX"
,
2
*
(
int
)
sizeof
(
ptr
),
(
ULONG_PTR
)
ptr
);
r
=
pf_output_format_A
(
out
,
pointer
,
-
1
,
&
flags
);
}
/* deal with %n */
else
if
(
flags
.
Format
==
'n'
)
{
int
*
x
=
va_arg
(
valist
,
int
*
);
*
x
=
out
->
used
;
}
/* deal with 64-bit integers */
else
if
(
pf_is_integer_format
(
flags
.
Format
)
&&
flags
.
IntegerDouble
)
{
char
number
[
40
],
*
x
=
number
;
/* Estimate largest possible required buffer size:
* Chooses the larger of the field or precision
* Includes extra bytes: 1 byte for null, 1 byte for sign,
4 bytes for exponent, 2 bytes for alternate formats, 1 byte
for a decimal, and 1 byte for an additional float digit. */
int
x_len
=
((
flags
.
FieldLength
>
flags
.
Precision
)
?
flags
.
FieldLength
:
flags
.
Precision
)
+
10
;
if
(
x_len
>=
sizeof
number
)
x
=
HeapAlloc
(
GetProcessHeap
(),
0
,
x_len
);
pf_integer_conv
(
x
,
x_len
,
&
flags
,
va_arg
(
valist
,
LONGLONG
)
);
r
=
pf_output_format_A
(
out
,
x
,
-
1
,
&
flags
);
if
(
x
!=
number
)
HeapFree
(
GetProcessHeap
(),
0
,
x
);
}
/* deal with integers and floats using libc's printf */
else
if
(
pf_is_valid_format
(
flags
.
Format
)
)
{
char
fmt
[
20
],
number
[
40
],
*
x
=
number
,
*
decimal_point
;
/* Estimate largest possible required buffer size:
* Chooses the larger of the field or precision
* Includes extra bytes: 1 byte for null, 1 byte for sign,
4 bytes for exponent, 2 bytes for alternate formats, 1 byte
for a decimal, and 1 byte for an additional float digit. */
int
x_len
=
((
flags
.
FieldLength
>
flags
.
Precision
)
?
flags
.
FieldLength
:
flags
.
Precision
)
+
10
;
if
(
x_len
>=
sizeof
number
)
x
=
HeapAlloc
(
GetProcessHeap
(),
0
,
x_len
);
pf_rebuild_format_string
(
fmt
,
&
flags
);
if
(
pf_is_double_format
(
flags
.
Format
)
)
{
sprintf
(
x
,
fmt
,
va_arg
(
valist
,
double
)
);
if
(
toupper
(
flags
.
Format
)
==
'E'
||
toupper
(
flags
.
Format
)
==
'G'
)
pf_fixup_exponent
(
x
);
}
else
sprintf
(
x
,
fmt
,
va_arg
(
valist
,
int
)
);
decimal_point
=
strchr
(
x
,
'.'
);
if
(
decimal_point
)
*
decimal_point
=
*
locale
->
locinfo
->
lconv
->
decimal_point
;
r
=
pf_output_stringA
(
out
,
x
,
-
1
);
if
(
x
!=
number
)
HeapFree
(
GetProcessHeap
(),
0
,
x
);
if
(
r
<
0
)
return
r
;
}
else
{
if
(
valid
)
{
MSVCRT__invalid_parameter
(
NULL
,
NULL
,
NULL
,
0
,
0
);
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
-
1
;
}
continue
;
}
if
(
r
<
0
)
return
r
;
p
++
;
}
/* check we reached the end, and null terminate the string */
assert
(
*
p
==
0
);
pf_output_stringW
(
out
,
p
,
1
);
return
out
->
used
-
1
;
}
/*********************************************************************
* arg_clbk_valist (INTERNAL)
*/
...
...
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