12 bool slash =
false, backslash =
false;
19 }
else if (*
p ==
'\\') {
23 if (slash && backslash) {
31 }
else if (!backslash) {
42 }
else if (
c ==
'/') {
50 const char *oldname =
NULL;
65 if (
len == oldlen && !strncmp(
name, oldname,
len)) {
78 return *
str ==
'/' || *
str ==
'\\';
86 char separator =
'\\';
93 size_t output_dir_len = strlen(output_dir) + 1;
94 size_t filename_len = strlen(
file->filename);
96 char *sanitized =
RZ_NEWS0(
char, output_dir_len + (filename_len * 4) + 2);
103 const ut8 *endp = (
const ut8 *)&
file->filename[filename_len];
106 memcpy(sanitized, output_dir, output_dir_len);
107 sanitized[output_dir_len - 1] =
'/';
112 for (;
input < endp;) {
118 }
else if (rune <= 0 || rune > 0x10FFFF || (rune >= 0xD800 && rune <= 0xDFFF) || rune == 0xFFFE || rune == 0xFFFF) {
124 if (rune == separator) {
126 }
else if (rune == os_slash) {
137 while (
input < endp) {
139 if (
c == separator) {
141 }
else if (
c == os_slash) {
149 output = (
ut8 *)&sanitized[output_dir_len];
160 strcpy((
char *)
output,
"_");
176 switch (
cd->last_error(
cd)) {
178 return "MSPACK_ERR_OPEN";
180 return "MSPACK_ERR_READ";
182 return "MSPACK_ERR_WRITE";
184 return "MSPACK_ERR_SEEK";
186 return "MSPACK_ERR_NOMEMORY";
188 return "MSPACK_ERR_SIGNATURE";
190 return "MSPACK_ERR_DATAFORMAT";
192 return "MSPACK_ERR_CHECKSUM";
194 return "MSPACK_ERR_DECRUNCH";
213 RZ_LOG_ERROR(
"%s is not a file or does not exist.\n", file_cab);
218 RZ_LOG_ERROR(
"%s is not a directory or does not exist.\n", output_dir);
231 RZ_LOG_ERROR(
"Invalid compressed cab file: %s\n", file_cab);
250 RZ_LOG_INFO(
"cab_extract: extracted %s\n", new_name);
static static fork const void static count static fd const char const char static newpath const char static path const char path
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type special files
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define rz_warn_if_reached()
#define rz_return_val_if_fail(expr, val)
RZ_API bool rz_file_is_directory(const char *str)
RZ_API bool rz_file_exists(const char *str)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API int rz_utf8_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API int rz_utf8_encode(ut8 *ptr, const RzRune ch)
z_const unsigned char * next
struct mscabd_cabinet *(* open)(struct mscab_decompressor *self, const char *filename)
int(* extract)(struct mscab_decompressor *self, struct mscabd_file *file, const char *filename)
void(* close)(struct mscab_decompressor *self, struct mscabd_cabinet *cab)
struct mscabd_file * files
struct mscabd_file * next
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)