peiyongz    2003/10/15 07:50:01

  Modified:    c/src/xercesc/util XMLAbstractDoubleFloat.cpp
                        XMLAbstractDoubleFloat.hpp XMLDouble.cpp
                        XMLFloat.cpp
  Log:
  Bugzilla#22821: locale-sensitive function used to validate 'double' type, patch
  from [EMAIL PROTECTED] (Jeff Sweeney)
  
  Revision  Changes    Path
  1.17      +23 -1     xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp
  
  Index: XMLAbstractDoubleFloat.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XMLAbstractDoubleFloat.cpp        25 Sep 2003 22:24:28 -0000      1.16
  +++ XMLAbstractDoubleFloat.cpp        15 Oct 2003 14:50:01 -0000      1.17
  @@ -57,6 +57,10 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.17  2003/10/15 14:50:01  peiyongz
  + * Bugzilla#22821: locale-sensitive function used to validate 'double' type, patch
  + * from [EMAIL PROTECTED] (Jeff Sweeney)
  + *
    * Revision 1.16  2003/09/25 22:24:28  peiyongz
    * Using writeString/readString
    *
  @@ -124,6 +128,8 @@
   #include <xercesc/util/XMLString.hpp>
   #include <xercesc/util/Janitor.hpp>
   
  +#include <locale.h>
  +
   XERCES_CPP_NAMESPACE_BEGIN
   
   // ---------------------------------------------------------------------------
  @@ -432,6 +438,23 @@
   
       return;
   } 
  +
  +void XMLAbstractDoubleFloat::normalizeDecimalPoint(char* const toNormal)
  +{
  +    // find the locale-specific decimal point delimiter
  +    lconv* lc = localeconv();
  +    char delimiter = *lc->decimal_point;
  +
  +    // replace '.' with the locale-specific decimal point delimiter
  +    if ( delimiter != '.' )
  +    {
  +        char* period = strchr( toNormal, '.' );
  +        if ( period )
  +        {
  +            *period = delimiter;
  +        }
  +    }
  +}
   
   /***
    * Support for Serialization/De-serialization
  
  
  
  1.15      +14 -1     xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp
  
  Index: XMLAbstractDoubleFloat.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XMLAbstractDoubleFloat.hpp        23 Sep 2003 18:16:07 -0000      1.14
  +++ XMLAbstractDoubleFloat.hpp        15 Oct 2003 14:50:01 -0000      1.15
  @@ -57,6 +57,10 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.15  2003/10/15 14:50:01  peiyongz
  + * Bugzilla#22821: locale-sensitive function used to validate 'double' type, patch
  + * from [EMAIL PROTECTED] (Jeff Sweeney)
  + *
    * Revision 1.14  2003/09/23 18:16:07  peiyongz
    * Inplementation for Serialization/Deserialization
    *
  @@ -181,6 +185,16 @@
       virtual int           getSign() const;
   
       MemoryManager*        getMemoryManager() const;
  +
  +    /***
  +     *
  +     * The decimal point delimiter for the schema double/float type is
  +     * defined to be a period and is not locale-specific. So, it must
  +     * be replaced with the local-specific delimiter before converting
  +     * from string to double/float.
  +     *
  +     ***/
  +    void                  normalizeDecimalPoint(char* const toNormal);
   
       /***
        * Support for Serialization/De-serialization
  
  
  
  1.12      +7 -1      xml-xerces/c/src/xercesc/util/XMLDouble.cpp
  
  Index: XMLDouble.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDouble.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLDouble.cpp     23 Sep 2003 18:16:07 -0000      1.11
  +++ XMLDouble.cpp     15 Oct 2003 14:50:01 -0000      1.12
  @@ -57,6 +57,10 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.12  2003/10/15 14:50:01  peiyongz
  + * Bugzilla#22821: locale-sensitive function used to validate 'double' type, patch
  + * from [EMAIL PROTECTED] (Jeff Sweeney)
  + *
    * Revision 1.11  2003/09/23 18:16:07  peiyongz
    * Inplementation for Serialization/Deserialization
    *
  @@ -171,6 +175,9 @@
   void XMLDouble::checkBoundary(const XMLCh* const strValue)
   {
       char *nptr = XMLString::transcode(strValue, getMemoryManager());
  +
  +    normalizeDecimalPoint(nptr);
  +
       ArrayJanitor<char> jan1(nptr, getMemoryManager());
       int   strLen = strlen(nptr);
       char *endptr = 0;
  
  
  
  1.13      +7 -1      xml-xerces/c/src/xercesc/util/XMLFloat.cpp
  
  Index: XMLFloat.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLFloat.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XMLFloat.cpp      23 Sep 2003 18:16:07 -0000      1.12
  +++ XMLFloat.cpp      15 Oct 2003 14:50:01 -0000      1.13
  @@ -57,6 +57,10 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.13  2003/10/15 14:50:01  peiyongz
  + * Bugzilla#22821: locale-sensitive function used to validate 'double' type, patch
  + * from [EMAIL PROTECTED] (Jeff Sweeney)
  + *
    * Revision 1.12  2003/09/23 18:16:07  peiyongz
    * Inplementation for Serialization/Deserialization
    *
  @@ -166,6 +170,9 @@
   void XMLFloat::checkBoundary(const XMLCh* const strValue)
   {
       char *nptr = XMLString::transcode(strValue, getMemoryManager());
  +
  +    normalizeDecimalPoint(nptr);
  +
       ArrayJanitor<char> jan1(nptr, getMemoryManager());
       int   strLen = strlen(nptr);
       char *endptr = 0;
  
  
  

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

Reply via email to