Changeset cb63940a0b567471603b667c391770309ad15c31
- Timestamp:
- 05/24/08 11:06:24
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1211619984 +0300
- git-parent:
[2b617e77c1f838066916c4a46de7c0e99b38105c]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1211619984 +0300
- Message:
Inline atoll and atof
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2b617e7 |
rcb63940 |
|
| 71 | 71 | #endif |
|---|
| 72 | 72 | |
|---|
| 73 | | #ifndef HAVE_ATOF |
|---|
| 74 | | # define atof vlc_atof |
|---|
| | 73 | #ifndef HAVE_STRTOF |
|---|
| | 74 | # define strtof( a, b ) ((float)strtod (a, b)) |
|---|
| 75 | 75 | #endif |
|---|
| 76 | 76 | |
|---|
| 77 | | #ifndef HAVE_STRTOF |
|---|
| 78 | | # ifdef HAVE_STRTOD |
|---|
| 79 | | # define strtof( a, b ) ((float)strtod (a, b)) |
|---|
| 80 | | # endif |
|---|
| 81 | | #endif |
|---|
| 82 | | |
|---|
| 83 | | #ifndef HAVE_ATOLL |
|---|
| 84 | | # define atoll vlc_atoll |
|---|
| | 77 | #ifndef HAVE_ATOF |
|---|
| | 78 | # define atof( str ) (strtod ((str), (char **)NULL, 10)) |
|---|
| 85 | 79 | #endif |
|---|
| 86 | 80 | |
|---|
| 87 | 81 | #ifndef HAVE_STRTOLL |
|---|
| 88 | 82 | # define strtoll vlc_strtoll |
|---|
| | 83 | #endif |
|---|
| | 84 | |
|---|
| | 85 | #ifndef HAVE_ATOLL |
|---|
| | 86 | # define atoll( str ) (strtoll ((str), (char **)NULL, 10)) |
|---|
| 89 | 87 | #endif |
|---|
| 90 | 88 | |
|---|
| r2b617e7 |
rcb63940 |
|
| 227 | 227 | |
|---|
| 228 | 228 | /***************************************************************************** |
|---|
| 229 | | * atof: convert a string to a double. |
|---|
| 230 | | *****************************************************************************/ |
|---|
| 231 | | #if !defined( HAVE_ATOF ) |
|---|
| 232 | | double vlc_atof( const char *nptr ) |
|---|
| 233 | | { |
|---|
| 234 | | double f_result; |
|---|
| 235 | | wchar_t *psz_tmp = NULL; |
|---|
| 236 | | int i_len = strlen( nptr ) + 1; |
|---|
| 237 | | |
|---|
| 238 | | psz_tmp = malloc( i_len * sizeof(wchar_t) ); |
|---|
| 239 | | if( !psz_tmp ) |
|---|
| 240 | | return NULL; |
|---|
| 241 | | MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len ); |
|---|
| 242 | | f_result = wcstod( psz_tmp, NULL ); |
|---|
| 243 | | free( psz_tmp ); |
|---|
| 244 | | |
|---|
| 245 | | return f_result; |
|---|
| 246 | | } |
|---|
| 247 | | #endif |
|---|
| 248 | | |
|---|
| 249 | | /***************************************************************************** |
|---|
| 250 | 229 | * strtoll: convert a string to a 64 bits int. |
|---|
| 251 | 230 | *****************************************************************************/ |
|---|
| … | … | |
| 319 | 298 | #endif |
|---|
| 320 | 299 | |
|---|
| 321 | | /***************************************************************************** |
|---|
| 322 | | * atoll: convert a string to a 64 bits int. |
|---|
| 323 | | *****************************************************************************/ |
|---|
| 324 | | #if !defined( HAVE_ATOLL ) |
|---|
| 325 | | int64_t vlc_atoll( const char *nptr ) |
|---|
| 326 | | { |
|---|
| 327 | | return strtoll( nptr, (char **)NULL, 10 ); |
|---|
| 328 | | } |
|---|
| 329 | | #endif |
|---|
| 330 | | |
|---|
| 331 | 300 | /** |
|---|
| 332 | 301 | * Copy a string to a sized buffer. The result is always nul-terminated |
|---|
| r2b617e7 |
rcb63940 |
|
| 372 | 372 | vlc_alphasort |
|---|
| 373 | 373 | vlc_asprintf |
|---|
| 374 | | vlc_atof |
|---|
| 375 | | vlc_atoll |
|---|
| 376 | 374 | vlc_b64_decode |
|---|
| 377 | 375 | vlc_b64_decode_binary |
|---|