Changeset 8b81fec859b8975d71336c3fe1886b4878a7c192
- Timestamp:
- 02/13/06 11:47:43
(3 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1139827663 +0000
- git-parent:
[99ca63cb29503eea8276e82eba910f8595dab208]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1139827663 +0000
- Message:
- memleak fix
- getcwd() unicode fix
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r543574f |
r8b81fec |
|
| 536 | 536 | char *psz_filename_base; |
|---|
| 537 | 537 | |
|---|
| 538 | | if( psz_dir && !*psz_dir ) |
|---|
| | 538 | if( ( psz_dir != NULL ) && ( psz_dir[0] == '\0' ) ) |
|---|
| 539 | 539 | { |
|---|
| 540 | 540 | free( psz_dir ); |
|---|
| 541 | | psz_dir = 0; |
|---|
| 542 | | } |
|---|
| 543 | | |
|---|
| 544 | | if( !psz_dir ) |
|---|
| | 541 | psz_dir = NULL; |
|---|
| | 542 | } |
|---|
| | 543 | |
|---|
| | 544 | if( psz_dir == NULL ) |
|---|
| 545 | 545 | { |
|---|
| 546 | 546 | #ifdef WIN32 |
|---|
| | 547 | char psz_local_dir[MAX_PATH]; |
|---|
| 547 | 548 | int i_size; |
|---|
| 548 | 549 | |
|---|
| 549 | | psz_dir = malloc( MAX_PATH + 1 ); |
|---|
| 550 | | i_size = GetTempPath( MAX_PATH, psz_dir ); |
|---|
| | 550 | i_size = GetTempPath( MAX_PATH, psz_local_dir ); |
|---|
| 551 | 551 | if( i_size <= 0 || i_size > MAX_PATH ) |
|---|
| 552 | 552 | { |
|---|
| 553 | | if( !getcwd( psz_dir, MAX_PATH ) ) strcpy( psz_dir, "c:" ); |
|---|
| 554 | | } |
|---|
| | 553 | if( !getcwd( psz_local_dir, MAX_PATH ) ) |
|---|
| | 554 | strcpy( psz_local_dir, "C:" ); |
|---|
| | 555 | } |
|---|
| | 556 | |
|---|
| | 557 | psz_dir = FromLocaleDup( MAX_PATH + 1 ); |
|---|
| 555 | 558 | |
|---|
| 556 | 559 | /* remove last \\ if any */ |
|---|
| … | … | |
| 558 | 561 | psz_dir[strlen(psz_dir)-1] = '\0'; |
|---|
| 559 | 562 | #else |
|---|
| 560 | | |
|---|
| 561 | 563 | psz_dir = strdup( "/tmp" ); |
|---|
| 562 | 564 | #endif |
|---|
| … | … | |
| 565 | 567 | asprintf( &psz_filename_base, "%s/vlc-timeshift-%d-%d-", |
|---|
| 566 | 568 | psz_dir, getpid(), p_access->i_object_id ); |
|---|
| | 569 | free( psz_dir ); |
|---|
| 567 | 570 | |
|---|
| 568 | 571 | return psz_filename_base; |
|---|