pauldick    00/03/31 10:57:16

  Modified:    c/src/XercesPlatformSupport TextFileOutputStream.cpp
                        TextFileOutputStream.hpp
  Log:
  Removed Windows specific code
  
  Revision  Changes    Path
  1.9       +5 -72     
xml-xalan/c/src/XercesPlatformSupport/TextFileOutputStream.cpp
  
  Index: TextFileOutputStream.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesPlatformSupport/TextFileOutputStream.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TextFileOutputStream.cpp  2000/03/20 14:33:39     1.8
  +++ TextFileOutputStream.cpp  2000/03/31 18:57:15     1.9
  @@ -59,18 +59,8 @@
   
   
   
  -#include <strstream>
  -
  -
  -
  -#if defined(_MSC_VER)
  -#include "windows.h"
  -#else
  -#define INVALID_HANDLE_VALUE 0
  -
   #include <cerrno>
  -
  -#endif
  +#include <strstream>
   
   
   
  @@ -80,60 +70,22 @@
   
   
   #include <PlatformSupport/DOMStringHelper.hpp>
  +#include <PlatformSupport/STLHelper.hpp>
   
   
   
   TextFileOutputStream::TextFileOutputStream(const DOMString&          
theFileName) :
        XercesTextOutputStream(),
        m_fileName(theFileName),
  -#if defined(_MSC_VER)
  -     m_handle(INVALID_HANDLE_VALUE)
  -#else
        m_handle(0)
  -#endif
   {
  -#if defined(_MSC_VER)
  -
  -     // check the version.  Only NT allows  
  -     // wide character file paths
  -     OSVERSIONINFO verInfo;
  -     verInfo.dwOSVersionInfoSize=sizeof(verInfo);
  -     ::GetVersionEx(&verInfo);
  -
  -    if (verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
  -    {
  -        m_handle = ::CreateFileW(toCharArray(theFileName),
  -                                                              GENERIC_WRITE,
  -                                                              
FILE_SHARE_WRITE,
  -                                                              0,
  -                                                              CREATE_ALWAYS,
  -                                                              
FILE_FLAG_SEQUENTIAL_SCAN,
  -                                                              0);
  -    }
  -    else
  -    {
  -        char* const  tmpName = 
XMLString::transcode(toCharArray(theFileName));
  -
  -             ArrayJanitor<char> janTmp(tmpName);
  -
  -        m_handle = ::CreateFileA(tmpName,
  -                                                              GENERIC_WRITE,
  -                                                              
FILE_SHARE_WRITE,
  -                                                              0,
  -                                                              CREATE_ALWAYS,
  -                                                              
FILE_FLAG_SEQUENTIAL_SCAN,
  -                                                              0);
  -    }
  -
  -#else
        char* const     tmpName = 
XMLString::transcode(toCharArray(theFileName));
   
  -     ArrayJanitor<char> janTmp(tmpName);
  +     ArrayJanitor<char>      janTmp(tmpName);
   
        m_handle = fopen(tmpName, "wt");
  -#endif
   
  -    if (m_handle == INVALID_HANDLE_VALUE)
  +    if (m_handle == 0)
        {
                throw TextFileOutputStreamOpenException(theFileName,
                                                                                
                errno);
  @@ -144,13 +96,9 @@
   
   TextFileOutputStream::~TextFileOutputStream()
   {
  -    if (m_handle != INVALID_HANDLE_VALUE)
  +    if (m_handle != 0)
        {
  -#if defined(_MSC_VER)
  -             CloseHandle(m_handle);
  -#else
                fclose(m_handle);
  -#endif
        }
   }
   
  @@ -159,11 +107,7 @@
   void
   TextFileOutputStream::doFlush()
   {
  -#if defined(_MSC_VER)
  -     FlushFileBuffers(m_handle);
  -#else
        fflush(m_handle);
  -#endif
   }
   
   
  @@ -173,22 +117,11 @@
                        const char*             theBuffer,
                        unsigned long   theBufferLength)
   {
  -#if defined(_MSC_VER)
  -     DWORD   theBytesWritten;
  -
  -     WriteFile(m_handle,
  -                       theBuffer,
  -                       theBufferLength,
  -                       &theBytesWritten,
  -                       0);
  -
  -#else
        const size_t    theBytesWritten =
                fwrite(theBuffer,
                           1,
                           theBufferLength,
                           m_handle);
  -#endif
   
        if(theBytesWritten != theBufferLength)
        {
  
  
  
  1.4       +0 -6      
xml-xalan/c/src/XercesPlatformSupport/TextFileOutputStream.hpp
  
  Index: TextFileOutputStream.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesPlatformSupport/TextFileOutputStream.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TextFileOutputStream.hpp  2000/03/06 20:23:14     1.3
  +++ TextFileOutputStream.hpp  2000/03/31 18:57:15     1.4
  @@ -63,9 +63,7 @@
   #include <XercesPlatformSupport/XercesPlatformSupportDefinitions.hpp>
   
   
  -#if !defined(_MSC_VER)
   #include <cstdio>
  -#endif
   #include <vector>
   
   
  @@ -123,11 +121,7 @@
        // Data members...
        const DOMString         m_fileName;
   
  -#if defined(_MSC_VER)
  -     FileHandle                      m_handle;
  -#else
        FILE*                           m_handle;
  -#endif
   };
   
   
  
  
  

Reply via email to