You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2003/03/07 21:34:17 UTC
cvs commit: xml-xerces/c/src/xercesc/util/Platforms/UnixWare UnixWarePlatformUtils.cpp
tng 2003/03/07 12:34:16
Modified: c/src/xercesc/util/Platforms/UnixWare
UnixWarePlatformUtils.cpp
Log:
[Bug 17774] Unixware platform utils not implemented . Patch from Peter Crozier.
Revision Changes Path
1.5 +49 -0 xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
Index: UnixWarePlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnixWarePlatformUtils.cpp 4 Nov 2002 15:13:01 -0000 1.4
+++ UnixWarePlatformUtils.cpp 7 Mar 2003 20:34:16 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/03/07 20:34:16 tng
+ * [Bug 17774] Unixware platform utils not implemented . Patch from Peter Crozier.
+ *
* Revision 1.4 2002/11/04 15:13:01 tng
* C++ Namespace Support.
*
@@ -320,6 +323,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" );
+}
+
FileHandle XMLPlatformUtils::openStdInHandle()
{
return (FileHandle)fdopen(dup(0), "rb");
@@ -341,6 +356,40 @@
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: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org