You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2004/01/06 22:52:28 UTC

cvs commit: xml-xerces/c/src/xercesc/util/Transcoders/Win32 Win32TransService.cpp

amassari    2004/01/06 13:52:28

  Modified:    c/src/xercesc/util/Transcoders/Win32 Win32TransService.cpp
  Log:
  Replaced the call to wcstombs using a NULL target buffer with the equivalent call to WideCharToMultiByte (bug# 25768)
  
  Revision  Changes    Path
  1.17      +4 -24     xml-xerces/c/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
  
  Index: Win32TransService.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Win32TransService.cpp	24 Dec 2003 15:24:15 -0000	1.16
  +++ Win32TransService.cpp	6 Jan 2004 21:52:28 -0000	1.17
  @@ -867,15 +867,7 @@
       if (!srcText)
           return 0;
   
  -    unsigned int retVal = -1;
  -    
  -    #if defined(XML_METROWERKS)
  -    	const unsigned int srcLen = ::wcslen(srcText);
  -    	retVal = ::wcsmbslen(srcText, srcLen);
  -    #else
  -     	retVal = ::wcstombs(0, srcText, 0);
  -    #endif
  -    
  +    const unsigned int retVal = ::WideCharToMultiByte(CP_ACP, 0, srcText, -1, NULL, 0, NULL, NULL);
       if (retVal == (unsigned int)-1)
           return 0;
       return retVal;
  @@ -892,17 +884,7 @@
       if (*toTranscode)
       {
           // Calc the needed size
  -        unsigned int neededLen;
  -        
  -       #if defined(XML_METROWERKS)
  -	    	const unsigned int srcLen = ::wcslen(toTranscode);
  -	    	neededLen = ::wcsmbslen(toTranscode, srcLen);
  -	    #else
  -	     	neededLen = ::wcstombs(0, toTranscode, 0);
  -	    #endif
  -
  -        if (neededLen == (unsigned int)-1)
  -            return 0;
  +        const unsigned int neededLen = calcRequiredSize(toTranscode);
   
           // Allocate a buffer of that size plus one for the null and transcode
           retVal = new char[neededLen + 1];
  @@ -929,9 +911,7 @@
       if (*toTranscode)
       {
           // Calc the needed size
  -        const unsigned int neededLen = ::wcstombs(0, toTranscode, 0);
  -        if (neededLen == (unsigned int)-1)
  -            return 0;
  +        const unsigned int neededLen = calcRequiredSize(toTranscode, manager);
   
           // Allocate a buffer of that size plus one for the null and transcode
           retVal = (char*) manager->allocate((neededLen + 1) * sizeof(char)); //new char[neededLen + 1];
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org