[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: svn commit: r672415 - in /xerces/c/trunk/src/xercesc:
From: dbertoni () apache ! org
Date: 2008-06-27 22:52:25
Message-ID: 20080627225226.4BFCA2388A09 () eris ! apache ! org
[Download RAW message or body]
Author: dbertoni
Date: Fri Jun 27 15:52:25 2008
New Revision: 672415
URL: http://svn.apache.org/viewvc?rev=672415&view=rev
Log:
Added unsigned long long and long long overloads to support 64-bit integrals on \
32-bit platforms.
Modified:
xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
xerces/c/trunk/src/xercesc/internal/XSerializeEngine.hpp
xerces/c/trunk/src/xercesc/util/XMLString.cpp
xerces/c/trunk/src/xercesc/util/XMLString.hpp
Modified: xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp?rev=672415&r1=672414&r2=672415&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp Fri Jun 27 15:52:25 2008
@@ -610,6 +610,24 @@
return *this;
}
+XSerializeEngine& XSerializeEngine::operator<<(unsigned long long t)
+{
+ checkAndFlushBuffer(sizeof(t));
+
+ memcpy(fBufCur, &t, sizeof(t));
+ fBufCur += sizeof(t);
+ return *this;
+}
+
+XSerializeEngine& XSerializeEngine::operator>>(unsigned long long& t)
+{
+ checkAndFillBuffer(sizeof(t));
+
+ memcpy(&t, fBufCur, sizeof(t));
+ fBufCur += sizeof(t);
+ return *this;
+}
+
XSerializeEngine& XSerializeEngine::operator<<(char ch)
{
return XSerializeEngine::operator<<((XMLByte)ch);
Modified: xerces/c/trunk/src/xercesc/internal/XSerializeEngine.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSerializeEngine.hpp?rev=672415&r1=672414&r2=672415&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSerializeEngine.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSerializeEngine.hpp Fri Jun 27 15:52:25 2008
@@ -487,6 +487,7 @@
XSerializeEngine& operator<<(unsigned int);
XSerializeEngine& operator<<(long);
XSerializeEngine& operator<<(unsigned long);
+ XSerializeEngine& operator<<(unsigned long long);
XSerializeEngine& operator<<(float);
XSerializeEngine& operator<<(double);
XSerializeEngine& operator<<(bool);
@@ -507,6 +508,7 @@
XSerializeEngine& operator>>(unsigned int&);
XSerializeEngine& operator>>(long&);
XSerializeEngine& operator>>(unsigned long&);
+ XSerializeEngine& operator>>(unsigned long long&);
XSerializeEngine& operator>>(float&);
XSerializeEngine& operator>>(double&);
XSerializeEngine& operator>>(bool&);
Modified: xerces/c/trunk/src/xercesc/util/XMLString.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.cpp?rev=672415&r1=672414&r2=672415&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.cpp Fri Jun 27 15:52:25 2008
@@ -80,11 +80,11 @@
// ---------------------------------------------------------------------------
// XMLString: Public static methods
// ---------------------------------------------------------------------------
-void XMLString::binToText( const unsigned long toFormat
- , char* const toFill
- , const XMLSize_t maxChars
- , const unsigned int radix
- , MemoryManager* const manager)
+void XMLString::binToText( const unsigned long long toFormat
+ , char* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
{
static const char digitList[16] =
{
@@ -107,7 +107,7 @@
XMLSize_t tmpIndex = 0;
// A copy of the conversion value that we can modify
- unsigned int tmpVal = toFormat;
+ unsigned long long tmpVal = toFormat;
//
// Convert into a temp buffer that we know is large enough. This avoids
@@ -136,7 +136,7 @@
{
while (tmpVal)
{
- const unsigned int charInd = (tmpVal & 0xFUL);
+ const unsigned long long charInd = (tmpVal & 0xFUL);
tmpBuf[tmpIndex++] = digitList[charInd];
tmpVal >>= 4;
}
@@ -145,7 +145,7 @@
{
while (tmpVal)
{
- const unsigned int charInd = (tmpVal % radix);
+ const unsigned long long charInd = (tmpVal % radix);
tmpBuf[tmpIndex++] = digitList[charInd];
tmpVal /= radix;
}
@@ -170,68 +170,71 @@
toFill[outIndex] = char(0);
}
+void XMLString::binToText( const unsigned long toFormat
+ , char* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
+{
+ // Just call the unsigned long long version
+ binToText((unsigned long long)toFormat, toFill, maxChars, radix, manager);
+}
+
void XMLString::binToText( const unsigned int toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager)
{
- // Just call the unsigned long version
- binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
+ // Just call the unsigned long long version
+ binToText((unsigned long long)toFormat, toFill, maxChars, radix, manager);
}
-void XMLString::binToText( const long toFormat
+void XMLString::binToText( const long long toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager)
{
//
- // If its negative, then put a negative sign into the output and flip
+ // If it's negative, then put a negative sign into the output and flip
// the sign of the local temp value.
//
XMLSize_t startInd = 0;
- unsigned long actualVal;
+ unsigned long long actualVal;
if (toFormat < 0)
{
toFill[0] = '-';
startInd++;
- actualVal = (unsigned long)(toFormat * -1);
+ actualVal = (unsigned long long)(toFormat * -1);
}
else
{
- actualVal = (unsigned long)(toFormat);
+ actualVal = (unsigned long long)(toFormat);
}
- // And now call the unsigned long version
+ // And now call the unsigned long long version
binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
}
-void XMLString::binToText( const int toFormat
+void XMLString::binToText( const long toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager)
{
- //
- // If its negative, then put a negative sign into the output and flip
- // the sign of the local temp value.
- //
- XMLSize_t startInd = 0;
- unsigned long actualVal;
- if (toFormat < 0)
- {
- toFill[0] = '-';
- startInd++;
- actualVal = (unsigned long)(toFormat * -1);
- }
- else
- {
- actualVal = (unsigned long)(toFormat);
- }
+ // Just call the long long version
+ binToText((long long)toFormat, toFill, maxChars, radix, manager);
+}
- // And now call the unsigned long version
- binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
+void XMLString::binToText( const int toFormat
+ , char* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
+{
+ // Just call the long long version
+ binToText((long long)toFormat, toFill, maxChars, radix, manager);
}
@@ -713,11 +716,11 @@
// ---------------------------------------------------------------------------
// Wide char versions of most of the string methods
// ---------------------------------------------------------------------------
-void XMLString::binToText( const unsigned long toFormat
- , XMLCh* const toFill
- , const XMLSize_t maxChars
- , const unsigned int radix
- , MemoryManager* const manager)
+void XMLString::binToText( const unsigned long long toFormat
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
{
static const XMLCh digitList[16] =
{
@@ -741,7 +744,7 @@
XMLSize_t tmpIndex = 0;
// A copy of the conversion value that we can modify
- unsigned int tmpVal = toFormat;
+ unsigned long long tmpVal = toFormat;
//
// Convert into a temp buffer that we know is large enough. This avoids
@@ -770,7 +773,7 @@
{
while (tmpVal)
{
- const unsigned int charInd = (tmpVal & 0xFUL);
+ const unsigned long long charInd = (tmpVal & 0xFUL);
tmpBuf[tmpIndex++] = digitList[charInd];
tmpVal >>= 4;
}
@@ -779,7 +782,7 @@
{
while (tmpVal)
{
- const unsigned int charInd = (tmpVal % radix);
+ const unsigned long long charInd = (tmpVal % radix);
tmpBuf[tmpIndex++] = digitList[charInd];
tmpVal /= radix;
}
@@ -804,17 +807,27 @@
toFill[outIndex] = chNull;
}
+void XMLString::binToText( const unsigned long toFormat
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
+{
+ // Just call the unsigned long long version
+ binToText((unsigned long long)toFormat, toFill, maxChars, radix, manager);
+}
+
void XMLString::binToText( const unsigned int toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager)
{
- // Just call the unsigned long version
- binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
+ // Just call the unsigned long long version
+ binToText((unsigned long long)toFormat, toFill, maxChars, radix, manager);
}
-void XMLString::binToText( const long toFormat
+void XMLString::binToText( const long long toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
@@ -825,47 +838,40 @@
// the sign of the local temp value.
//
XMLSize_t startInd = 0;
- unsigned long actualVal;
+ unsigned long long actualVal;
if (toFormat < 0)
{
toFill[0] = chDash;
startInd++;
- actualVal = (unsigned long)(toFormat * -1);
+ actualVal = (unsigned long long)(toFormat * -1);
}
else
{
- actualVal = (unsigned long)(toFormat);
+ actualVal = (unsigned long long)(toFormat);
}
- // And now call the unsigned long version
+ // And now call the unsigned long long version
binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
}
-void XMLString::binToText( const int toFormat
+void XMLString::binToText( const long toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager)
{
- //
- // If its negative, then put a negative sign into the output and flip
- // the sign of the local temp value.
- //
- XMLSize_t startInd = 0;
- unsigned long actualVal;
- if (toFormat < 0)
- {
- toFill[0] = chDash;
- startInd++;
- actualVal = (unsigned long)(toFormat * -1);
- }
- else
- {
- actualVal = (unsigned long)(toFormat);
- }
+ // Just call the long long version
+ binToText((long long)toFormat, toFill, maxChars, radix, manager);
+}
- // And now call the unsigned long version
- binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
+void XMLString::binToText( const int toFormat
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager)
+{
+ // Just call the long long version
+ binToText((long long)toFormat, toFill, maxChars, radix, manager);
}
@@ -910,7 +916,7 @@
XMLCh ch1;
XMLCh ch2;
- while (true) {
+ for (;;) {
if (*psz1 >= chLatin_A && *psz1 <= chLatin_Z)
ch1 = *psz1 - chLatin_A + chLatin_a;
else
@@ -992,7 +998,7 @@
}
}
- while (true)
+ for (;;)
{
// If an inequality, then return the difference
if (*psz1 != *psz2)
Modified: xerces/c/trunk/src/xercesc/util/XMLString.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.hpp?rev=672415&r1=672414&r2=672415&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.hpp Fri Jun 27 15:52:25 2008
@@ -887,6 +887,46 @@
*/
static void binToText
(
+ const unsigned long long toFormat
+ , char* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+ /** Converts binary data to a text string based a given radix
+ *
+ * @param toFormat The number to convert
+ * @param toFill The buffer that will hold the output on return. The
+ * size of this buffer should at least be 'maxChars + 1'.
+ * @param maxChars The maximum number of output characters that can be
+ * accepted. If the result will not fit, it is an error.
+ * @param radix The radix of the input data, based on which the conversion
+ * @param manager The MemoryManager to use to allocate objects
+ * will be done
+ */
+ static void binToText
+ (
+ const unsigned long long toFormat
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+ /** Converts binary data to a text string based a given radix
+ *
+ * @param toFormat The number to convert
+ * @param toFill The buffer that will hold the output on return. The
+ * size of this buffer should at least be 'maxChars + 1'.
+ * @param maxChars The maximum number of output characters that can be
+ * accepted. If the result will not fit, it is an error.
+ * @param radix The radix of the input data, based on which the conversion
+ * @param manager The MemoryManager to use to allocate objects
+ * will be done
+ */
+ static void binToText
+ (
const unsigned int toFormat
, char* const toFill
, const XMLSize_t maxChars
@@ -1007,6 +1047,46 @@
*/
static void binToText
(
+ const long long toFormat
+ , char* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+ /** Converts binary data to a text string based a given radix
+ *
+ * @param toFormat The number to convert
+ * @param toFill The buffer that will hold the output on return. The
+ * size of this buffer should at least be 'maxChars + 1'.
+ * @param maxChars The maximum number of output characters that can be
+ * accepted. If the result will not fit, it is an error.
+ * @param radix The radix of the input data, based on which the conversion
+ * @param manager The MemoryManager to use to allocate objects
+ * will be done
+ */
+ static void binToText
+ (
+ const long long toFormat
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ , const unsigned int radix
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+
+ /** Converts binary data to a text string based a given radix
+ *
+ * @param toFormat The number to convert
+ * @param toFill The buffer that will hold the output on return. The
+ * size of this buffer should at least be 'maxChars + 1'.
+ * @param maxChars The maximum number of output characters that can be
+ * accepted. If the result will not fit, it is an error.
+ * @param radix The radix of the input data, based on which the conversion
+ * @param manager The MemoryManager to use to allocate objects
+ * will be done
+ */
+ static void binToText
+ (
const int toFormat
, char* const toFill
, const XMLSize_t maxChars
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic