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
bbcc3288
Commit
bbcc3288
authored
Jan 24, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bindtextdomain: cleanup and fix error handling
parent
48ad4156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
src/modules/textdomain.c
src/modules/textdomain.c
+24
-23
No files found.
src/modules/textdomain.c
View file @
bbcc3288
...
...
@@ -35,30 +35,38 @@
int
vlc_bindtextdomain
(
const
char
*
domain
)
{
int
ret
=
0
;
#if defined (ENABLE_NLS)
/* Specify where to find the locales for current domain */
# if !defined (__APPLE__) && !defined (WIN32)
static
const
char
path
[]
=
LOCALEDIR
;
if
(
bindtextdomain
(
domain
,
path
)
==
NULL
)
{
fprintf
(
stderr
,
"%s: text domain not found in %s
\n
"
,
domain
,
path
);
return
-
1
;
}
# else
char
*
path
=
config_GetDataDirDefault
();
char
*
buf
;
char
*
datadir
=
config_GetDataDirDefault
();
if
(
unlikely
(
datadir
==
NULL
))
return
-
1
;
if
(
unlikely
(
path
==
NULL
))
char
*
upath
;
int
ret
=
asprintf
(
&
upath
,
"%s"
DIR_SEP
"locale"
,
datadir
);
free
(
datadir
);
if
(
unlikely
(
ret
==
-
1
))
return
-
1
;
ret
=
asprintf
(
&
buf
,
"%s"
DIR_SEP
"locale"
,
path
);
free
(
path
);
path
=
ToLocaleDup
(
buf
);
free
(
buf
);
# endif
if
(
bindtextdomain
(
domain
,
path
)
==
NULL
)
char
*
lpath
=
ToLocaleDup
(
upath
);
if
(
lpath
==
NULL
||
bindtextdomain
(
domain
,
lpath
)
==
NULL
)
{
fprintf
(
stderr
,
"%s: text domain not found in %s
\n
"
,
domain
,
path
);
ret
=
-
1
;
goto
out
;
free
(
lpath
);
fprintf
(
stderr
,
"%s: text domain not found in %s
\n
"
,
domain
,
upath
);
free
(
upath
);
return
-
1
;
}
free
(
lpath
);
free
(
upath
);
# endif
/* LibVLC wants all messages in UTF-8.
* Unfortunately, we cannot ask UTF-8 for strerror_r(), strsignal_r()
...
...
@@ -69,24 +77,17 @@ int vlc_bindtextdomain (const char *domain)
fprintf
(
stderr
,
"%s: UTF-8 encoding bot available
\n
"
,
domain
);
// Unbinds the text domain to avoid broken encoding
bindtextdomain
(
PACKAGE_NAME
,
"/DOES_NOT_EXIST"
);
ret
=
-
1
;
goto
out
;
return
-
1
;
}
/* LibVLC does NOT set the default textdomain, since it is a library.
* This could otherwise break programs using LibVLC (other than VLC).
* textdomain (PACKAGE_NAME);
*/
out:
# if defined (__APPLE__) || defined (WIN32)
free
(
path
);
# endif
#else
/* !ENABLE_NLS */
(
void
)
domain
;
#endif
return
ret
;
return
0
;
}
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