summaryrefslogtreecommitdiffstats
path: root/Demo/zlib/minigzip.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
commit182b5aca27d376b08a2904bed42b751496f932f3 (patch)
treedf13115820dbc879c0fe2eae488c9f8c0215a7da /Demo/zlib/minigzip.py
parente6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff)
downloadcpython-182b5aca27d376b08a2904bed42b751496f932f3.zip
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Demo/zlib/minigzip.py')
-rwxr-xr-xDemo/zlib/minigzip.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Demo/zlib/minigzip.py b/Demo/zlib/minigzip.py
index dc99d9b..e2801de 100755
--- a/Demo/zlib/minigzip.py
+++ b/Demo/zlib/minigzip.py
@@ -9,7 +9,7 @@ def write32(output, value):
output.write(chr(value & 255)) ; value=value / 256
output.write(chr(value & 255)) ; value=value / 256
output.write(chr(value & 255))
-
+
def read32(input):
v=ord(input.read(1))
v=v+ (ord(input.read(1))<<8 )
@@ -19,9 +19,9 @@ def read32(input):
import zlib, sys
if len(sys.argv)!=2:
- print 'Usage: minigzip.py <filename>'
- print ' The file will be compressed or decompressed.'
- sys.exit(0)
+ print 'Usage: minigzip.py <filename>'
+ print ' The file will be compressed or decompressed.'
+ sys.exit(0)
filename=sys.argv[1]
compressing=1 ; outputname=filename+'.gz'
@@ -64,7 +64,7 @@ else:
# extra flags, and OS byte.
if flag & FEXTRA:
# Read & discard the extra field, if present
- xlen=ord(input.read(1))
+ xlen=ord(input.read(1))
xlen=xlen+256*ord(input.read(1))
input.read(xlen)
if flag & FNAME:
@@ -92,11 +92,11 @@ else:
decompdata=decompobj.flush()
output.write(decompdata) ; length=length+len(decompdata)
crcval=zlib.crc32(decompdata, crcval)
-
+
# We've read to the end of the file, so we have to rewind in order
# to reread the 8 bytes containing the CRC and the file size. The
# decompressor is smart and knows when to stop, so feeding it
- # extra data is harmless.
+ # extra data is harmless.
input.seek(-8, 2)
crc32=read32(input)
isize=read32(input)
@@ -104,4 +104,3 @@ else:
if isize!=length: print 'Incorrect length of data produced'
input.close() ; output.close()
-