⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process.c

📁 压缩解压,是unzip540的升级,这个外国网站摘来的源码,是evb编写.
💻 C
📖 第 1 页 / 共 5 页
字号:
    TTrace((stderr,"\nef_scan_for_izux: scanning extra field of length %u\n",      ef_len));    while (ef_len >= EB_HEADSIZE) {        eb_id = makeword(EB_ID + ef_buf);        eb_len = makeword(EB_LEN + ef_buf);        if (eb_len > (ef_len - EB_HEADSIZE)) {            /* discovered some extra field inconsistency! */            TTrace((stderr,              "ef_scan_for_izux: block length %u > rest ef_size %u\n", eb_len,              ef_len - EB_HEADSIZE));            break;        }        switch (eb_id) {          case EF_TIME:            flags &= ~0x0ff;    /* ignore previous IZUNIX or EF_TIME fields */            have_new_type_eb = TRUE;            if ( eb_len >= EB_UT_MINLEN && z_utim != NULL) {                unsigned eb_idx = EB_UT_TIME1;                TTrace((stderr,"ef_scan_for_izux: found TIME extra field\n"));                flags |= (ef_buf[EB_HEADSIZE+EB_UT_FLAGS] & 0x0ff);                if ((flags & EB_UT_FL_MTIME)) {                    if ((eb_idx+4) <= eb_len) {                        i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);                        eb_idx += 4;                        TTrace((stderr,"  UT e.f. modification time = %ld\n",                                i_time));#ifdef TIME_T_TYPE_DOUBLE                        if ((ulg)(i_time) & (ulg)(0x80000000L)) {                            if (dos_mdatetime == DOSTIME_MINIMUM) {                              ut_in_archive_sgn = -1;                              z_utim->mtime =                                (time_t)((long)i_time | (~(long)0x7fffffffL));                            } else if (dos_mdatetime >= DOSTIME_2038_01_18) {                              ut_in_archive_sgn = 1;                              z_utim->mtime =                                (time_t)((ulg)i_time & (ulg)0xffffffffL);                            } else {                              ut_in_archive_sgn = 0;                              /* cannot determine sign of mtime;                                 without modtime: ignore complete UT field */                              flags &= ~0x0ff;  /* no time_t times available */                              TTrace((stderr,                                "  UT modtime range error; ignore e.f.!\n"));                              break;            /* stop scanning this field */                            }                        } else {                            /* cannot determine, safe assumption is FALSE */                            ut_in_archive_sgn = 0;                            z_utim->mtime = (time_t)i_time;                        }#else /* !TIME_T_TYPE_DOUBLE */                        if ((ulg)(i_time) & (ulg)(0x80000000L)) {                            ut_zip_unzip_compatible =                              ((time_t)0x80000000L < (time_t)0L)                              ? (dos_mdatetime == DOSTIME_MINIMUM)                              : (dos_mdatetime >= DOSTIME_2038_01_18);                            if (!ut_zip_unzip_compatible) {                              /* UnZip interprets mtime differently than Zip;                                 without modtime: ignore complete UT field */                              flags &= ~0x0ff;  /* no time_t times available */                              TTrace((stderr,                                "  UT modtime range error; ignore e.f.!\n"));                              break;            /* stop scanning this field */                            }                        } else {                            /* cannot determine, safe assumption is FALSE */                            ut_zip_unzip_compatible = FALSE;                        }                        z_utim->mtime = (time_t)i_time;#endif /* ?TIME_T_TYPE_DOUBLE */                    } else {                        flags &= ~EB_UT_FL_MTIME;                        TTrace((stderr,"  UT e.f. truncated; no modtime\n"));                    }                }                if (ef_is_c) {                    break;      /* central version of TIME field ends here */                }                if (flags & EB_UT_FL_ATIME) {                    if ((eb_idx+4) <= eb_len) {                        i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);                        eb_idx += 4;                        TTrace((stderr,"  UT e.f. access time = %ld\n",                                i_time));#ifdef TIME_T_TYPE_DOUBLE                        if ((ulg)(i_time) & (ulg)(0x80000000L)) {                            if (ut_in_archive_sgn == -1)                              z_utim->atime =                                (time_t)((long)i_time | (~(long)0x7fffffffL));                            } else if (ut_in_archive_sgn == 1) {                              z_utim->atime =                                (time_t)((ulg)i_time & (ulg)0xffffffffL);                            } else {                              /* sign of 32-bit time is unknown -> ignore it */                              flags &= ~EB_UT_FL_ATIME;                              TTrace((stderr,                                "  UT access time range error: skip time!\n"));                            }                        } else {                            z_utim->atime = (time_t)i_time;                        }#else /* !TIME_T_TYPE_DOUBLE */                        if (((ulg)(i_time) & (ulg)(0x80000000L)) &&                            !ut_zip_unzip_compatible) {                            flags &= ~EB_UT_FL_ATIME;                            TTrace((stderr,                              "  UT access time range error: skip time!\n"));                        } else {                            z_utim->atime = (time_t)i_time;                        }#endif /* ?TIME_T_TYPE_DOUBLE */                    } else {                        flags &= ~EB_UT_FL_ATIME;                    }                }                if (flags & EB_UT_FL_CTIME) {                    if ((eb_idx+4) <= eb_len) {                        i_time = (long)makelong((EB_HEADSIZE+eb_idx) + ef_buf);                        TTrace((stderr,"  UT e.f. creation time = %ld\n",                                i_time));#ifdef TIME_T_TYPE_DOUBLE                        if ((ulg)(i_time) & (ulg)(0x80000000L)) {                            if (ut_in_archive_sgn == -1)                              z_utim->ctime =                                (time_t)((long)i_time | (~(long)0x7fffffffL));                            } else if (ut_in_archive_sgn == 1) {                              z_utim->ctime =                                (time_t)((ulg)i_time & (ulg)0xffffffffL);                            } else {                              /* sign of 32-bit time is unknown -> ignore it */                              flags &= ~EB_UT_FL_CTIME;                              TTrace((stderr,                              "  UT creation time range error: skip time!\n"));                            }                        } else {                            z_utim->ctime = (time_t)i_time;                        }#else /* !TIME_T_TYPE_DOUBLE */                        if (((ulg)(i_time) & (ulg)(0x80000000L)) &&                            !ut_zip_unzip_compatible) {                            flags &= ~EB_UT_FL_CTIME;                            TTrace((stderr,                              "  UT creation time range error: skip time!\n"));                        } else {                            z_utim->ctime = (time_t)i_time;                        }#endif /* ?TIME_T_TYPE_DOUBLE */                    } else {                        flags &= ~EB_UT_FL_CTIME;                    }                }            }            break;          case EF_IZUNIX2:            if (!have_new_type_eb) {                flags &= ~0x0ff;        /* ignore any previous IZUNIX field */                have_new_type_eb = TRUE;            }            if (eb_len >= EB_UX2_MINLEN && z_uidgid != NULL) {                z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX2_UID) + ef_buf);                z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX2_GID) + ef_buf);                flags |= EB_UX2_VALID;   /* signal success */            }            break;          case EF_IZUNIX:          case EF_PKUNIX:       /* PKUNIX e.f. layout is identical to IZUNIX */            if (eb_len >= EB_UX_MINLEN) {                TTrace((stderr,"ef_scan_for_izux: found %s extra field\n",                        (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX")));                if (have_new_type_eb) {                    break;      /* Ignore IZUNIX extra field block ! */                }                if (z_utim != NULL) {                    flags |= (EB_UT_FL_MTIME | EB_UT_FL_ATIME);                    i_time = (long)makelong((EB_HEADSIZE+EB_UX_MTIME)+ef_buf);                    TTrace((stderr,"  Unix EF modtime = %ld\n", i_time));#ifdef TIME_T_TYPE_DOUBLE                    if ((ulg)(i_time) & (ulg)(0x80000000L)) {                        if (dos_mdatetime == DOSTIME_MINIMUM) {                            ut_in_archive_sgn = -1;                            z_utim->mtime =                              (time_t)((long)i_time | (~(long)0x7fffffffL));                        } else if (dos_mdatetime >= DOSTIME_2038_01_18) {                            ut_in_archive_sgn = 1;                            z_utim->mtime =                              (time_t)((ulg)i_time & (ulg)0xffffffffL);                        } else {                            ut_in_archive_sgn = 0;                            /* cannot determine sign of mtime;                               without modtime: ignore complete UT field */                            flags &= ~0x0ff;    /* no time_t times available */                            TTrace((stderr,                                  "  UX modtime range error: ignore e.f.!\n"));                        }                    } else {                        /* cannot determine, safe assumption is FALSE */                        ut_in_archive_sgn = 0;                        z_utim->mtime = (time_t)i_time;                    }#else /* !TIME_T_TYPE_DOUBLE */                    if ((ulg)(i_time) & (ulg)(0x80000000L)) {                        ut_zip_unzip_compatible =                          ((time_t)0x80000000L < (time_t)0L)                          ? (dos_mdatetime == DOSTIME_MINIMUM)                          : (dos_mdatetime >= DOSTIME_2038_01_18);                        if (!ut_zip_unzip_compatible) {                            /* UnZip interpretes mtime differently than Zip;                               without modtime: ignore complete UT field */                            flags &= ~0x0ff;    /* no time_t times available */                            TTrace((stderr,                                  "  UX modtime range error: ignore e.f.!\n"));                        }                    } else {                        /* cannot determine, safe assumption is FALSE */                        ut_zip_unzip_compatible = FALSE;                    }                    z_utim->mtime = (time_t)i_time;#endif /* ?TIME_T_TYPE_DOUBLE */                    i_time = (long)makelong((EB_HEADSIZE+EB_UX_ATIME)+ef_buf);                    TTrace((stderr,"  Unix EF actime = %ld\n", i_time));#ifdef TIME_T_TYPE_DOUBLE                    if ((ulg)(i_time) & (ulg)(0x80000000L)) {                        if (ut_in_archive_sgn == -1)                            z_utim->atime =                              (time_t)((long)i_time | (~(long)0x7fffffffL));                        } else if (ut_in_archive_sgn == 1) {                            z_utim->atime =                              (time_t)((ulg)i_time & (ulg)0xffffffffL);                        } else if (flags & 0x0ff) {                            /* sign of 32-bit time is unknown -> ignore it */                            flags &= ~EB_UT_FL_ATIME;                            TTrace((stderr,                                "  UX access time range error: skip time!\n"));                        }                    } else {                        z_utim->atime = (time_t)i_time;                    }#else /* !TIME_T_TYPE_DOUBLE */                    if (((ulg)(i_time) & (ulg)(0x80000000L)) &&                        !ut_zip_unzip_compatible && (flags & 0x0ff)) {                        /* atime not in range of UnZip's time_t */                        flags &= ~EB_UT_FL_ATIME;                        TTrace((stderr,                                "  UX access time range error: skip time!\n"));                    } else {                        z_utim->atime = (time_t)i_time;                    }#endif /* ?TIME_T_TYPE_DOUBLE */                }                if (eb_len >= EB_UX_FULLSIZE && z_uidgid != NULL) {                    z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX_UID) + ef_buf);                    z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX_GID) + ef_buf);                    flags |= EB_UX2_VALID;                }            }            break;          default:            break;        }        /* Skip this extra field block */        ef_buf += (eb_len + EB_HEADSIZE);        ef_len -= (eb_len + EB_HEADSIZE);    }    return flags;}#endif /* USE_EF_UT_TIME */#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))#define SPARKID_2 0x30435241    /* = "ARC0" *//*******************************//* Function getRISCOSexfield() *//*******************************/zvoid *getRISCOSexfield(ef_buf, ef_len)    ZCONST uch *ef_buf; /* buffer containing extra field */    unsigned ef_len;    /* total length of extra field */{    unsigned eb_id;    unsigned eb_len;/*---------------------------------------------------------------------------    This function scans the extra field for a Acorn SPARK filetype ef-block.    If a valid block is found, the function returns a pointer to the start    of the SPARK_EF block in the extra field buffer.  Otherwise, a NULL    pointer is returned.  ---------------------------------------------------------------------------*/    if (ef_len == 0 || ef_buf == NULL)        return NULL;    TTrace((stderr,"\ngetRISCOSexfield: scanning extra field of length %u\n",      ef_len));    while (ef_len >= EB_HEADSIZE) {        eb_id = makeword(EB_ID + ef_buf);        eb_len = makeword(EB_LEN + ef_buf);        if (eb_len > (ef_len - EB_HEADSIZE)) {            /* discovered some extra field inconsistency! */            TTrace((stderr,              "getRISCOSexfield: block length %u > rest ef_size %u\n", eb_len,              ef_len - EB_HEADSIZE));            break;        }        if (eb_id == EF_SPARK && (eb_len == 24 || eb_len == 20)) {            if (makelong(EB_HEADSIZE + ef_buf) == SPARKID_2) {                /* Return a pointer to the valid SPARK filetype ef block */                return (zvoid *)ef_buf;            }        }        /* Skip this extra field block */        ef_buf += (eb_len + EB_HEADSIZE);        ef_len -= (eb_len + EB_HEADSIZE);    }    return NULL;}#endif /* (RISCOS || ACORN_FTYPE_NFS) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -