Commit 8978e821 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32 ANSI -> Unicode + UTF-8 wrappers

parent 7554c22c
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "vlc_image.h" #include "vlc_image.h"
#include "vlc_spu.h" #include "vlc_spu.h"
#include "vlc_strings.h" #include "vlc_strings.h"
#include "charset.h"
#include <snapshot.h> #include <snapshot.h>
...@@ -564,7 +565,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -564,7 +565,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
char *p_mypicturesdir = NULL; char *p_mypicturesdir = NULL;
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
LPSTR ); LPWSTR );
#ifndef CSIDL_FLAG_CREATE #ifndef CSIDL_FLAG_CREATE
# define CSIDL_FLAG_CREATE 0x8000 # define CSIDL_FLAG_CREATE 0x8000
#endif #endif
...@@ -581,24 +582,16 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -581,24 +582,16 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
/* load the shfolder dll to retrieve SHGetFolderPath */ /* load the shfolder dll to retrieve SHGetFolderPath */
if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
{ {
SHGetFolderPath = (void *)GetProcAddress( shfolder_dll, wchar_t wdir[PATH_MAX];
_T("SHGetFolderPathA") ); SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
if( SHGetFolderPath != NULL ) _T("SHGetFolderPathW") );
{ if ((SHGetFolderPath != NULL )
p_mypicturesdir = (char *)malloc( MAX_PATH ); && SUCCEEDED (SHGetFolderPath (NULL,
if( p_mypicturesdir ) CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
{ NULL, SHGFP_TYPE_CURRENT,
wdir)))
if( S_OK != SHGetFolderPath( NULL, p_mypictureswdir = FromWide (wdir);
CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT,
p_mypicturesdir ) )
{
free( p_mypicturesdir );
p_mypicturesdir = NULL;
}
}
}
FreeLibrary( shfolder_dll ); FreeLibrary( shfolder_dll );
} }
...@@ -637,7 +630,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -637,7 +630,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
/* /*
* Did the user specify a directory? If not, path = NULL. * Did the user specify a directory? If not, path = NULL.
*/ */
path = opendir ( (const char *)val.psz_string ); path = utf8_opendir ( (const char *)val.psz_string );
if ( path != NULL ) if ( path != NULL )
{ {
...@@ -654,7 +647,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -654,7 +647,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
asprintf( &psz_filename, "%s/%s%05d.%s", val.psz_string, asprintf( &psz_filename, "%s/%s%05d.%s", val.psz_string,
psz_prefix, i_num++, format.psz_string ); psz_prefix, i_num++, format.psz_string );
} }
while( ( p_file = fopen( psz_filename, "r" ) ) && !fclose( p_file ) ); while( ( p_file = utf8_fopen( psz_filename, "r" ) ) && !fclose( p_file ) );
var_SetInteger( p_vout, "snapshot-num", i_num ); var_SetInteger( p_vout, "snapshot-num", i_num );
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment