Changeset 1a4ae5679d635d3393cdd9747ce42730c15d20f0
- Timestamp:
- 06/08/05 21:09:54
(3 years ago)
- Author:
- Cyril Deguet <asmax@videolan.org>
- git-committer:
- Cyril Deguet <asmax@videolan.org> 1123355394 +0000
- git-parent:
[9bcabfdad2c9d6a9a6da67e9395367da180c7b78]
- git-author:
- Cyril Deguet <asmax@videolan.org> 1123355394 +0000
- Message:
- charset.c: don't return a pointer to a buffer allocated on the stack!
- all: removed some warnings
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfe087a3 |
r1a4ae56 |
|
| 40 | 40 | #endif |
|---|
| 41 | 41 | |
|---|
| 42 | | #define SCROLL_STEP 0.05 |
|---|
| | 42 | #define SCROLL_STEP 0.05f |
|---|
| 43 | 43 | #define LINE_INTERVAL 1 // Number of pixels inserted between 2 lines |
|---|
| 44 | 44 | |
|---|
| rfe087a3 |
r1a4ae56 |
|
| 36 | 36 | |
|---|
| 37 | 37 | #define RANGE 40 |
|---|
| 38 | | #define SCROLL_STEP 0.05 |
|---|
| | 38 | #define SCROLL_STEP 0.05f |
|---|
| 39 | 39 | |
|---|
| 40 | 40 | |
|---|
| rfe087a3 |
r1a4ae56 |
|
| 45 | 45 | #ifndef M_PI |
|---|
| 46 | 46 | # define M_PI 3.14159265358979323846 |
|---|
| | 47 | #endif |
|---|
| | 48 | |
|---|
| | 49 | #ifdef _MSC_VER |
|---|
| | 50 | // turn off 'warning C4355: 'this' : used in base member initializer list' |
|---|
| | 51 | #pragma warning ( disable:4355 ) |
|---|
| 47 | 52 | #endif |
|---|
| 48 | 53 | |
|---|
| r22f2fa6 |
r1a4ae56 |
|
| 216 | 216 | /* Avoid depending on library functions or files |
|---|
| 217 | 217 | whose names are inconsistent. */ |
|---|
| 218 | | |
|---|
| 219 | | char *getenv(); |
|---|
| 220 | 218 | |
|---|
| 221 | 219 | static char * |
|---|
| r9bcabfd |
r1a4ae56 |
|
| 259 | 259 | playlist_t *p_playlist; |
|---|
| 260 | 260 | vlc_value_t val; |
|---|
| | 261 | #if defined( ENABLE_NLS ) \ |
|---|
| | 262 | && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) ) |
|---|
| 261 | 263 | char * psz_language; |
|---|
| | 264 | #endif |
|---|
| 262 | 265 | |
|---|
| 263 | 266 | if( !p_vlc ) |
|---|
| rf9d13dd |
r1a4ae56 |
|
| 204 | 204 | /* Returns charset from "language_COUNTRY.charset@modifier" string */ |
|---|
| 205 | 205 | #if defined WIN32 || defined OS2 || !HAVE_LANGINFO_CODESET |
|---|
| 206 | | static const char *vlc_encoding_from_locale( char *psz_locale ) |
|---|
| | 206 | static void vlc_encoding_from_locale( char *psz_locale, char *psz_charset ) |
|---|
| 207 | 207 | { |
|---|
| 208 | 208 | char *psz_dot = strchr( psz_locale, '.' ); |
|---|
| … | … | |
| 211 | 211 | { |
|---|
| 212 | 212 | const char *psz_modifier; |
|---|
| 213 | | char buf[2 + 10 + 1]; |
|---|
| 214 | 213 | |
|---|
| 215 | 214 | psz_dot++; |
|---|
| … | … | |
| 219 | 218 | |
|---|
| 220 | 219 | if( psz_modifier == NULL ) |
|---|
| 221 | | return psz_dot; |
|---|
| | 220 | { |
|---|
| | 221 | strcpy( psz_charset, psz_dot ); |
|---|
| | 222 | return; |
|---|
| | 223 | } |
|---|
| 222 | 224 | if( 0 < ( psz_modifier - psz_dot ) |
|---|
| 223 | | && ( psz_modifier - psz_dot ) < sizeof( buf )) |
|---|
| 224 | | { |
|---|
| 225 | | memcpy( buf, psz_dot, psz_modifier - psz_dot ); |
|---|
| 226 | | buf[ psz_modifier - psz_dot ] = '\0'; |
|---|
| 227 | | return buf; |
|---|
| | 225 | && ( psz_modifier - psz_dot ) < 2 + 10 + 1 ) |
|---|
| | 226 | { |
|---|
| | 227 | memcpy( psz_charset, psz_dot, psz_modifier - psz_dot ); |
|---|
| | 228 | psz_charset[ psz_modifier - psz_dot ] = '\0'; |
|---|
| | 229 | return; |
|---|
| 228 | 230 | } |
|---|
| 229 | 231 | } |
|---|
| 230 | 232 | /* try language mapping */ |
|---|
| 231 | | return vlc_encoding_from_language( psz_locale ); |
|---|
| | 233 | strcpy( psz_charset, vlc_encoding_from_language( psz_locale ) ); |
|---|
| 232 | 234 | } |
|---|
| 233 | 235 | #endif |
|---|
| … | … | |
| 245 | 247 | /* On old systems which lack it, use setlocale or getenv. */ |
|---|
| 246 | 248 | const char *psz_locale = NULL; |
|---|
| | 249 | char buf[2 + 10 + 1]; |
|---|
| 247 | 250 | |
|---|
| 248 | 251 | /* But most old systems don't have a complete set of locales. Some |
|---|
| … | … | |
| 266 | 269 | /* On some old systems, one used to set locale = "iso8859_1". On others, |
|---|
| 267 | 270 | * you set it to "language_COUNTRY.charset". Darwin only has LANG :( */ |
|---|
| 268 | | psz_codeset = vlc_encoding_from_locale( (char *)psz_locale ); |
|---|
| | 271 | vlc_encoding_from_locale( (char *)psz_locale, buf ); |
|---|
| | 272 | psz_codeset = buf; |
|---|
| 269 | 273 | # endif /* HAVE_LANGINFO_CODESET */ |
|---|
| 270 | 274 | |
|---|
| … | … | |
| 299 | 303 | } |
|---|
| 300 | 304 | if( psz_locale != NULL && psz_locale[0] != '\0' ) |
|---|
| 301 | | psz_codeset = vlc_encoding_from_locale( psz_locale ); |
|---|
| | 305 | vlc_encoding_from_locale( psz_locale, buf ); |
|---|
| | 306 | psz_codeset = buf; |
|---|
| 302 | 307 | else |
|---|
| 303 | 308 | { |
|---|