git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cff493c
)
made .open() parameter parsing more foolproof
author
kramm
<kramm>
Sat, 5 Apr 2008 07:24:00 +0000
(07:24 +0000)
committer
kramm
<kramm>
Sat, 5 Apr 2008 07:24:00 +0000
(07:24 +0000)
lib/python/gfx.c
patch
|
blob
|
history
diff --git
a/lib/python/gfx.c
b/lib/python/gfx.c
index
5bc2068
..
3ea625a
100644
(file)
--- a/
lib/python/gfx.c
+++ b/
lib/python/gfx.c
@@
-726,6
+726,8
@@
static PyObject* f_open(PyObject* parent, PyObject* args, PyObject* kwargs)
type = "image";
if(strchr("pP", filename[l-3]) && strchr("nN", filename[l-2]) && strchr("gG", filename[l-1]))
type = "image";
type = "image";
if(strchr("pP", filename[l-3]) && strchr("nN", filename[l-2]) && strchr("gG", filename[l-1]))
type = "image";
+ if(strchr("sS", filename[l-3]) && strchr("wW", filename[l-2]) && strchr("fF", filename[l-1]))
+ type = "swf";
} else if(filename[l-5]=='.') {
type = "image";
}
} else if(filename[l-5]=='.') {
type = "image";
}
@@
-734,9
+736,9
@@
static PyObject* f_open(PyObject* parent, PyObject* args, PyObject* kwargs)
if(!strcmp(type,"pdf"))
self->doc = pdfdriver->open(pdfdriver,filename);
if(!strcmp(type,"pdf"))
self->doc = pdfdriver->open(pdfdriver,filename);
- else if(!strcmp(type, "image"))
+ else if(!strcmp(type, "image") || !strcmp(type, "img"))
self->doc = imagedriver->open(imagedriver, filename);
self->doc = imagedriver->open(imagedriver, filename);
- else if(!strcmp(type, "swf"))
+ else if(!strcmp(type, "swf") || !strcmp(type, "SWF"))
self->doc = swfdriver->open(imagedriver, filename);
else
return PY_ERROR("Unknown type %s", type);
self->doc = swfdriver->open(imagedriver, filename);
else
return PY_ERROR("Unknown type %s", type);