[Python-checkins] python/dist/src/Demo/zlib minigzip.py, 1.3,
1.4 zlibdemo.py, 1.2, 1.3
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Sun Jul 18 08:11:58 CEST 2004
- Previous message: [Python-checkins] python/dist/src/Demo/xml elem_count.py, 1.1,
1.2 roundtrip.py, 1.1, 1.2 rss2html.py, 1.1, 1.2
- Next message: [Python-checkins]
python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents
Disk_Folder_File_Suite.py, 1.2, 1.3 Folder_Actions_Suite.py,
1.4, 1.5 Standard_Suite.py, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Demo/zlib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31031
Modified Files:
minigzip.py zlibdemo.py
Log Message:
Whitespace normalization, via reindent.py.
Index: minigzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/zlib/minigzip.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** minigzip.py 12 Mar 1999 19:07:58 -0000 1.3
--- minigzip.py 18 Jul 2004 06:11:56 -0000 1.4
***************
*** 10,14 ****
output.write(chr(value & 255)) ; value=value / 256
output.write(chr(value & 255))
!
def read32(input):
v=ord(input.read(1))
--- 10,14 ----
output.write(chr(value & 255)) ; value=value / 256
output.write(chr(value & 255))
!
def read32(input):
v=ord(input.read(1))
***************
*** 20,26 ****
import zlib, sys
if len(sys.argv)!=2:
! print 'Usage: minigzip.py <filename>'
! print ' The file will be compressed or decompressed.'
! sys.exit(0)
filename=sys.argv[1]
--- 20,26 ----
import zlib, sys
if len(sys.argv)!=2:
! print 'Usage: minigzip.py <filename>'
! print ' The file will be compressed or decompressed.'
! sys.exit(0)
filename=sys.argv[1]
***************
*** 65,69 ****
if flag & FEXTRA:
# Read & discard the extra field, if present
! xlen=ord(input.read(1))
xlen=xlen+256*ord(input.read(1))
input.read(xlen)
--- 65,69 ----
if flag & FEXTRA:
# Read & discard the extra field, if present
! xlen=ord(input.read(1))
xlen=xlen+256*ord(input.read(1))
input.read(xlen)
***************
*** 93,101 ****
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.
input.seek(-8, 2)
crc32=read32(input)
--- 93,101 ----
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.
input.seek(-8, 2)
crc32=read32(input)
***************
*** 105,107 ****
input.close() ; output.close()
-
--- 105,106 ----
Index: zlibdemo.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/zlib/zlibdemo.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** zlibdemo.py 12 Mar 1999 19:07:59 -0000 1.2
--- zlibdemo.py 18 Jul 2004 06:11:56 -0000 1.3
***************
*** 5,9 ****
else: filename='zlibdemo.py'
print 'Reading', filename
! f=open(filename, 'r') # Get the data to compress
s=f.read()
f.close()
--- 5,9 ----
else: filename='zlibdemo.py'
print 'Reading', filename
! f=open(filename, 'r') # Get the data to compress
s=f.read()
f.close()
***************
*** 25,29 ****
for i in range(0, len(s), chunk):
comptext=comptext+compressor.compress(s[i:i+chunk])
! comptext=comptext+compressor.flush() # Don't forget to call flush()!!
for i in range(0, len(comptext), chunk):
--- 25,29 ----
for i in range(0, len(s), chunk):
comptext=comptext+compressor.compress(s[i:i+chunk])
! comptext=comptext+compressor.flush() # Don't forget to call flush()!!
for i in range(0, len(comptext), chunk):
***************
*** 34,36 ****
print ' Original:', len(s), 'Compressed:', len(comptext),
print 'Uncompressed:', len(decomp)
-
--- 34,35 ----
- Previous message: [Python-checkins] python/dist/src/Demo/xml elem_count.py, 1.1,
1.2 roundtrip.py, 1.1, 1.2 rss2html.py, 1.1, 1.2
- Next message: [Python-checkins]
python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents
Disk_Folder_File_Suite.py, 1.2, 1.3 Folder_Actions_Suite.py,
1.4, 1.5 Standard_Suite.py, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list