You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2005/04/27 20:21:51 UTC

cvs commit: xml-xerces/c/src/xercesc/util/Platforms/Solaris SolarisDefs.hpp SolarisPlatformUtils.cpp

cargilld    2005/04/27 11:21:51

  Modified:    c/src/xercesc/framework LocalFileFormatTarget.cpp
               c/src/xercesc/internal BinFileOutputStream.hpp
               c/src/xercesc/util BinFileInputStream.hpp XercesDefs.hpp
               c/src/xercesc/util/Platforms/Solaris SolarisDefs.hpp
                        SolarisPlatformUtils.cpp
  Log:
  Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  
  Revision  Changes    Path
  1.12      +6 -3      xml-xerces/c/src/xercesc/framework/LocalFileFormatTarget.cpp
  
  Index: LocalFileFormatTarget.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/LocalFileFormatTarget.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LocalFileFormatTarget.cpp	2 Nov 2004 17:09:42 -0000	1.11
  +++ LocalFileFormatTarget.cpp	27 Apr 2005 18:21:51 -0000	1.12
  @@ -17,6 +17,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.12  2005/04/27 18:21:51  cargilld
  + * Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  + *
    * Revision 1.11  2004/11/02 17:09:42  peiyongz
    * Handling OutOfMemory exception
    *
  @@ -72,7 +75,7 @@
   {
       fSource = XMLPlatformUtils::openFileToWrite(fileName, manager);
   
  -    if (!fSource)
  +    if (fSource == (FileHandle) XERCES_Invalid_File_Handle)
           ThrowXMLwithMemMgr1(IOException, XMLExcepts::File_CouldNotOpenFile, fileName, fMemoryManager);
   
       // Buffer is one larger than capacity, to allow for zero term
  @@ -96,7 +99,7 @@
   {
       fSource = XMLPlatformUtils::openFileToWrite(fileName, manager);
   
  -    if (!fSource)
  +    if (fSource == (FileHandle) XERCES_Invalid_File_Handle)
           ThrowXMLwithMemMgr1(IOException, XMLExcepts::File_CouldNotOpenFile, fileName, fMemoryManager);
   
       // Buffer is one larger than capacity, to allow for zero term
  
  
  
  1.6       +5 -2      xml-xerces/c/src/xercesc/internal/BinFileOutputStream.hpp
  
  Index: BinFileOutputStream.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/BinFileOutputStream.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BinFileOutputStream.hpp	8 Sep 2004 13:56:13 -0000	1.5
  +++ BinFileOutputStream.hpp	27 Apr 2005 18:21:51 -0000	1.6
  @@ -16,6 +16,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2005/04/27 18:21:51  cargilld
  + * Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  + *
    * Revision 1.5  2004/09/08 13:56:13  peiyongz
    * Apache License Version 2.0
    *
  @@ -108,7 +111,7 @@
   // ---------------------------------------------------------------------------
   inline bool BinFileOutputStream::getIsOpen() const
   {
  -    return (fSource != 0);
  +    return (fSource != (FileHandle) XERCES_Invalid_File_Handle);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.8       +4 -1      xml-xerces/c/src/xercesc/util/BinFileInputStream.hpp
  
  Index: BinFileInputStream.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BinFileInputStream.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BinFileInputStream.hpp	8 Sep 2004 13:56:21 -0000	1.7
  +++ BinFileInputStream.hpp	27 Apr 2005 18:21:51 -0000	1.8
  @@ -16,6 +16,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2005/04/27 18:21:51  cargilld
  + * Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  + *
    * Revision 1.7  2004/09/08 13:56:21  peiyongz
    * Apache License Version 2.0
    *
  @@ -131,7 +134,7 @@
   // ---------------------------------------------------------------------------
   inline bool BinFileInputStream::getIsOpen() const
   {
  -    return (fSource != 0);
  +    return (fSource != (FileHandle) XERCES_Invalid_File_Handle);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.20      +4 -1      xml-xerces/c/src/xercesc/util/XercesDefs.hpp
  
  Index: XercesDefs.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XercesDefs.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XercesDefs.hpp	8 Sep 2004 13:56:25 -0000	1.19
  +++ XercesDefs.hpp	27 Apr 2005 18:21:51 -0000	1.20
  @@ -16,6 +16,9 @@
   
   /*
    * $Log$
  + * Revision 1.20  2005/04/27 18:21:51  cargilld
  + * Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  + *
    * Revision 1.19  2004/09/08 13:56:25  peiyongz
    * Apache License Version 2.0
    *
  @@ -205,7 +208,7 @@
   // ---------------------------------------------------------------------------
   #include    <xercesc/util/AutoSense.hpp>
   
  -
  +#define XERCES_Invalid_File_Handle 0
   
   // ---------------------------------------------------------------------------
   //  According to the platform we include a platform specific file. This guy
  
  
  
  1.6       +6 -0      xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisDefs.hpp
  
  Index: SolarisDefs.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisDefs.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SolarisDefs.hpp	8 Sep 2004 13:56:42 -0000	1.5
  +++ SolarisDefs.hpp	27 Apr 2005 18:21:51 -0000	1.6
  @@ -16,6 +16,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2005/04/27 18:21:51  cargilld
  + * Fix for problem on Solaris where open may return 0 as a valid FileHandle.  Check for -1 instead.
  + *
    * Revision 1.5  2004/09/08 13:56:42  peiyongz
    * Apache License Version 2.0
    *
  @@ -64,6 +67,9 @@
   #endif 
    
   typedef int FileHandle;
  +
  +#undef  XERCES_Invalid_File_Handle
  +#define XERCES_Invalid_File_Handle -1
    
   #ifndef SOLARIS
   #define SOLARIS
  
  
  
  1.30      +3 -11     xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
  
  Index: SolarisPlatformUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- SolarisPlatformUtils.cpp	5 Apr 2005 18:36:01 -0000	1.29
  +++ SolarisPlatformUtils.cpp	27 Apr 2005 18:21:51 -0000	1.30
  @@ -215,11 +215,7 @@
   FileHandle XMLPlatformUtils::openFile(const char* const fileName
                                         , MemoryManager* const manager)
   {
  -    int retVal = open( fileName , O_RDONLY | O_LARGEFILE);
  -
  -    if (retVal == -1)
  -        return 0;
  -    return (FileHandle)retVal;
  +    return (FileHandle) open( fileName , O_RDONLY | O_LARGEFILE);
   }
   
   FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName
  @@ -227,11 +223,7 @@
   {
       const char* tmpFileName = XMLString::transcode(fileName, manager);
       ArrayJanitor<char> janText((char*)tmpFileName, manager);
  -    int retVal = open( tmpFileName , O_RDONLY | O_LARGEFILE);
  -
  -    if (retVal == -1)
  -        return 0;
  -    return (FileHandle)retVal;
  +    return (FileHandle) open( tmpFileName , O_RDONLY | O_LARGEFILE); 
   }
   
   FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org