int len;
{
int sum = 0;
+ unsigned char *pc = (unsigned char*)p;
- while (len--) sum += *(unsigned char*)p++;
+ while (len--) sum += *pc++;
return sum & 0xff;
}
to_code_save = CODE_CAP;
to_code = CODE_SJIS;
}
+#endif
+ /* special case: if `name' has small lettter, not convert case. */
+ if (from_code == CODE_SJIS && case_to == TO_LOWER) {
+ for (i = 0; i < len; i++) {
+#ifdef MULTIBYTE_FILENAME
+ if (SJIS_FIRST_P(name[i]) && SJIS_SECOND_P(name[i+1]))
+ i++;
+ else
+#endif
+ if (islower(name[i])) {
+ case_to = NONE;
+ break;
+ }
+ }
+ }
+
+#ifdef MULTIBYTE_FILENAME
if (from_code == CODE_SJIS && to_code == CODE_UTF8) {
for (i = 0; i < len; i++) {
if (SJIS_FIRST_P(name[i]) && SJIS_SECOND_P(name[i+1]))
}
#endif
- /* special case: if `name' has small lettter, not convert case. */
- if (from_code == CODE_SJIS && case_to == TO_LOWER) {
- for (i = 0; i < len; i++) {
-#ifdef MULTIBYTE_FILENAME
- if (SJIS_FIRST_P(name[i]) && SJIS_SECOND_P(name[i+1]))
- i++;
- else
-#endif
- if (islower(name[i])) {
- case_to = NONE;
- break;
- }
- }
- }
-
for (i = 0; i < len; i ++) {
#ifdef MULTIBYTE_FILENAME
if (from_code == CODE_EUC &&
/* set last modified time */
if (hdr->header_level >= 2)
skip_bytes(8); /* time_t has been already set */
- else {
+ else
hdr->unix_last_modified_stamp = wintime_to_unix_stamp();
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
- }
+
skip_bytes(8); /* last access time is ignored */
break;
#endif
/* UNIX last modified time */
hdr->unix_last_modified_stamp = (time_t) get_longword();
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
break;
default:
/* other headers */
hdr->packed_size = (unsigned long)get_longword();
hdr->original_size = (unsigned long)get_longword();
hdr->unix_last_modified_stamp = generic_to_unix_stamp(get_longword());
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
hdr->attribute = get_byte(); /* MS-DOS attribute */
hdr->header_level = get_byte();
name_length = get_byte();
if (extend_size >= 11) {
hdr->minor_version = get_byte();
hdr->unix_last_modified_stamp = (time_t) get_longword();
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
hdr->unix_mode = get_word();
hdr->unix_uid = get_word();
hdr->unix_gid = get_word();
hdr->packed_size = (unsigned long)get_longword(); /* skip size */
hdr->original_size = (unsigned long)get_longword();
hdr->unix_last_modified_stamp = generic_to_unix_stamp(get_longword());
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
hdr->attribute = get_byte(); /* 0x20 fixed */
hdr->header_level = get_byte();
hdr->packed_size = (unsigned long)get_longword();
hdr->original_size = (unsigned long)get_longword();
hdr->unix_last_modified_stamp = get_longword();
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
hdr->attribute = get_byte(); /* reserved */
hdr->header_level = get_byte();
hdr->packed_size = (unsigned long)get_longword();
hdr->original_size = (unsigned long)get_longword();
hdr->unix_last_modified_stamp = get_longword();
- if (file_time_stamp < hdr->unix_last_modified_stamp) {
- file_time_stamp = hdr->unix_last_modified_stamp;
- }
hdr->attribute = get_byte(); /* reserved */
hdr->header_level = get_byte();
n = fread(buffer, 1, sizeof(buffer), fp);
for (p = buffer; p < buffer + n; p++) {
- if (! (p[I_METHOD]=='-' && p[I_METHOD+1]=='l' && p[I_METHOD+4]=='-'))
+ if (! (p[I_METHOD]=='-' &&
+ (p[I_METHOD+1]=='l' || p[I_METHOD+1]=='p') &&
+ p[I_METHOD+4]=='-'))
continue;
- /* found "-l??-" keyword (as METHOD type string) */
+ /* found "-[lp]??-" keyword (as METHOD type string) */
/* level 0 or 1 header */
if ((p[I_HEADER_LEVEL] == 0 || p[I_HEADER_LEVEL] == 1)
hdr->crc = 0x0000;
hdr->extend_type = EXTEND_UNIX;
hdr->unix_last_modified_stamp = v_stat->st_mtime;
- if (file_time_stamp < v_stat->st_mtime) { file_time_stamp = v_stat->st_mtime; }
/* since 00:00:00 JAN.1.1970 */
#ifdef NOT_COMPATIBLE_MODE
/* Please need your modification in this space. */