Deleted Added
full compact
29c29
< FILE_RCSID("@(#)$File: readcdf.c,v 1.44 2014/05/14 23:22:48 christos Exp $")
---
> FILE_RCSID("@(#)$File: readcdf.c,v 1.49 2014/12/04 15:56:46 christos Exp $")
38,40d37
< #if defined(HAVE_LOCALE_H)
< #include <locale.h>
< #endif
78c75
< { 0x00000000000c1084LLU, 0x46000000000000c0LLU },
---
> { 0x00000000000c1084ULL, 0x46000000000000c0ULL },
86c83
< { 0x00000000000c1084LLU, 0x46000000000000c0LLU },
---
> { 0x00000000000c1084ULL, 0x46000000000000c0ULL },
110c107,108
< char *old_lc_ctype;
---
> #ifdef USE_C_LOCALE
> locale_t old_lc_ctype, c_lc_ctype;
112c110,112
< old_lc_ctype = setlocale(LC_CTYPE, NULL);
---
> c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
> assert(c_lc_ctype != NULL);
> old_lc_ctype = uselocale(c_lc_ctype);
114,116c114
< old_lc_ctype = strdup(old_lc_ctype);
< assert(old_lc_ctype != NULL);
< (void)setlocale(LC_CTYPE, "C");
---
> #endif
122,123c120,123
< (void)setlocale(LC_CTYPE, old_lc_ctype);
< free(old_lc_ctype);
---
> #ifdef USE_C_LOCALE
> (void)uselocale(old_lc_ctype);
> freelocale(c_lc_ctype);
> #endif
243a244,274
> cdf_file_catalog(struct magic_set *ms, const cdf_header_t *h,
> const cdf_stream_t *sst)
> {
> cdf_catalog_t *cat;
> size_t i;
> char buf[256];
> cdf_catalog_entry_t *ce;
>
> if (NOTMIME(ms)) {
> if (file_printf(ms, "Microsoft Thumbs.db [") == -1)
> return -1;
> if (cdf_unpack_catalog(h, sst, &cat) == -1)
> return -1;
> ce = cat->cat_e;
> /* skip first entry since it has a , or paren */
> for (i = 1; i < cat->cat_num; i++)
> if (file_printf(ms, "%s%s",
> cdf_u16tos8(buf, ce[i].ce_namlen, ce[i].ce_name),
> i == cat->cat_num - 1 ? "]" : ", ") == -1) {
> free(cat);
> return -1;
> }
> free(cat);
> } else {
> if (file_printf(ms, "application/CDFV2") == -1)
> return -1;
> }
> return 1;
> }
>
> private int
288c319
< if (str)
---
> if (str) {
292a324
> }
305,309c337,341
< (uuid[0] >> 32) & (uint64_t)0x000000000ffffffffLLU,
< (uuid[0] >> 16) & (uint64_t)0x0000000000000ffffLLU,
< (uuid[0] >> 0) & (uint64_t)0x0000000000000ffffLLU,
< (uuid[1] >> 48) & (uint64_t)0x0000000000000ffffLLU,
< (uuid[1] >> 0) & (uint64_t)0x0000fffffffffffffLLU);
---
> (uuid[0] >> 32) & (uint64_t)0x000000000ffffffffULL,
> (uuid[0] >> 16) & (uint64_t)0x0000000000000ffffULL,
> (uuid[0] >> 0) & (uint64_t)0x0000000000000ffffULL,
> (uuid[1] >> 48) & (uint64_t)0x0000000000000ffffULL,
> (uuid[1] >> 0) & (uint64_t)0x0000fffffffffffffULL);
325a358
> const cdf_directory_t *root_storage;
359d391
< const cdf_directory_t *root_storage;
407,408c439,456
< corrupt = expn;
< expn = "No summary info";
---
> if ((i = cdf_read_catalog(&info, &h, &sat, &ssat, &sst,
> &dir, &scn)) == -1) {
> corrupt = expn;
> if ((i = cdf_read_encrypted_package(&info, &h,
> &sat, &ssat, &sst, &dir, &scn)) == -1)
> expn = "No summary info";
> else {
> expn = "Encrypted";
> i = -1;
> }
> goto out4;
> }
> #ifdef CDF_DEBUG
> cdf_dump_catalog(&h, &scn);
> #endif
> if ((i = cdf_file_catalog(ms, &h, &scn))
> < 0)
> expn = "Can't expand catalog";
467c515,516
< if (file_printf(ms, "application/CDFV2-corrupt") == -1)
---
> if (file_printf(ms, "application/CDFV2-%s",
> *corrupt ? "corrupt" : "encrypted") == -1)