X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwildcard.c;h=408b0fe32e73b1cd3df618c9be8b950a174633d7;hb=bae32f91ef1953acd7271976022491e2e5c48aa2;hp=2619f47b59fe445f84d2e31012d2e6f90828464e;hpb=5ede6282b6f28fcd71d6eb556dae69e83d925e11;p=wimlib diff --git a/src/wildcard.c b/src/wildcard.c index 2619f47b..408b0fe3 100644 --- a/src/wildcard.c +++ b/src/wildcard.c @@ -188,29 +188,25 @@ wildcard_status(const tchar *wildcard) static int match_dentry(struct wim_dentry *cur_dentry, struct match_dentry_ctx *ctx) { - tchar *name; - size_t name_len; + const tchar *name; + size_t name_nchars; int ret; if (cur_dentry->file_name_nbytes == 0) return 0; -#if TCHAR_IS_UTF16LE - name = cur_dentry->file_name; - name_len = cur_dentry->file_name_nbytes; -#else - ret = utf16le_to_tstr(cur_dentry->file_name, - cur_dentry->file_name_nbytes, - &name, &name_len); + ret = utf16le_get_tstr(cur_dentry->file_name, + cur_dentry->file_name_nbytes, + &name, &name_nchars); if (ret) return ret; -#endif - name_len /= sizeof(tchar); + name_nchars /= sizeof(tchar); - if (match_wildcard(name, - &ctx->wildcard_path[ctx->cur_component_offset], - ctx->cur_component_len, - ctx->case_insensitive)) + if (do_match_wildcard(name, + name_nchars, + &ctx->wildcard_path[ctx->cur_component_offset], + ctx->cur_component_len, + ctx->case_insensitive)) { switch (wildcard_status(&ctx->wildcard_path[ ctx->cur_component_offset + @@ -235,9 +231,8 @@ match_dentry(struct wim_dentry *cur_dentry, struct match_dentry_ctx *ctx) ret = 0; } -#if !TCHAR_IS_UTF16LE - FREE(name); -#endif + utf16le_put_tstr(name); + return ret; } @@ -332,7 +327,7 @@ expand_wildcard(WIMStruct *wim, struct wim_dentry *root; int ret; - root = wim_root_dentry(wim); + root = wim_get_current_root_dentry(wim); if (root == NULL) goto no_match;