Tcl Source Code

Check-in [d199aeb4b6]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:slightly better: Use GetFileSizeEx() on win64 and GetFileSize on win32
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core_zip_vfs-review
Files: files | file ages | folders
SHA3-256: d199aeb4b62c0e21fe57482b4b55054067cea41c1515d4948238cd19156f1652
User & Date: jan.nijtmans 2018-09-09 17:05:38
Context
2018-09-11
22:41
Make ready for TIP #494 compatibility Closed-Leaf check-in: da3a746b1d user: jan.nijtmans tags: core_zip_vfs-review
2018-09-09
17:05
slightly better: Use GetFileSizeEx() on win64 and GetFileSize on win32 check-in: d199aeb4b6 user: jan.nijtmans tags: core_zip_vfs-review
2018-09-07
11:56
Use GetFileSizeEx() in stead of GetFileSize(), to get the file size on Windows. Minor improvement: a... check-in: db7a21f8e1 user: jan.nijtmans tags: core_zip_vfs-review
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclZipfs.c.

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
....
1053
1054
1055
1056
1057
1058
1059
1060

1061
1062
1063





1064
1065
1066
1067
1068
1069
1070
typedef struct ZipFile {
    char *name;               /* Archive name */
    size_t namelen;
    char is_membuf;           /* When true, not a file but a memory buffer */
    Tcl_Channel chan;         /* Channel handle or NULL */
    unsigned char *data;      /* Memory mapped or malloc'ed file */
    Tcl_WideUInt length;      /* Length of memory mapped file */
    unsigned char *tofree;    /* Non-NULL if malloc'ed file */
    size_t nfiles;            /* Number of files in archive */
    size_t baseoffs;          /* Archive start */
    size_t baseoffsp;         /* Password start */
    size_t centoffs;          /* Archive directory start */
    unsigned char pwbuf[264]; /* Password buffer */
#if defined(_WIN32) || defined(_WIN64)
................................................................................
        if (i != zf->length) {
            ZIPFS_ERROR(interp,"file read error");
            goto error;
        }
        Tcl_Close(interp, zf->chan);
        zf->chan = NULL;
    } else {
#if defined(_WIN32) || defined(_WIN64)

        i = GetFileSizeEx((HANDLE) handle, (PLARGE_INTEGER)&zf->length);
        if (
            (i == 0) ||





            (zf->length < ZIP_CENTRAL_END_LEN)
        ) {
            ZIPFS_ERROR(interp,"invalid file size");
            goto error;
        }
        zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0,
                       zf->length, 0);






|







 







|
>



>
>
>
>
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
....
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
typedef struct ZipFile {
    char *name;               /* Archive name */
    size_t namelen;
    char is_membuf;           /* When true, not a file but a memory buffer */
    Tcl_Channel chan;         /* Channel handle or NULL */
    unsigned char *data;      /* Memory mapped or malloc'ed file */
    size_t length;            /* Length of memory mapped file */
    unsigned char *tofree;    /* Non-NULL if malloc'ed file */
    size_t nfiles;            /* Number of files in archive */
    size_t baseoffs;          /* Archive start */
    size_t baseoffsp;         /* Password start */
    size_t centoffs;          /* Archive directory start */
    unsigned char pwbuf[264]; /* Password buffer */
#if defined(_WIN32) || defined(_WIN64)
................................................................................
        if (i != zf->length) {
            ZIPFS_ERROR(interp,"file read error");
            goto error;
        }
        Tcl_Close(interp, zf->chan);
        zf->chan = NULL;
    } else {
#ifdef _WIN32)
#   ifdef _WIN64
        i = GetFileSizeEx((HANDLE) handle, (PLARGE_INTEGER)&zf->length);
        if (
            (i == 0) ||
#   else
        zf->length = GetFileSize((HANDLE) handle, 0);
        if (
            (zf->length == (size_t)INVALID_FILE_SIZE) ||
#   endif
            (zf->length < ZIP_CENTRAL_END_LEN)
        ) {
            ZIPFS_ERROR(interp,"invalid file size");
            goto error;
        }
        zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0,
                       zf->length, 0);