Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
0ad2d338
Commit
0ad2d338
authored
Aug 21, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utf8_vfprintf(): simplify
parent
130ff9a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
25 deletions
+12
-25
src/text/unicode.c
src/text/unicode.c
+12
-25
No files found.
src/text/unicode.c
View file @
0ad2d338
...
...
@@ -197,36 +197,19 @@ char *ToLocaleDup (const char *utf8)
#endif
}
/**
* Formats an UTF-8 string as vasprintf(), then print it to stdout, with
* appropriate conversion to local encoding.
*/
static
int
utf8_vasprintf
(
char
**
str
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
utf8
;
int
res
=
vasprintf
(
&
utf8
,
fmt
,
ap
);
if
(
res
==
-
1
)
return
-
1
;
#ifdef ASSUME_UTF8
*
str
=
utf8
;
#else
*
str
=
ToLocaleDup
(
utf8
);
free
(
utf8
);
#endif
return
res
;
}
/**
* Formats an UTF-8 string as vfprintf(), then print it, with
* appropriate conversion to local encoding.
*/
int
utf8_vfprintf
(
FILE
*
stream
,
const
char
*
fmt
,
va_list
ap
)
{
#ifdef ASSUME_UTF8
return
vfprintf
(
stream
,
fmt
,
ap
);
#else
char
*
str
;
int
res
;
#if defined( WIN32 ) && !defined( UNDER_CE )
#
if defined( WIN32 ) && !defined( UNDER_CE )
/* Writing to the console is a lot of fun on Microsoft Windows.
* If you use the standard I/O functions, you must use the OEM code page,
* which is different from the usual ANSI code page. Or maybe not, if the
...
...
@@ -259,15 +242,19 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
free
(
str
);
return
res
;
}
#endif
#
endif
res
=
utf8_
vasprintf
(
&
str
,
fmt
,
ap
);
res
=
vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
fputs
(
str
,
stream
);
free
(
str
);
char
*
ansi
=
ToLocaleDup
(
str
);
free
(
str
);
fputs
(
ansi
,
stream
);
free
(
ansi
);
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