diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-09-16 07:45:09 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-09-16 07:45:09 +0900 |
commit | 1e860c1f8b2b0b48617f2ca664aa9acf2fafc8d3 (patch) | |
tree | a945f12e0ecb03e7c1db7db427f469b46f5c71f9 /common/iobuf.c | |
parent | 0fca6c1d0d6088ff4558a6ffc3bc220998699392 (diff) | |
download | gpg2-1e860c1f8b2b0b48617f2ca664aa9acf2fafc8d3.tar.gz gpg2-1e860c1f8b2b0b48617f2ca664aa9acf2fafc8d3.tar.bz2 gpg2-1e860c1f8b2b0b48617f2ca664aa9acf2fafc8d3.zip |
Imported Upstream version 2.2.37upstream/2.2.37
Diffstat (limited to 'common/iobuf.c')
-rw-r--r-- | common/iobuf.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index 4fd8cf5..07edbbe 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -194,18 +194,6 @@ fd_cache_strcmp (const char *a, const char *b) } -#ifdef HAVE_W32_SYSTEM -static int -any8bitchar (const char *string) -{ - if (string) - for ( ; *string; string++) - if ((*string & 0x80)) - return 1; - return 0; -} -#endif /*HAVE_W32_SYSTEM*/ - /* * Invalidate (i.e. close) a cached iobuf */ @@ -307,11 +295,11 @@ direct_open (const char *fname, const char *mode, int mode700) sm = FILE_SHARE_READ; } - /* We use the Unicode version of the function only if needed to - * avoid an extra conversion step. */ - if (any8bitchar (fname)) + /* We always use the Unicode version because it supports file names + * longer than MAX_PATH. (requires gpgrt 1.45) */ + if (1) { - wchar_t *wfname = utf8_to_wchar (fname); + wchar_t *wfname = gpgrt_fname_to_wchar (fname); if (wfname) { hfile = CreateFileW (wfname, da, sm, NULL, cd, @@ -321,8 +309,6 @@ direct_open (const char *fname, const char *mode, int mode700) else hfile = INVALID_HANDLE_VALUE; } - else - hfile = CreateFileA (fname, da, sm, NULL, cd, FILE_ATTRIBUTE_NORMAL, NULL); return hfile; @@ -1211,14 +1197,7 @@ iobuf_cancel (iobuf_t a) { /* Argg, MSDOS does not allow removing open files. So * we have to do it here */ -#ifdef HAVE_W32CE_SYSTEM - wchar_t *wtmp = utf8_to_wchar (remove_name); - if (wtmp) - DeleteFile (wtmp); - xfree (wtmp); -#else - remove (remove_name); -#endif + gnupg_remove (remove_name); xfree (remove_name); } #endif |