Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
0950551c
Commit
0950551c
authored
Jan 30, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error handling in (From|To)Locale
parent
9a1afdac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
src/libvlc.c
src/libvlc.c
+21
-9
No files found.
src/libvlc.c
View file @
0950551c
/*****************************************************************************
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-200
4
the VideoLAN team
* Copyright (C) 1998-200
6
the VideoLAN team
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@videolan.org>
* Derk-Jan Hartman <hartman at videolan dot org>
* Rémi Denis-Courmont <rem # videolan : org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -41,6 +42,7 @@
#include <stdio.h>
/* sprintf() */
#include <string.h>
/* strerror() */
#include <stdlib.h>
/* free() */
#include <assert.h>
#ifndef WIN32
# include <netinet/in.h>
/* BSD: struct in_addr */
...
...
@@ -2708,10 +2710,10 @@ char *FromLocale( const char *locale )
* to non-const.
*/
inb
=
strlen
(
locale
);
outb
=
inb
*
6
+
1
;
/* FIXME: I'm not sure about the value for the multiplication
* (for western people, multiplication by 3 (Latin9) is sufficient) */
outb
=
inb
*
6
+
1
;
optr
=
output
=
calloc
(
outb
,
1
);
vlc_mutex_lock
(
&
libvlc
.
from_locale_lock
);
...
...
@@ -2720,14 +2722,19 @@ char *FromLocale( const char *locale )
while
(
vlc_iconv
(
libvlc
.
from_locale
,
&
iptr
,
&
inb
,
&
optr
,
&
outb
)
==
(
size_t
)
-
1
)
{
*
optr
=
'?'
;
o
ptr
++
;
*
optr
++
=
'?'
;
o
utb
--
;
iptr
++
;
inb
--
;
vlc_iconv
(
libvlc
.
from_locale
,
NULL
,
NULL
,
NULL
,
NULL
);
}
vlc_mutex_unlock
(
&
libvlc
.
from_locale_lock
);
return
realloc
(
output
,
strlen
(
output
)
+
1
);
assert
(
inb
==
0
);
assert
(
*
iptr
==
'\0'
);
assert
(
*
optr
==
'\0'
);
assert
(
strlen
(
output
)
==
(
size_t
)(
optr
-
output
));
return
realloc
(
output
,
optr
-
output
+
1
);
}
return
(
char
*
)
locale
;
}
...
...
@@ -2761,14 +2768,19 @@ char *ToLocale( const char *utf8 )
while
(
vlc_iconv
(
libvlc
.
to_locale
,
&
iptr
,
&
inb
,
&
optr
,
&
outb
)
==
(
size_t
)
-
1
)
{
*
optr
=
'?'
;
/* should not happen, and yes, it sucks */
o
ptr
++
;
*
optr
++
=
'?'
;
/* should not happen, and yes, it sucks */
o
utb
--
;
iptr
++
;
inb
--
;
vlc_iconv
(
libvlc
.
to_locale
,
NULL
,
NULL
,
NULL
,
NULL
);
}
vlc_mutex_unlock
(
&
libvlc
.
to_locale_lock
);
return
realloc
(
output
,
strlen
(
output
)
+
1
);
assert
(
inb
==
0
);
assert
(
*
iptr
==
'\0'
);
assert
(
*
optr
==
'\0'
);
assert
(
strlen
(
output
)
==
(
size_t
)(
optr
-
output
));
return
realloc
(
output
,
optr
-
output
+
1
);
}
return
(
char
*
)
utf8
;
}
...
...
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