File: big_endian

package info (click to toggle)
python-datrie 0.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,036 kB
  • sloc: ansic: 3,794; python: 756; sh: 13; makefile: 9
file content (20 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
From: Aniket Pradhan <aniket17133@iiitd.ac.in>
Date: Wed, 4 Nov 2020 13:53:15 +0530
Subject: Decode string based on byteorder of system
Origin: upstream, https://github.com/pytries/datrie/pull/85
Forwarded: not-needed

--- python-datrie.orig/src/datrie.pyx
+++ python-datrie/src/datrie.pyx
@@ -1120,7 +1120,10 @@
     if length == 0:
         length = cdatrie.alpha_char_strlen(key)*sizeof(cdatrie.AlphaChar)
     cdef char* c_str = <char*> key
-    return c_str[:length].decode('utf_32_le')
+    if sys.byteorder == "little":
+        return c_str[:length].decode('utf_32_le')
+    else:
+        return c_str[:length].decode('utf_32_be')
 
 
 def to_ranges(lst):