[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.14,2.15

Guido van Rossum python-dev@python.org
Wed, 3 May 2000 08:27:25 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Objects
In directory eric:/projects/python/develop/guido/src/Objects

Modified Files:
	unicodeobject.c 
Log Message:
Mark Hammond withdraws his fix -- the size includes the trailing 0 so
a size of 0 *is* illegal.


Index: unicodeobject.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.14
retrieving revision 2.15
diff -C2 -r2.14 -r2.15
*** unicodeobject.c	2000/05/03 11:03:24	2.14
--- unicodeobject.c	2000/05/03 12:27:22	2.15
***************
*** 1556,1560 ****
      /* First get the size of the result */
      DWORD usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0);
!     if (size > 0 && usize==0)
          return PyErr_SetFromWindowsErrWithFilename(0, NULL);
  
--- 1556,1560 ----
      /* First get the size of the result */
      DWORD usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0);
!     if (usize==0)
          return PyErr_SetFromWindowsErrWithFilename(0, NULL);
  
***************
*** 1579,1590 ****
      PyObject *repr;
      char *s;
-     DWORD mbcssize;
  
-     /* If there are no characters, bail now! */
-     if (size==0)
- 	    return PyString_FromString("");
- 
      /* First get the size of the result */
!     mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL);
      if (mbcssize==0)
          return PyErr_SetFromWindowsErrWithFilename(0, NULL);
--- 1579,1585 ----
      PyObject *repr;
      char *s;
  
      /* First get the size of the result */
!     DWORD mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL);
      if (mbcssize==0)
          return PyErr_SetFromWindowsErrWithFilename(0, NULL);