[vlc-commits] OS/2 uses the same file operations as Win32

KO Myung-Hun git at videolan.org
Tue Apr 5 13:20:54 CEST 2011


vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Mon Apr  4 22:41:09 2011 +0200| [095ad3e1195368f3eccb7202aed567649dd42871] | committer: Rémi Duraffort

OS/2 uses the same file operations as Win32

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=095ad3e1195368f3eccb7202aed567649dd42871
---

 modules/access_output/file.c |    4 +++-
 modules/video_filter/scene.c |    2 +-
 src/config/file.c            |    6 +++---
 src/misc/messages.c          |    2 +-
 src/modules/cache.c          |    2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/access_output/file.c b/modules/access_output/file.c
index f104f59..88fb86b 100644
--- a/modules/access_output/file.c
+++ b/modules/access_output/file.c
@@ -45,6 +45,8 @@
 #if defined( WIN32 ) && !defined( UNDER_CE )
 #   include <io.h>
 #   define lseek _lseeki64
+#elif defined( __OS2__ )
+#   include <io.h>
 #else
 #   include <unistd.h>
 #endif
@@ -144,7 +146,7 @@ static int Open( vlc_object_t *p_this )
     else
     if( !strcmp( p_access->psz_path, "-" ) )
     {
-#ifdef WIN32
+#if defined( WIN32 ) || defined( __OS2__ )
         setmode (fileno (stdout), O_BINARY);
 #endif
         fd = vlc_dup (fileno (stdout));
diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 577cc85..8674993 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -319,7 +319,7 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
     else
     {
         /* switch to the final destination */
-#if defined (WIN32)
+#if defined (WIN32) || defined(__OS2__)
         vlc_unlink( psz_filename );
 #endif
         i_ret = vlc_rename( psz_temp, psz_filename );
diff --git a/src/config/file.c b/src/config/file.c
index d7fe4be..bdc29e2 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -84,7 +84,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj )
                  psz_filename );
 
     }
-#if !( defined(WIN32) || defined(__APPLE__) )
+#if !( defined(WIN32) || defined(__APPLE__) || defined(__OS2__) )
     else if( p_stream == NULL && errno == ENOENT )
     {
         /* 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,
         clearerr (file);
         goto error;
     }
-#ifndef WIN32
+#if !defined( WIN32 ) && !defined( __OS2__ )
 #ifdef __APPLE__
     fsync (fd); /* Flush from OS */
 #else
@@ -636,7 +636,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
     vlc_mutex_unlock (&lock);
 #endif
     fclose (file);
-#ifdef WIN32
+#if defined( WIN32 ) || defined( __OS2__ )
     /* Windows cannot remove open files nor overwrite existing ones */
     vlc_unlink (permanent);
     if (vlc_rename (temporary, permanent))
diff --git a/src/misc/messages.c b/src/misc/messages.c
index aa957d4..02ab2b3 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -531,7 +531,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
                   p_item->psz_msg,
                   priv->b_color ? GRAY : "" );
 
-#ifdef WIN32
+#if defined( WIN32 ) || defined( __OS2__ )
     fflush( stderr );
 #endif
     vlc_restorecancel (canc);
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 76de0b8..d908d18 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -478,7 +478,7 @@ void CacheSave (vlc_object_t *p_this, const char *dir,
         goto out;
     }
 
-#ifndef WIN32
+#if !defined( WIN32 ) && !defined( __OS2__ )
     vlc_rename (tmpname, filename); /* atomically replace old cache */
     fclose (file);
 #else



More information about the vlc-commits mailing list