[Python-checkins] cpython: Replace tabs by spaces

victor.stinner python-checkins at python.org
Fri Nov 4 20:05:09 CET 2011


http://hg.python.org/cpython/rev/6aa9a151d064
changeset:   73355:6aa9a151d064
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Fri Nov 04 20:06:39 2011 +0100
summary:
  Replace tabs by spaces

files:
  Objects/unicodeobject.c |  92 ++++++++++++++--------------
  1 files changed, 46 insertions(+), 46 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7267,13 +7267,13 @@
     BOOL *pusedDefaultChar = &usedDefaultChar;
     int outsize;
     PyObject *exc = NULL;
-	Py_UNICODE *p;
-	Py_ssize_t size;
+    Py_UNICODE *p;
+    Py_ssize_t size;
     const DWORD flags = encode_code_page_flags(code_page, NULL);
     char *out;
-	/* Create a substring so that we can get the UTF-16 representation
-	   of just the slice under consideration. */
-	PyObject *substring;
+    /* Create a substring so that we can get the UTF-16 representation
+       of just the slice under consideration. */
+    PyObject *substring;
 
     assert(len > 0);
 
@@ -7282,14 +7282,14 @@
     else
         pusedDefaultChar = NULL;
 
-	substring = PyUnicode_Substring(unicode, offset, offset+len);
-	if (substring == NULL)
-		return -1;
-	p = PyUnicode_AsUnicodeAndSize(substring, &size);
-	if (p == NULL) {
-		Py_DECREF(substring);
-		return -1;
-	}
+    substring = PyUnicode_Substring(unicode, offset, offset+len);
+    if (substring == NULL)
+        return -1;
+    p = PyUnicode_AsUnicodeAndSize(substring, &size);
+    if (p == NULL) {
+        Py_DECREF(substring);
+        return -1;
+    }
 
     /* First get the size of the result */
     outsize = WideCharToMultiByte(code_page, flags,
@@ -7299,18 +7299,18 @@
     if (outsize <= 0)
         goto error;
     /* If we used a default char, then we failed! */
-	if (pusedDefaultChar && *pusedDefaultChar) {
-		Py_DECREF(substring);
+    if (pusedDefaultChar && *pusedDefaultChar) {
+        Py_DECREF(substring);
         return -2;
-	}
+    }
 
     if (*outbytes == NULL) {
         /* Create string object */
         *outbytes = PyBytes_FromStringAndSize(NULL, outsize);
-		if (*outbytes == NULL) {
-			Py_DECREF(substring);
+        if (*outbytes == NULL) {
+            Py_DECREF(substring);
             return -1;
-		}
+        }
         out = PyBytes_AS_STRING(*outbytes);
     }
     else {
@@ -7318,13 +7318,13 @@
         const Py_ssize_t n = PyBytes_Size(*outbytes);
         if (outsize > PY_SSIZE_T_MAX - n) {
             PyErr_NoMemory();
-			Py_DECREF(substring);
+            Py_DECREF(substring);
             return -1;
         }
-		if (_PyBytes_Resize(outbytes, n + outsize) < 0) {
-			Py_DECREF(substring);
+        if (_PyBytes_Resize(outbytes, n + outsize) < 0) {
+            Py_DECREF(substring);
             return -1;
-		}
+        }
         out = PyBytes_AS_STRING(*outbytes) + n;
     }
 
@@ -7333,7 +7333,7 @@
                                   p, size,
                                   out, outsize,
                                   NULL, pusedDefaultChar);
-	Py_CLEAR(substring);
+    Py_CLEAR(substring);
     if (outsize <= 0)
         goto error;
     if (pusedDefaultChar && *pusedDefaultChar)
@@ -7341,7 +7341,7 @@
     return 0;
 
 error:
-	Py_XDECREF(substring);
+    Py_XDECREF(substring);
     if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
         return -2;
     PyErr_SetFromWindowsErr(0);
@@ -7361,8 +7361,8 @@
                         Py_ssize_t insize, const char* errors)
 {
     const DWORD flags = encode_code_page_flags(code_page, errors);
-	Py_ssize_t pos = unicode_offset;
-	Py_ssize_t endin = unicode_offset + insize;
+    Py_ssize_t pos = unicode_offset;
+    Py_ssize_t endin = unicode_offset + insize;
     /* Ideally, we should get reason from FormatMessage. This is the Windows
        2000 English version of the message. */
     const char *reason = "invalid character";
@@ -7430,20 +7430,20 @@
     /* Encode the string character per character */
     while (pos < endin)
     {
-		Py_UCS4 ch = PyUnicode_READ_CHAR(unicode, pos);
-		wchar_t chars[2];
-		int charsize;
-		if (ch < 0x10000) {
-			chars[0] = (wchar_t)ch;
-			charsize = 1;
-		}
-		else {
-			ch -= 0x10000;
-			chars[0] = 0xd800 + (ch >> 10);
-			chars[1] = 0xdc00 + (ch & 0x3ff);
-			charsize = 2;
-		}
-		
+        Py_UCS4 ch = PyUnicode_READ_CHAR(unicode, pos);
+        wchar_t chars[2];
+        int charsize;
+        if (ch < 0x10000) {
+            chars[0] = (wchar_t)ch;
+            charsize = 1;
+        }
+        else {
+            ch -= 0x10000;
+            chars[0] = 0xd800 + (ch >> 10);
+            chars[1] = 0xdc00 + (ch & 0x3ff);
+            charsize = 2;
+        }
+
         outsize = WideCharToMultiByte(code_page, flags,
                                       chars, charsize,
                                       buffer, Py_ARRAY_LENGTH(buffer),
@@ -7547,9 +7547,9 @@
     Py_ssize_t offset;
     int chunk_len, ret, done;
 
-	if (PyUnicode_READY(unicode) < 0)
-		return NULL;
-	len = PyUnicode_GET_LENGTH(unicode);
+    if (PyUnicode_READY(unicode) < 0)
+        return NULL;
+    len = PyUnicode_GET_LENGTH(unicode);
 
     if (code_page < 0) {
         PyErr_SetString(PyExc_ValueError, "invalid code page number");
@@ -7563,7 +7563,7 @@
     do
     {
 #ifdef NEED_RETRY
-		/* UTF-16 encoding may double the size, so use only INT_MAX/2
+        /* UTF-16 encoding may double the size, so use only INT_MAX/2
            chunks. */
         if (len > INT_MAX/2) {
             chunk_len = INT_MAX/2;
@@ -7575,7 +7575,7 @@
             chunk_len = (int)len;
             done = 1;
         }
-	
+
         ret = encode_code_page_strict(code_page, &outbytes,
                                       unicode, offset, chunk_len,
                                       errors);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list