Commit 095ad3e1 authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Rémi Duraffort

OS/2 uses the same file operations as Win32

Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 462a34d4
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) && !defined( UNDER_CE )
# include <io.h> # include <io.h>
# define lseek _lseeki64 # define lseek _lseeki64
#elif defined( __OS2__ )
# include <io.h>
#else #else
# include <unistd.h> # include <unistd.h>
#endif #endif
...@@ -144,7 +146,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -144,7 +146,7 @@ static int Open( vlc_object_t *p_this )
else else
if( !strcmp( p_access->psz_path, "-" ) ) if( !strcmp( p_access->psz_path, "-" ) )
{ {
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
setmode (fileno (stdout), O_BINARY); setmode (fileno (stdout), O_BINARY);
#endif #endif
fd = vlc_dup (fileno (stdout)); fd = vlc_dup (fileno (stdout));
......
...@@ -319,7 +319,7 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic ) ...@@ -319,7 +319,7 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
else else
{ {
/* switch to the final destination */ /* switch to the final destination */
#if defined (WIN32) #if defined (WIN32) || defined(__OS2__)
vlc_unlink( psz_filename ); vlc_unlink( psz_filename );
#endif #endif
i_ret = vlc_rename( psz_temp, psz_filename ); i_ret = vlc_rename( psz_temp, psz_filename );
......
...@@ -84,7 +84,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj ) ...@@ -84,7 +84,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj )
psz_filename ); psz_filename );
} }
#if !( defined(WIN32) || defined(__APPLE__) ) #if !( defined(WIN32) || defined(__APPLE__) || defined(__OS2__) )
else if( p_stream == NULL && errno == ENOENT ) else if( p_stream == NULL && errno == ENOENT )
{ {
/* This is the fallback for pre XDG Base Directory /* This is the fallback for pre XDG Base Directory
...@@ -622,7 +622,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, ...@@ -622,7 +622,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
clearerr (file); clearerr (file);
goto error; goto error;
} }
#ifndef WIN32 #if !defined( WIN32 ) && !defined( __OS2__ )
#ifdef __APPLE__ #ifdef __APPLE__
fsync (fd); /* Flush from OS */ fsync (fd); /* Flush from OS */
#else #else
...@@ -636,7 +636,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, ...@@ -636,7 +636,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
vlc_mutex_unlock (&lock); vlc_mutex_unlock (&lock);
#endif #endif
fclose (file); fclose (file);
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
/* Windows cannot remove open files nor overwrite existing ones */ /* Windows cannot remove open files nor overwrite existing ones */
vlc_unlink (permanent); vlc_unlink (permanent);
if (vlc_rename (temporary, permanent)) if (vlc_rename (temporary, permanent))
......
...@@ -531,7 +531,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item ) ...@@ -531,7 +531,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
p_item->psz_msg, p_item->psz_msg,
priv->b_color ? GRAY : "" ); priv->b_color ? GRAY : "" );
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
fflush( stderr ); fflush( stderr );
#endif #endif
vlc_restorecancel (canc); vlc_restorecancel (canc);
......
...@@ -478,7 +478,7 @@ void CacheSave (vlc_object_t *p_this, const char *dir, ...@@ -478,7 +478,7 @@ void CacheSave (vlc_object_t *p_this, const char *dir,
goto out; goto out;
} }
#ifndef WIN32 #if !defined( WIN32 ) && !defined( __OS2__ )
vlc_rename (tmpname, filename); /* atomically replace old cache */ vlc_rename (tmpname, filename); /* atomically replace old cache */
fclose (file); fclose (file);
#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