This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients lemburg, skrah
Date 2010-07-13.11:40:08
SpamBayes Score 4.2030195e-05
Marked as misclassified No
Message-id <1279021210.52.0.977549548315.issue9242@psf.upfronthosting.co.za>
In-reply-to
Content
> const int iorder[4] = {0, 1, 2, 3};

const isn't possible, iorder is modified later on. Adding the array
dimension did not change anything.

Making everything const (see below) did not change anything either.
I presume that Valgrind regards qq[2] or qq[3] as uninitialized.


Index: Objects/unicodeobject.c
===================================================================
--- Objects/unicodeobject.c     (revision 82816)
+++ Objects/unicodeobject.c     (working copy)
@@ -2216,10 +2216,12 @@
     int bo = 0;       /* assume native ordering by default */
     const char *errmsg = "";
     /* Offsets from q for retrieving bytes in the right order. */
+    const int iorder_le[] = {0, 1, 2, 3};
+    const int iorder_be[] = {3, 2, 1, 0};
 #ifdef BYTEORDER_IS_LITTLE_ENDIAN
-    int iorder[] = {0, 1, 2, 3};
+    const int *iorder = iorder_le;
 #else
-    int iorder[] = {3, 2, 1, 0};
+    const int *iorder = iorder_be;
 #endif
     PyObject *errorHandler = NULL;
     PyObject *exc = NULL;
@@ -2262,17 +2264,11 @@
 
     if (bo == -1) {
         /* force LE */
-        iorder[0] = 0;
-        iorder[1] = 1;
-        iorder[2] = 2;
-        iorder[3] = 3;
+        iorder = iorder_le;
     }
     else if (bo == 1) {
         /* force BE */
-        iorder[0] = 3;
-        iorder[1] = 2;
-        iorder[2] = 1;
-        iorder[3] = 0;
+        iorder = iorder_be;
     }
History
Date User Action Args
2010-07-13 11:40:10skrahsetrecipients: + skrah, lemburg
2010-07-13 11:40:10skrahsetmessageid: <1279021210.52.0.977549548315.issue9242@psf.upfronthosting.co.za>
2010-07-13 11:40:08skrahlinkissue9242 messages
2010-07-13 11:40:08skrahcreate