From: Vincent Torri Date: Mon, 29 Jan 2018 13:49:54 +0000 (+0100) Subject: Evil: remove "symlink" code (it was for .lnk files anyway...) X-Git-Tag: upstream/1.21.0~2107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1659828e3739c5c68962012fb034e4d7f330ca8d;p=platform%2Fupstream%2Fefl.git Evil: remove "symlink" code (it was for .lnk files anyway...) --- diff --git a/src/Makefile_Evil.am b/src/Makefile_Evil.am index 93e5b1d..300254f 100644 --- a/src/Makefile_Evil.am +++ b/src/Makefile_Evil.am @@ -35,7 +35,6 @@ lib/evil/evil_fnmatch.c \ lib/evil/evil_fnmatch_list_of_states.c \ lib/evil/evil_langinfo.c \ lib/evil/evil_locale.c \ -lib/evil/evil_link_xp.cpp \ lib/evil/evil_main.c \ lib/evil/evil_mman.c \ lib/evil/evil_pwd.c \ @@ -50,7 +49,6 @@ lib/evil/evil_fnmatch_private.h lib_evil_libevil_la_CPPFLAGS = @EVIL_CPPFLAGS@ lib_evil_libevil_la_CFLAGS = @EVIL_CFLAGS@ @EVIL_CFLAGS_WRN@ -D__USE_MINGW_ANSI_STDIO -lib_evil_libevil_la_CXXFLAGS = @EVIL_CXXFLAGS@ @EVIL_CFLAGS@ lib_evil_libevil_la_LIBADD = @EVIL_LIBS@ lib_evil_libevil_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ diff --git a/src/lib/evil/evil_link_xp.cpp b/src/lib/evil/evil_link_xp.cpp deleted file mode 100644 index 2b5b956..0000000 --- a/src/lib/evil/evil_link_xp.cpp +++ /dev/null @@ -1,149 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include - -#include -#include -#include - -#include "Evil.h" - - -/* - * Symbolic links and directory related functions - * - */ - - -/* REMARK: Windows has no symbolic link. */ -/* Nevertheless, it can create and read .lnk files */ -int -symlink(const char *oldpath, const char *newpath) -{ - char fullname[PATH_MAX]; - wchar_t *wnewpath; - IShellLink *pISL; - IPersistFile *pIPF; - HRESULT res; - size_t size; - - realpath(oldpath, fullname); - - res = CoInitialize(NULL); - if (FAILED(res)) - { - if (res == E_OUTOFMEMORY) - errno = ENOMEM; - return -1; - } - - if (FAILED(CoCreateInstance(CLSID_ShellLink, - NULL, - CLSCTX_INPROC_SERVER, - IID_IShellLink, - (void **)&pISL))) - goto no_instance; - - if (FAILED(pISL->SetPath(fullname))) - goto no_setpath; - - if (FAILED(pISL->QueryInterface(IID_IPersistFile, (void **)&pIPF))) - goto no_queryinterface; - - size = mbstowcs(NULL, newpath, 0); - wnewpath = (wchar_t *)malloc((size + 1) * sizeof(wchar_t)); - if (!wnewpath) - goto malloc_failure; - if (mbstowcs(wnewpath, newpath, size + 1) == (size_t)(-1)) - goto translation_failure; - if (FAILED(pIPF->Save(wnewpath, FALSE))) - goto no_save; - - free(wnewpath); - pIPF->Release(); - pISL->Release(); - CoUninitialize(); - - return 0; - - no_save: - translation_failure: - malloc_failure: - pIPF->Release(); - no_queryinterface: - no_setpath: - pISL->Release(); - no_instance: - CoUninitialize(); - return -1; -} - -ssize_t -readlink(const char *path, char *buf, size_t bufsiz) -{ - wchar_t *wpath; - char new_path[PATH_MAX]; - IShellLink *pISL; - IPersistFile *pIPF; - size_t length; - HRESULT res; - size_t size; - - res = CoInitialize(NULL); - if (FAILED(res)) - { - if (res == E_OUTOFMEMORY) - errno = ENOMEM; - return -1; - } - - if (FAILED(CoCreateInstance(CLSID_ShellLink, - NULL, - CLSCTX_INPROC_SERVER, - IID_IShellLink, - (void **)&pISL))) - goto couninitialize; - - if (FAILED(pISL->QueryInterface(IID_IPersistFile, (void **)&pIPF))) - goto release_shell_link; - - size = mbstowcs(NULL, path, 0); - wpath = (wchar_t *)malloc((size + 1) * sizeof(wchar_t)); - if (!wpath) - goto release_persist_file; - - mbstowcs(wpath, path, size + 1); - if (FAILED(pIPF->Load(wpath, STGM_READ))) - goto free_wpath; - - if (FAILED(pISL->Resolve(NULL, SLR_UPDATE | SLR_NO_UI))) - goto free_wpath; - - if (FAILED(pISL->GetPath(new_path, PATH_MAX, NULL, 0))) - goto free_wpath; - - length = strlen(new_path); - if (length > bufsiz) - length = bufsiz; - - memcpy(buf, new_path, length); - - free(wpath); - pISL->Release(); - pIPF->Release(); - CoUninitialize(); - - return length; - - free_wpath: - free(wpath); - release_persist_file: - pIPF->Release(); - release_shell_link: - pISL->Release(); - couninitialize: - CoUninitialize(); - return -1; -} diff --git a/src/lib/evil/evil_unistd.h b/src/lib/evil/evil_unistd.h index dbc6cfe..5319c47 100644 --- a/src/lib/evil/evil_unistd.h +++ b/src/lib/evil/evil_unistd.h @@ -38,62 +38,6 @@ EAPI double evil_time_get(void); /* - * Symbolic links and directory related functions - * - */ - -/** - * @brief Create a shell link. - * - * @param oldpath The file name to be linked. - * @param newpath The file name to create. - * @return 0 on success, -1 otherwise. - * - * Create a shell link @p newpath to @p oldpath (@p newpath is the - * name of the file created, @p oldpath is the string used in - * creating the shell link). - * - * On success, this function returns 0. Otherwise, it returns -1 and - * errno may be set to the following value: - * - ENOMEM: Not enough memory. - * - * On Windows, the symbolic links do not exist. Nevertheless - * shell links can be created. This function is named like the Unix - * function for portability reasons. - * - * Conformity: None. - * - * Supported OS: Windows XP. - */ -EAPI int symlink(const char *oldpath, const char *newpath); - -/** - * @brief Read value of a shell link. - * - * @param path The file name to be linked. - * @param buf The file name to create. - * @param bufsiz The size of the buffer. - * @return 0 on success, -1 otherwise. - * - * Place the content of the shell link @p path in the buffer - * @p buf, which has size @p bufzsiz. - * - * On success, this function returns 0. Otherwise, it returns -1 and - * errno may be set to the following value: - * - ENOMEM: Not enough memory. - * - * On Windows, the symbolic links do not exist. Nevertheless - * shell links can be managed. This function is named like the Unix - * function for portability reasons. - * - * Conformity: None. - * - * Supported OS: Windows XP. - */ -EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz); - - -/* * file related functions * */