[vlc-devel] [vlc-commits] Skins2: port Win32 code to UNICODE

Rémi Denis-Courmont remi at remlab.net
Tue Jan 15 09:01:35 CET 2013


> @@ -477,10 +478,10 @@ void Win32Factory::changeCursor( CursorType_t type
)
> const
>  
>  void Win32Factory::rmDir( const string &rPath )
>  {
> -    WIN32_FIND_DATA find;
> +    WIN32_FIND_DATAA find;
>      string file;
>      string findFiles = rPath + "\\*";
> -    HANDLE handle    = FindFirstFile( findFiles.c_str(), &find );
> +    HANDLE handle    = FindFirstFileA( findFiles.c_str(), &find );
>  
>      while( handle != INVALID_HANDLE_VALUE )
>      {

That does not look very UNICODE to me. IIRC, there is a long standing bug
report about Skins2 being broken on Unicode file systems.

> @@ -498,18 +499,18 @@ void Win32Factory::rmDir( const string &rPath )
>              // Else, it is a file so simply delete it
>              else
>              {
> -                DeleteFile( file.c_str() );
> +                DeleteFileA( file.c_str() );
>              }
>          }
>  
>          // If no more file in directory, exit while
> -        if( !FindNextFile( handle, &find ) )
> +        if( !FindNextFileA( handle, &find ) )
>              break;
>      }
>  
>      // Now directory is empty so can be removed
>      FindClose( handle );
> -    RemoveDirectory( rPath.c_str() );
> +    RemoveDirectoryA( rPath.c_str() );
>  }
>  
>  #endif
> diff --git a/modules/gui/skins2/win32/win32_popup.cpp
> b/modules/gui/skins2/win32/win32_popup.cpp
> index e2ac6a8..05b0094 100644
> --- a/modules/gui/skins2/win32/win32_popup.cpp
> +++ b/modules/gui/skins2/win32/win32_popup.cpp
> @@ -74,7 +74,7 @@ void Win32Popup::addItem( const string &rLabel, int
pos )
>  //     menuItem.fType = MFT_STRING;
>      menuItem.fMask = MIIM_ID | MIIM_STRING;
>      menuItem.wID = pos;
> -    menuItem.dwTypeData = (char*)rLabel.c_str();
> +    menuItem.dwTypeData = ToT(rLabel.c_str());
>      menuItem.cch = rLabel.size();
>  
>      InsertMenuItem( m_hMenu, findInsertionPoint( pos ), TRUE, &menuItem
);

Memory leak.


-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list