[Cmake-commits] [cmake-commits] king committed cmXMLSafe.cxx 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 5 17:09:34 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv9299/Source

Modified Files:
	cmXMLSafe.cxx 
Log Message:
COMP: Avoid warning about signed-char comparison

On some compilers 'char' is signed and is therefore always equal to or
less than 0x7f.  In order to avoid the compiler warning we perform the
comparison with an unsigned char type.


Index: cmXMLSafe.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmXMLSafe.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmXMLSafe.cxx	5 Feb 2009 21:31:37 -0000	1.1
--- cmXMLSafe.cxx	5 Feb 2009 22:09:28 -0000	1.2
***************
*** 61,65 ****
    for(char const* ci = first; ci != last; ++ci)
      {
!     char c = *ci;
      switch(c)
        {
--- 61,65 ----
    for(char const* ci = first; ci != last; ++ci)
      {
!     unsigned char c = static_cast<unsigned char>(*ci);
      switch(c)
        {
***************
*** 75,79 ****
          if(c >= 0x20 && c <= 0x7f)
            {
!           os.put(c);
            }
          else
--- 75,79 ----
          if(c >= 0x20 && c <= 0x7f)
            {
!           os.put(static_cast<char>(c));
            }
          else
***************
*** 82,88 ****
            // encoding.  Instead of escaping these bytes, we should
            // handle the current locale and its encoding.
-           unsigned char uc = static_cast<unsigned char>(c);
            char buf[16];
!           sprintf(buf, "&#x%hx;", static_cast<unsigned short>(uc));
            os << buf;
            }
--- 82,87 ----
            // encoding.  Instead of escaping these bytes, we should
            // handle the current locale and its encoding.
            char buf[16];
!           sprintf(buf, "&#x%hx;", static_cast<unsigned short>(c));
            os << buf;
            }



More information about the Cmake-commits mailing list