diff options
-rw-r--r-- | doc/zipfs.3 | 4 | ||||
-rw-r--r-- | doc/zipfs.n | 2 | ||||
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tclDecls.h | 6 | ||||
-rw-r--r-- | generic/tclZipfs.c | 20 | ||||
-rw-r--r-- | tests/zipfs.test | 12 |
6 files changed, 24 insertions, 24 deletions
diff --git a/doc/zipfs.3 b/doc/zipfs.3 index a4bb486..c67ce67 100644 --- a/doc/zipfs.3 +++ b/doc/zipfs.3 @@ -20,7 +20,7 @@ int \fBTclZipfs_Mount\fR(\fIinterp, zipname, mountpoint, password\fR) .sp int -\fBTclZipfs_MountBuffer\fR(\fIinterp, mountpoint, data, dataLen, copy\fR) +\fBTclZipfs_MountBuffer\fR(\fIinterp, data, dataLen, mountpoint, copy\fR) .sp int \fBTclZipfs_Unmount\fR(\fIinterp, mountpoint\fR) @@ -43,7 +43,7 @@ Name of a mount point, which must be a legal Tcl file or directory name. May be NULL to query current mount points. .AP "const char" *password in An (optional) password. Use NULL if no password is wanted to read the file. -.AP "unsigned char" *data in +.AP "const void" *data in A data buffer to mount. The data buffer must hold the contents of a ZIP archive, and must not be NULL. .AP size_t dataLen in diff --git a/doc/zipfs.n b/doc/zipfs.n index b04eeb5..1e6ddad 100644 --- a/doc/zipfs.n +++ b/doc/zipfs.n @@ -31,7 +31,7 @@ zipfs \- Mount and work with ZIP files within Tcl \fBzipfs unmount\fR \fImountpoint\fR .fi '\" The following subcommand is *UNDOCUMENTED* -'\" \fBzipfs mount_data\fR ?\fImountpoint\fR? ?\fIdata\fR? +'\" \fBzipfs mount_data\fR ?\fIdata\fR ?\fImountpoint\fR?? .BE .SH DESCRIPTION .PP diff --git a/generic/tcl.decls b/generic/tcl.decls index 301e22f..7c2c12a 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2346,8 +2346,8 @@ declare 634 { Tcl_Obj *TclZipfs_TclLibrary(void) } declare 635 { - int TclZipfs_MountBuffer(Tcl_Interp *interp, const char *mountPoint, - unsigned char *data, size_t datalen, int copy) + int TclZipfs_MountBuffer(Tcl_Interp *interp, const void *data, + size_t datalen, const char *mountPoint, int copy) } # TIP #445 diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 44f2149..e3cd94c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1893,8 +1893,8 @@ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, EXTERN Tcl_Obj * TclZipfs_TclLibrary(void); /* 635 */ EXTERN int TclZipfs_MountBuffer(Tcl_Interp *interp, - const char *mountPoint, unsigned char *data, - size_t datalen, int copy); + const void *data, size_t datalen, + const char *mountPoint, int copy); /* 636 */ EXTERN void Tcl_FreeInternalRep(Tcl_Obj *objPtr); /* 637 */ @@ -2721,7 +2721,7 @@ typedef struct TclStubs { int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mountPoint, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *mountPoint); /* 633 */ Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */ - int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const char *mountPoint, unsigned char *data, size_t datalen, int copy); /* 635 */ + int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const void *data, size_t datalen, const char *mountPoint, int copy); /* 635 */ void (*tcl_FreeInternalRep) (Tcl_Obj *objPtr); /* 636 */ char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, TCL_HASH_TYPE numBytes); /* 637 */ Tcl_ObjInternalRep * (*tcl_FetchInternalRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 638 */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index faa7afa..5053c0f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -2058,9 +2058,9 @@ TclZipfs_Mount( int TclZipfs_MountBuffer( Tcl_Interp *interp, /* Current interpreter. NULLable. */ - const char *mountPoint, /* Mount point path. */ - unsigned char *data, + const void *data, size_t datalen, + const char *mountPoint, /* Mount point path. */ int copy) { ZipFile *zf; @@ -2112,7 +2112,7 @@ TclZipfs_MountBuffer( memcpy(zf->data, data, datalen); zf->ptrToFree = zf->data; } else { - zf->data = data; + zf->data = (unsigned char *) data; zf->ptrToFree = NULL; } if (ZipFSFindTOC(interp, 0, zf) != TCL_OK) { @@ -2292,7 +2292,7 @@ ZipFSMountBufferObjCmd( int length; if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?"); + Tcl_WrongNumArgs(interp, 1, objv, "?data? ?mountpoint?"); return TCL_ERROR; } if (objc < 2) { @@ -2304,19 +2304,19 @@ ZipFSMountBufferObjCmd( return ret; } - mountPoint = Tcl_GetString(objv[1]); if (objc < 3) { ReadLock(); - DescribeMounted(interp, mountPoint); + DescribeMounted(interp, Tcl_GetString(objv[1])); Unlock(); return TCL_OK; } - data = TclGetBytesFromObj(interp, objv[2], &length); + data = TclGetBytesFromObj(interp, objv[1], &length); + mountPoint = Tcl_GetString(objv[2]); if (data == NULL) { return TCL_ERROR; } - return TclZipfs_MountBuffer(interp, mountPoint, data, length, 1); + return TclZipfs_MountBuffer(interp, data, length, mountPoint, 1); } /* @@ -5960,9 +5960,9 @@ TclZipfs_Mount( int TclZipfs_MountBuffer( Tcl_Interp *interp, /* Current interpreter. NULLable. */ - TCL_UNUSED(const char *), /* Mount point path. */ - TCL_UNUSED(unsigned char *), + TCL_UNUSED(const void *), TCL_UNUSED(size_t), + TCL_UNUSED(const char *), /* Mount point path. */ TCL_UNUSED(int)) { ZIPFS_ERROR(interp, "no zlib available"); diff --git a/tests/zipfs.test b/tests/zipfs.test index 55f430c..99e1cdc 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -186,7 +186,7 @@ test zipfs-2.8 {zipfs mkzip} -constraints zipfs -body { fconfigure $fin -translation binary set dat [read $fin] close $fin - zipfs mount_data def $dat + zipfs mount_data $dat def zipfs list -glob ${ziproot}def/cp850.* } -cleanup { cd $CWD @@ -382,20 +382,20 @@ test zipfs-4.5 {zipfs lmkimg: making image from mounted} -constraints zipfs -set } -result {/zipfs://ziptest/test/add.tcl /zipfs://ziptest/test/ok.tcl} test zipfs-5.1 {zipfs mount_data: short data} -constraints zipfs -body { - zipfs mount_data gorp {} + zipfs mount_data {} gorp } -returnCodes error -result {bad zip data} test zipfs-5.2 {zipfs mount_data: short data} -constraints zipfs -body { - zipfs mount_data gorp gorpGORPgorp + zipfs mount_data gorpGORPgorp gorp } -returnCodes error -result {bad zip data} test zipfs-5.3 {zipfs mount_data: short data} -constraints zipfs -body { set data PK\x03\x04..................................... append data PK\x01\x02..................................... append data PK\x05\x06..................................... - zipfs mount_data gorp $data + zipfs mount_data $data gorp } -returnCodes error -result {bad zip data} test zipfs-5.4 {zipfs mount_data: bad arg count} -constraints zipfs -body { - zipfs mount_data gorp {} foobar -} -returnCodes error -result {wrong # args: should be "zipfs mount_data ?mountpoint? ?data?"} + zipfs mount_data {} gorp foobar +} -returnCodes error -result {wrong # args: should be "zipfs mount_data ?data? ?mountpoint?"} test zipfs-6.1 {zipfs mkkey} -constraints zipfs -body { binary scan [zipfs mkkey gorp] cu* x |