svn commit: r735324 - in /xalan/c/trunk/src/xalanc/PlatformSupport: XalanFStreamOutputStream.cpp XalanFileOutputStream.cpp XalanOutputStream.cpp XalanOutputStream.hpp
[email protected] Sat, 17 Jan 2009 18:45:02 -0000
| Newsgroups | gmane.text.xml.xalan.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dbertoni
Date: Sat Jan 17 10:45:02 2009
New Revision: 735324
URL: http://svn.apache.org/viewvc?rev=735324&view=rev
Log:
Made the function formatMessageLocal(), in XalanFSStreamOutputStream.cpp, a static member function of XalanOutputStream to avoid having XalanFileOutputStream refer to it as an extern.
Modified:
xalan/c/trunk/src/xalanc/PlatformSupport/XalanFStreamOutputStream.cpp
xalan/c/trunk/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp
xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.cpp
xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanFStreamOutputStream.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanFStreamOutputStream.cpp?rev=735324&r1=735323&r2=735324&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanFStreamOutputStream.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanFStreamOutputStream.cpp Sat Jan 17 10:45:02 2009
@@ -94,39 +94,16 @@
if (theBytesWritten != theBufferLength)
{
- XalanDOMString theBuffer(getMemoryManager());
+ XalanDOMString theExceptionBuffer(getMemoryManager());
- throw XalanFStreamOutputStreamWriteException(errno, theBuffer);
+ throw XalanFStreamOutputStreamWriteException(
+ errno,
+ theExceptionBuffer);
}
}
-XalanDOMString&
-FormatMessageLocal(
- const XalanDOMString& theMessage,
- int theErrorCode,
- XalanDOMString& theResult)
-{
- XalanDOMString strErrorCode(theResult.getMemoryManager());
-
- XalanDOMString strErrorMsg(theResult.getMemoryManager());
-
- NumberToDOMString(theErrorCode, strErrorCode);
-
- theResult.assign(theMessage);
-
- XalanMessageLoader::getMessage(
- strErrorMsg,
- XalanMessages::SystemErrorCode_1Param,
- strErrorCode);
-
- theResult.append(strErrorMsg);
-
- return theResult;
-}
-
-
const XalanDOMChar XalanFStreamOutputStream::XalanFStreamOutputStreamWriteException::m_type[] =
{
XalanUnicode::charLetter_X,
@@ -171,7 +148,7 @@
int theErrorCode,
XalanDOMString& theBuffer) :
XalanOutputStreamException(
- FormatMessageLocal(
+ formatMessage(
XalanMessageLoader::getMessage(
theBuffer,
XalanMessages::ErrorWritingFile_1Param,
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp?rev=735324&r1=735323&r2=735324&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp Sat Jan 17 10:45:02 2009
@@ -139,6 +139,7 @@
{
CharVectorType theResult(theManager);
+
TranscodeToLocalCodePage(theFileName, theResult, true);
if (theResult.empty() == true)
@@ -295,12 +296,12 @@
if (WriteFile(m_handle, theBuffer, DWORD(theBufferLength), &theBytesWritten, 0) == false ||
theBytesWritten != theBufferLength)
{
- XalanDOMString theBuffer(getMemoryManager());
+ XalanDOMString theExceptionBuffer(getMemoryManager());
throw XalanFileOutputStreamWriteException(
- m_fileName,
- GetLastError(),
- theBuffer);
+ m_fileName,
+ GetLastError(),
+ theExceptionBuffer);
}
#else
const size_t theBytesWritten =
@@ -311,32 +312,24 @@
if (theBytesWritten != theBufferLength)
{
- XalanDOMString theBuffer(getMemoryManager());
+ XalanDOMString theExceptionBuffer(getMemoryManager());
throw XalanFileOutputStreamWriteException(
- m_fileName,
- errno,
- theBuffer);
+ m_fileName,
+ errno,
+ theExceptionBuffer);
}
#endif
}
-extern XalanDOMString&
-FormatMessageLocal(
- const XalanDOMString& theMessage,
- int theErrorCode,
- XalanDOMString& theResult);
-
-
-
XalanFileOutputStream::XalanFileOutputStreamOpenException::XalanFileOutputStreamOpenException(
const XalanDOMString& theFileName,
int theErrorCode,
XalanDOMString& theBuffer,
const Locator* theLocator) :
XalanOutputStreamException(
- FormatMessageLocal(
+ formatMessage(
XalanMessageLoader::getMessage(
theBuffer,
XalanMessages::ErrorOpeningFile_1Param,
@@ -362,7 +355,7 @@
XalanDOMString& theBuffer,
const Locator* theLocator) :
XalanOutputStreamException(
- FormatMessageLocal(
+ formatMessage(
XalanMessageLoader::getMessage(
theBuffer,
XalanMessages::ErrorWritingFile_1Param,
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.cpp?rev=735324&r1=735323&r2=735324&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.cpp Sat Jan 17 10:45:02 2009
@@ -62,8 +62,6 @@
-
-
XalanOutputStream::XalanOutputStream(
MemoryManager& theManager,
size_type theBufferSize,
@@ -138,15 +136,17 @@
{
if (m_throwTranscodeException == true)
{
- XalanDOMString theBuffer(theDestination.getMemoryManager());
+ XalanDOMString theExceptionBuffer(theDestination.getMemoryManager());
- throw TranscodingException(theBuffer, 0);
+ throw TranscodingException(
+ theExceptionBuffer,
+ 0);
}
}
}
else
{
- bool fDone = false;
+ bool fDone = false;
// Keep track of the total bytes we've added to the
// destination vector, and the total bytes we've
@@ -190,9 +190,11 @@
{
if (m_throwTranscodeException == true)
{
- XalanDOMString theBuffer(theDestination.getMemoryManager());
+ XalanDOMString theExceptionBuffer(theDestination.getMemoryManager());
- throw TranscodingException(theBuffer, 0);
+ throw TranscodingException(
+ theExceptionBuffer,
+ 0);
}
}
@@ -262,13 +264,13 @@
if (theCode == XalanTranscodingServices::UnsupportedEncoding ||
theCode == XalanTranscodingServices::SupportFilesNotFound)
{
- XalanDOMString theBuffer(getMemoryManager());
+ XalanDOMString theBuffer(getMemoryManager());
throw UnsupportedEncodingException(theEncoding, theBuffer, 0);
}
else if (theCode != XalanTranscodingServices::OK)
{
- XalanDOMString theBuffer(getMemoryManager());
+ XalanDOMString theBuffer(getMemoryManager());
throw TranscoderInternalFailureException(theEncoding, theBuffer, 0);
}
@@ -727,4 +729,31 @@
+XalanDOMString&
+XalanOutputStream::formatMessage(
+ const XalanDOMString& theMessage,
+ int theErrorCode,
+ XalanDOMString& theBuffer)
+{
+ XalanDOMString strErrorCode(theBuffer.getMemoryManager());
+
+ XalanDOMString strErrorMsg(theBuffer.getMemoryManager());
+
+ NumberToDOMString(theErrorCode, strErrorCode);
+
+ theBuffer.assign(theMessage);
+
+ XalanMessageLoader::getMessage(
+ strErrorMsg,
+ XalanMessages::SystemErrorCode_1Param,
+ strErrorCode);
+
+ theBuffer.append(strErrorMsg);
+
+ return theBuffer;
+}
+
+
+
+
XALAN_CPP_NAMESPACE_END
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp?rev=735324&r1=735323&r2=735324&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp Sat Jan 17 10:45:02 2009
@@ -437,6 +437,12 @@
static const XalanDOMString::size_type s_nlStringLength;
static const XalanDOMString::size_type s_nlCRStringLength;
+ static XalanDOMString&
+ formatMessage(
+ const XalanDOMString& theMessage,
+ int theErrorCode,
+ XalanDOMString& theBuffer);
+
private:
// These are not implemented...