Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
47713fa9
Commit
47713fa9
authored
Sep 25, 1992
by
Sjoerd Mullender
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the last known bugs.
parent
9cddea65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
16 deletions
+82
-16
Modules/clmodule.c
Modules/clmodule.c
+82
-16
No files found.
Modules/clmodule.c
View file @
47713fa9
...
@@ -41,6 +41,11 @@ typedef struct {
...
@@ -41,6 +41,11 @@ typedef struct {
object
*
ob_data
;
object
*
ob_data
;
}
clobject
;
}
clobject
;
#define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \
err_setstr(RuntimeError, "(de)compressor not active"); \
return NULL; \
}
extern
typeobject
Cltype
;
/* Really static, forward */
extern
typeobject
Cltype
;
/* Really static, forward */
#define is_clobject(v) ((v)->ob_type == &Cltype)
#define is_clobject(v) ((v)->ob_type == &Cltype)
...
@@ -62,6 +67,50 @@ cl_ErrorHandler(long errnum, const char *fmt, ...)
...
@@ -62,6 +67,50 @@ cl_ErrorHandler(long errnum, const char *fmt, ...)
err_setstr
(
ClError
,
errbuf
);
err_setstr
(
ClError
,
errbuf
);
}
}
static
object
*
cl_CloseCompressor
(
self
,
args
)
clobject
*
self
;
object
*
args
;
{
CheckCompressor
(
self
);
if
(
!
getnoarg
(
args
))
return
NULL
;
if
(
clCloseCompressor
(
self
->
ob_compressorHdl
)
==
FAILURE
)
{
if
(
!
error_handler_called
)
err_setstr
(
ClError
,
"CloseCompressor failed"
);
return
NULL
;
}
self
->
ob_compressorHdl
=
NULL
;
INCREF
(
None
);
return
None
;
}
static
object
*
cl_CloseDecompressor
(
self
,
args
)
clobject
*
self
;
object
*
args
;
{
CheckCompressor
(
self
);
if
(
!
getnoarg
(
args
))
return
NULL
;
if
(
clCloseDecompressor
(
self
->
ob_compressorHdl
)
==
FAILURE
)
{
if
(
!
error_handler_called
)
err_setstr
(
ClError
,
"CloseDecompressor failed"
);
return
NULL
;
}
self
->
ob_compressorHdl
=
NULL
;
INCREF
(
None
);
return
None
;
}
static
object
*
static
object
*
cl_Compress
(
self
,
args
)
cl_Compress
(
self
,
args
)
clobject
*
self
;
clobject
*
self
;
...
@@ -70,6 +119,8 @@ cl_Compress(self, args)
...
@@ -70,6 +119,8 @@ cl_Compress(self, args)
object
*
data
;
object
*
data
;
long
frameIndex
,
numberOfFrames
,
dataSize
;
long
frameIndex
,
numberOfFrames
,
dataSize
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"(ii)"
,
&
frameIndex
,
&
numberOfFrames
))
if
(
!
getargs
(
args
,
"(ii)"
,
&
frameIndex
,
&
numberOfFrames
))
return
NULL
;
return
NULL
;
...
@@ -104,6 +155,8 @@ cl_Decompress(self, args)
...
@@ -104,6 +155,8 @@ cl_Decompress(self, args)
object
*
data
;
object
*
data
;
long
frameIndex
,
numberOfFrames
;
long
frameIndex
,
numberOfFrames
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"(ii)"
,
&
frameIndex
,
&
numberOfFrames
))
if
(
!
getargs
(
args
,
"(ii)"
,
&
frameIndex
,
&
numberOfFrames
))
return
NULL
;
return
NULL
;
...
@@ -133,6 +186,8 @@ cl_GetCompressorInfo(self, args)
...
@@ -133,6 +186,8 @@ cl_GetCompressorInfo(self, args)
void
*
info
;
void
*
info
;
object
*
infoObject
,
*
res
;
object
*
infoObject
,
*
res
;
CheckCompressor
(
self
);
if
(
!
getnoarg
(
args
))
if
(
!
getnoarg
(
args
))
return
NULL
;
return
NULL
;
...
@@ -153,6 +208,8 @@ cl_GetDefault(self, args)
...
@@ -153,6 +208,8 @@ cl_GetDefault(self, args)
{
{
long
initial
,
result
;
long
initial
,
result
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"i"
,
&
initial
))
if
(
!
getargs
(
args
,
"i"
,
&
initial
))
return
NULL
;
return
NULL
;
...
@@ -171,6 +228,8 @@ cl_GetMinMax(self, args)
...
@@ -171,6 +228,8 @@ cl_GetMinMax(self, args)
{
{
long
param
,
min
,
max
;
long
param
,
min
,
max
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"i"
,
&
param
))
if
(
!
getargs
(
args
,
"i"
,
&
param
))
return
NULL
;
return
NULL
;
...
@@ -190,6 +249,8 @@ cl_GetName(self, args)
...
@@ -190,6 +249,8 @@ cl_GetName(self, args)
long
descriptor
;
long
descriptor
;
char
*
name
;
char
*
name
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"i"
,
&
descriptor
))
if
(
!
getargs
(
args
,
"i"
,
&
descriptor
))
return
NULL
;
return
NULL
;
...
@@ -217,6 +278,8 @@ doParams(self, args, func, modified)
...
@@ -217,6 +278,8 @@ doParams(self, args, func, modified)
long
length
;
long
length
;
int
i
;
int
i
;
CheckCompressor
(
self
);
if
(
!
getargs
(
args
,
"O"
,
&
list
))
if
(
!
getargs
(
args
,
"O"
,
&
list
))
return
NULL
;
return
NULL
;
if
(
!
is_listobject
(
list
))
{
if
(
!
is_listobject
(
list
))
{
...
@@ -277,6 +340,8 @@ cl_QueryParams(self, args)
...
@@ -277,6 +340,8 @@ cl_QueryParams(self, args)
object
*
list
;
object
*
list
;
int
i
;
int
i
;
CheckCompressor
(
self
);
if
(
!
getnoarg
(
args
))
if
(
!
getnoarg
(
args
))
return
NULL
;
return
NULL
;
...
@@ -315,6 +380,7 @@ cl_QueryParams(self, args)
...
@@ -315,6 +380,7 @@ cl_QueryParams(self, args)
}
}
static
struct
methodlist
compressor_methods
[]
=
{
static
struct
methodlist
compressor_methods
[]
=
{
{
"CloseCompressor"
,
cl_CloseCompressor
},
{
"Compress"
,
cl_Compress
},
{
"Compress"
,
cl_Compress
},
{
"GetCompressorInfo"
,
cl_GetCompressorInfo
},
{
"GetCompressorInfo"
,
cl_GetCompressorInfo
},
{
"GetDefault"
,
cl_GetDefault
},
{
"GetDefault"
,
cl_GetDefault
},
...
@@ -327,6 +393,7 @@ static struct methodlist compressor_methods[] = {
...
@@ -327,6 +393,7 @@ static struct methodlist compressor_methods[] = {
};
};
static
struct
methodlist
decompressor_methods
[]
=
{
static
struct
methodlist
decompressor_methods
[]
=
{
{
"CloseDecompressor"
,
cl_CloseDecompressor
},
{
"Decompress"
,
cl_Decompress
},
{
"Decompress"
,
cl_Decompress
},
{
"GetDefault"
,
cl_GetDefault
},
{
"GetDefault"
,
cl_GetDefault
},
{
"GetMinMax"
,
cl_GetMinMax
},
{
"GetMinMax"
,
cl_GetMinMax
},
...
@@ -536,8 +603,18 @@ cl_OpenDecompressor(self, args)
...
@@ -536,8 +603,18 @@ cl_OpenDecompressor(self, args)
clobject
*
new
;
clobject
*
new
;
object
*
res
;
object
*
res
;
if
(
!
getargs
(
args
,
"(s#OO)"
,
&
info
,
&
infoSize
,
&
GetDataCBPtr
,
if
(
!
getargs
(
args
,
"((iiiiiiiiii)s#OO)"
,
&
callbackID
))
&
compressionFormat
.
width
,
&
compressionFormat
.
height
,
&
compressionFormat
.
frameSize
,
&
compressionFormat
.
dataMaxSize
,
&
compressionFormat
.
originalFormat
,
&
compressionFormat
.
components
,
&
compressionFormat
.
bitsPerComponent
,
&
compressionFormat
.
frameRate
,
&
compressionFormat
.
numberOfFrames
,
&
compressionFormat
.
compressionScheme
,
&
info
,
&
infoSize
,
&
GetDataCBPtr
,
&
callbackID
))
return
NULL
;
return
NULL
;
new
=
NEWOBJ
(
clobject
,
&
Cltype
);
new
=
NEWOBJ
(
clobject
,
&
Cltype
);
...
@@ -552,6 +629,7 @@ cl_OpenDecompressor(self, args)
...
@@ -552,6 +629,7 @@ cl_OpenDecompressor(self, args)
error_handler_called
=
0
;
error_handler_called
=
0
;
if
(
clOpenDecompressor
(
&
compressionFormat
,
infoSize
,
info
,
GetData
,
if
(
clOpenDecompressor
(
&
compressionFormat
,
infoSize
,
info
,
GetData
,
(
void
*
)
new
,
&
new
->
ob_compressorHdl
)
==
FAILURE
)
{
(
void
*
)
new
,
&
new
->
ob_compressorHdl
)
==
FAILURE
)
{
new
->
ob_compressorHdl
=
NULL
;
/* just in case... */
DECREF
(
new
);
DECREF
(
new
);
if
(
!
error_handler_called
)
if
(
!
error_handler_called
)
err_setstr
(
ClError
,
"opendecompressor failed"
);
err_setstr
(
ClError
,
"opendecompressor failed"
);
...
@@ -566,21 +644,9 @@ cl_OpenDecompressor(self, args)
...
@@ -566,21 +644,9 @@ cl_OpenDecompressor(self, args)
new
->
ob_callbackID
=
callbackID
;
new
->
ob_callbackID
=
callbackID
;
XINCREF
(
new
->
ob_callbackID
);
XINCREF
(
new
->
ob_callbackID
);
new
->
ob_data
=
NULL
;
new
->
ob_data
=
NULL
;
new
->
ob_dataMaxSize
=
compressionFormat
.
dataMaxSize
;
res
=
mkvalue
(
"(O(iiiiiiiiii))"
,
new
,
return
new
;
compressionFormat
.
width
,
compressionFormat
.
height
,
compressionFormat
.
frameSize
,
compressionFormat
.
dataMaxSize
,
compressionFormat
.
originalFormat
,
compressionFormat
.
components
,
compressionFormat
.
bitsPerComponent
,
compressionFormat
.
frameRate
,
compressionFormat
.
numberOfFrames
,
compressionFormat
.
compressionScheme
);
DECREF
(
new
);
return
res
;
}
}
static
object
*
static
object
*
...
...
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