[Libreoffice-commits] .: src/docrecord.py src/globals.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Tue Jan 8 06:32:56 PST 2013
src/docrecord.py | 5 ++---
src/globals.py | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
New commits:
commit 615ece27be29d28bffa139d635e421329d087ba0
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jan 8 15:32:53 2013 +0100
escaping anything under 0x20 is okay for non-doc as well
diff --git a/src/docrecord.py b/src/docrecord.py
index 09e5701..e5f29fe 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -31,7 +31,6 @@ class FcCompressed(DOCDirStream):
print '</fcCompressed>'
def getTransformedValue(self, start, end, logical = True):
- lowLimit = 21 # would be only 20 by default
if self.fCompressed:
offset = self.fc/2
if logical:
@@ -40,7 +39,7 @@ class FcCompressed(DOCDirStream):
else:
fro = start
to = end
- return globals.encodeName(self.mainStream.bytes[fro:to], lowLimit = lowLimit)
+ return globals.encodeName(self.mainStream.bytes[fro:to])
else:
if logical:
offset = self.fc
@@ -49,7 +48,7 @@ class FcCompressed(DOCDirStream):
else:
fro = start
to = end
- return globals.encodeName(self.mainStream.bytes[fro:to].decode('utf-16'), lowOnly = True, lowLimit = lowLimit)
+ return globals.encodeName(self.mainStream.bytes[fro:to].decode('utf-16'), lowOnly = True)
class Pcd(DOCDirStream):
"""The Pcd structure specifies the location of text in the WordDocument Stream and additional properties for this text."""
diff --git a/src/globals.py b/src/globals.py
index e51a846..68aae93 100644
--- a/src/globals.py
+++ b/src/globals.py
@@ -151,7 +151,7 @@ def debug (msg):
sys.stderr.write("DEBUG: %s\n"%msg)
-def encodeName (name, lowOnly = False, lowLimit = 20):
+def encodeName (name, lowOnly = False, lowLimit = 0x20):
"""Encode name that contains unprintable characters."""
n = len(name)
@@ -160,7 +160,7 @@ def encodeName (name, lowOnly = False, lowLimit = 20):
newname = ''
for i in xrange(0, n):
- if ord(name[i]) <= lowLimit or ((not lowOnly) and ord(name[i]) >= 127):
+ if ord(name[i]) < lowLimit or ((not lowOnly) and ord(name[i]) >= 127):
newname += "\\x%2.2X"%ord(name[i])
else:
newname += name[i]
More information about the Libreoffice-commits
mailing list