tng         2002/07/26 10:18:25

  Modified:    c/src/xercesc/util/Platforms/Tru64 Tru64PlatformUtils.cpp
  Log:
  [Bug 11189] Tru64 utilities missing implementation of new functions. Fixed by David 
Bertoni.
  
  Revision  Changes    Path
  1.3       +48 -1     
xml-xerces/c/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
  
  Index: Tru64PlatformUtils.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tru64PlatformUtils.cpp    21 May 2002 20:31:48 -0000      1.2
  +++ Tru64PlatformUtils.cpp    26 Jul 2002 17:18:25 -0000      1.3
  @@ -272,6 +272,18 @@
     return retVal;
   }
   
  +FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
  +{
  +    const char* tmpFileName = XMLString::transcode(fileName);
  +    ArrayJanitor<char> janText((char*)tmpFileName);
  +    return fopen( tmpFileName , "wb" );
  +}
  +
  +FileHandle XMLPlatformUtils::openFileToWrite(const char* const fileName)
  +{
  +    return fopen( fileName , "wb" );
  +}
  +
   unsigned int XMLPlatformUtils::readFileBuffer(FileHandle theFile,
                                              const unsigned int toRead,
                                              XMLByte* const toFill)
  @@ -286,6 +298,41 @@
     }
   
     return (unsigned int) noOfItemsRead;
  +}
  +
  +void
  +XMLPlatformUtils::writeBufferToFile( FileHandle     const  theFile
  +                                   , long                  toWrite
  +                                   , const XMLByte* const  toFlush)                 
                  
  +{
  +    if (!theFile        ||
  +        (toWrite <= 0 ) ||
  +        !toFlush         )
  +        return;
  +
  +    const XMLByte* tmpFlush = (const XMLByte*) toFlush;
  +    size_t bytesWritten = 0;
  +
  +    while (true)
  +    {
  +        bytesWritten=fwrite(tmpFlush, sizeof(XMLByte), toWrite, (FILE*)theFile);
  +
  +        if(ferror((FILE*)theFile))
  +        {
  +            ThrowXML(XMLPlatformUtilsException, 
XMLExcepts::File_CouldNotWriteToFile);
  +        }
  +
  +        if (bytesWritten < toWrite) //incomplete write
  +        {
  +            tmpFlush+=bytesWritten;
  +            toWrite-=bytesWritten;
  +            bytesWritten=0;
  +        }
  +        else
  +            return;
  +    }
  +
  +    return;
   }
   
   void XMLPlatformUtils::resetFile(FileHandle theFile)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to