Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
97b54574
Kaydet (Commit)
97b54574
authored
Haz 03, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Small changes (casts etc.) by Jack, for Mac compilation.
üst
3c540307
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
zlibmodule.c
Modules/zlibmodule.c
+16
-12
No files found.
Modules/zlibmodule.c
Dosyayı görüntüle @
97b54574
/* zlibmodule.c -- gzip-compatible data compression */
#include
<Python.h>
#include
<zlib.h>
#include
"Python.h"
#include
"zlib.h"
/* The following parameters are copied from zutil.h, version 0.95 */
#define DEFLATED 8
...
...
@@ -75,7 +75,8 @@ PyZlib_compress(self, args)
"Can't allocate memory to compress data"
);
return
NULL
;
}
zst
.
zalloc
=
(
alloc_func
)
zst
.
zfree
=
(
free_func
)
Z_NULL
;
zst
.
zalloc
=
(
alloc_func
)
NULL
;
zst
.
zfree
=
(
free_func
)
Z_NULL
;
zst
.
next_out
=
(
Byte
*
)
output
;
zst
.
next_in
=
(
Byte
*
)
input
;
zst
.
avail_in
=
length
;
...
...
@@ -137,7 +138,7 @@ PyZlib_compress(self, args)
free
(
output
);
return
NULL
;
}
ReturnVal
=
PyString_FromStringAndSize
(
output
,
zst
.
total_out
);
ReturnVal
=
PyString_FromStringAndSize
(
(
char
*
)
output
,
zst
.
total_out
);
free
(
output
);
return
ReturnVal
;
}
...
...
@@ -168,7 +169,8 @@ PyZlib_decompress(self, args)
"Can't allocate memory to decompress data"
);
return
NULL
;
}
zst
.
zalloc
=
(
alloc_func
)
zst
.
zfree
=
(
free_func
)
Z_NULL
;
zst
.
zalloc
=
(
alloc_func
)
NULL
;
zst
.
zfree
=
(
free_func
)
Z_NULL
;
zst
.
next_out
=
(
Byte
*
)
output
;
zst
.
next_in
=
(
Byte
*
)
input
;
err
=
inflateInit
(
&
zst
);
...
...
@@ -236,7 +238,7 @@ PyZlib_decompress(self, args)
free
(
output
);
return
NULL
;
}
ReturnVal
=
PyString_FromStringAndSize
(
output
,
zst
.
total_out
);
ReturnVal
=
PyString_FromStringAndSize
(
(
char
*
)
output
,
zst
.
total_out
);
free
(
output
);
return
ReturnVal
;
}
...
...
@@ -276,7 +278,8 @@ PyZlib_compressobj(selfptr, args)
}
self
=
newcompobject
(
&
Comptype
);
if
(
self
==
NULL
)
return
(
NULL
);
self
->
zst
.
zalloc
=
(
alloc_func
)
self
->
zst
.
zfree
=
(
free_func
)
Z_NULL
;
self
->
zst
.
zalloc
=
(
alloc_func
)
NULL
;
self
->
zst
.
zfree
=
(
free_func
)
Z_NULL
;
err
=
deflateInit2
(
&
self
->
zst
,
level
,
method
,
wbits
,
memLevel
,
strategy
);
switch
(
err
)
{
...
...
@@ -319,7 +322,8 @@ PyZlib_decompressobj(selfptr, args)
}
self
=
newcompobject
(
&
Decomptype
);
if
(
self
==
NULL
)
return
(
NULL
);
self
->
zst
.
zalloc
=
(
alloc_func
)
self
->
zst
.
zfree
=
(
free_func
)
Z_NULL
;
self
->
zst
.
zalloc
=
(
alloc_func
)
NULL
;
self
->
zst
.
zfree
=
(
free_func
)
Z_NULL
;
/* XXX If illegal values of wbits are allowed to get here, Python
coredumps, instead of raising an exception as it should.
This is a bug in zlib 0.95; I have reported it. */
...
...
@@ -408,7 +412,7 @@ PyZlib_objcompress(self, args)
PyErr_SetString
(
ZlibError
,
temp
);
return
NULL
;
}
RetVal
=
PyString_FromStringAndSize
(
buf
,
self
->
zst
.
next_out
-
buf
);
RetVal
=
PyString_FromStringAndSize
(
(
char
*
)
buf
,
self
->
zst
.
next_out
-
buf
);
free
(
buf
);
return
RetVal
;
}
...
...
@@ -456,7 +460,7 @@ PyZlib_objdecompress(self, args)
PyErr_SetString
(
ZlibError
,
temp
);
return
NULL
;
}
RetVal
=
PyString_FromStringAndSize
(
buf
,
self
->
zst
.
next_out
-
buf
);
RetVal
=
PyString_FromStringAndSize
(
(
char
*
)
buf
,
self
->
zst
.
next_out
-
buf
);
free
(
buf
);
return
RetVal
;
}
...
...
@@ -501,7 +505,7 @@ PyZlib_flush(self, args)
PyErr_SetString
(
ZlibError
,
temp
);
return
NULL
;
}
RetVal
=
PyString_FromStringAndSize
(
buf
,
self
->
zst
.
next_out
-
buf
);
RetVal
=
PyString_FromStringAndSize
(
(
char
*
)
buf
,
self
->
zst
.
next_out
-
buf
);
free
(
buf
);
err
=
deflateEnd
(
&
(
self
->
zst
));
if
(
err
!=
Z_OK
)
...
...
@@ -555,7 +559,7 @@ PyZlib_unflush(self, args)
PyErr_SetString
(
ZlibError
,
temp
);
return
NULL
;
}
RetVal
=
PyString_FromStringAndSize
(
buf
,
self
->
zst
.
next_out
-
buf
);
RetVal
=
PyString_FromStringAndSize
(
(
char
*
)
buf
,
self
->
zst
.
next_out
-
buf
);
free
(
buf
);
err
=
inflateEnd
(
&
(
self
->
zst
));
if
(
err
!=
Z_OK
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment