Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
872d8f2f
Commit
872d8f2f
authored
Mar 22, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: simplify and fix a warning
parent
a5fded6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
30 deletions
+21
-30
src/text/unicode.c
src/text/unicode.c
+21
-30
No files found.
src/text/unicode.c
View file @
872d8f2f
...
...
@@ -57,7 +57,9 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
return
vfprintf
(
stream
,
fmt
,
ap
);
#else
char
*
str
;
int
res
;
int
res
=
vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
# ifndef UNDER_CE
/* Writing to the console is a lot of fun on Microsoft Windows.
...
...
@@ -67,44 +69,33 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
int
fd
=
_fileno
(
stream
);
if
(
likely
(
fd
!=
-
1
)
&&
_isatty
(
fd
))
{
res
=
vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
size_t
wlen
=
2
*
(
res
+
1
);
wchar_t
*
wide
=
malloc
(
wlen
);
wchar_t
*
wide
=
ToWide
(
str
);
if
(
likely
(
wide
!=
NULL
))
{
wlen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
str
,
res
+
1
,
wide
,
wlen
);
if
(
wlen
>
0
)
{
HANDLE
h
=
(
HANDLE
)(
intptr_t
)
_get_osfhandle
(
fd
);
HANDLE
h
=
(
HANDLE
)((
uintptr_t
)
_get_osfhandle
(
fd
));
DWORD
out
;
WriteConsoleW
(
h
,
wide
,
wlen
-
1
,
&
out
,
NULL
);
}
else
res
=
-
1
;
/* XXX: It is not clear whether WriteConsole() wants the number of
* Unicode characters or the size of the wchar_t array. */
WriteConsoleW
(
h
,
wide
,
wcslen
(
wide
),
&
out
,
NULL
);
free
(
wide
);
}
else
res
=
-
1
;
free
(
str
);
return
res
;
}
else
# endif
res
=
vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
char
*
ansi
=
ToLocaleDup
(
str
);
free
(
str
);
if
(
ansi
==
NULL
)
return
-
1
;
{
char
*
ansi
=
ToANSI
(
str
);
if
(
ansi
!=
NULL
)
{
fputs
(
ansi
,
stream
);
free
(
ansi
);
}
else
res
=
-
1
;
}
free
(
str
);
return
res
;
#endif
}
...
...
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