mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Renamed filename encoding functions.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
parent
87aee96b98
commit
c7e60b5231
8 changed files with 83 additions and 104 deletions
|
@ -882,7 +882,7 @@ static csync_vio_method_handle_t *owncloud_open(const char *durl,
|
|||
#ifdef _WIN32
|
||||
memset( tmpname, '\0', 13 );
|
||||
gtp = GetTempPathW( PATH_MAX, winTmp );
|
||||
winTmpUtf8 = c_utf8( winTmp );
|
||||
winTmpUtf8 = c_utf8_from_locale( winTmp );
|
||||
strcpy( getUrl, winTmpUtf8 );
|
||||
DEBUG_WEBDAV(("win32 tmp path: %s", getUrl));
|
||||
|
||||
|
@ -899,7 +899,7 @@ static csync_vio_method_handle_t *owncloud_open(const char *durl,
|
|||
writeCtx->tmpFileName = c_strdup( getUrl );
|
||||
|
||||
/* Open the file finally. */
|
||||
winUrlMB = c_multibyte( getUrl );
|
||||
winUrlMB = c_utf8_to_locale( getUrl );
|
||||
|
||||
/* check if the file exists by chance. */
|
||||
if( _tstat( winUrlMB, &sb ) == 0 ) {
|
||||
|
@ -910,8 +910,8 @@ static csync_vio_method_handle_t *owncloud_open(const char *durl,
|
|||
writeCtx->fd = _topen( winUrlMB, O_RDWR | O_CREAT | O_EXCL, 0600 );
|
||||
|
||||
/* free the extra bytes */
|
||||
c_free_multibyte( winUrlMB );
|
||||
c_free_utf8( winTmpUtf8 );
|
||||
c_free_locale_string( winUrlMB );
|
||||
c_free_locale_string( winTmpUtf8 );
|
||||
} else {
|
||||
writeCtx->fd = -1;
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ static int owncloud_close(csync_vio_method_handle_t *fhandle) {
|
|||
if( writeCtx->fileWritten ) {
|
||||
DEBUG_WEBDAV(("Putting file through file cache.\n"));
|
||||
/* we need to go the slow way and close and open the file and read from fd. */
|
||||
tmpFileName = c_multibyte( writeCtx->tmpFileName );
|
||||
tmpFileName = c_utf8_to_locale( writeCtx->tmpFileName );
|
||||
|
||||
if (( writeCtx->fd = _topen( tmpFileName, O_RDONLY )) < 0) {
|
||||
errno = EIO;
|
||||
|
@ -1096,7 +1096,7 @@ static int owncloud_close(csync_vio_method_handle_t *fhandle) {
|
|||
ret = -1;
|
||||
}
|
||||
}
|
||||
c_free_multibyte(tmpFileName);
|
||||
c_free_locale_string(tmpFileName);
|
||||
} else {
|
||||
/* all content is in the buffer. */
|
||||
DEBUG_WEBDAV(("Putting file through memory cache.\n"));
|
||||
|
@ -1154,14 +1154,14 @@ static ssize_t owncloud_read(csync_vio_method_handle_t *fhandle, void *buf, size
|
|||
#ifdef _WIN32
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
tmpFileName = c_multibyte(writeCtx->tmpFileName);
|
||||
tmpFileName = c_utf8_to_locale(writeCtx->tmpFileName);
|
||||
if (( writeCtx->fd = _topen( tmpFileName, O_RDONLY )) < 0) {
|
||||
c_free_multibyte(tmpFileName);
|
||||
c_free_locale_string(tmpFileName);
|
||||
DEBUG_WEBDAV(("Could not open local file %s", writeCtx->tmpFileName ));
|
||||
errno = EIO;
|
||||
return -1;
|
||||
} else {
|
||||
c_free_multibyte(tmpFileName);
|
||||
c_free_locale_string(tmpFileName);
|
||||
if (fstat( writeCtx->fd, &st ) < 0) {
|
||||
DEBUG_WEBDAV(("Could not stat file %s\n", writeCtx->tmpFileName ));
|
||||
errno = EIO;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
int c_mkdirs(const char *path, mode_t mode) {
|
||||
int tmp;
|
||||
csync_stat_t sb;
|
||||
mbchar_t *wpath = c_multibyte(path);
|
||||
mbchar_t *wpath = c_utf8_to_locale(path);
|
||||
mbchar_t *swpath = NULL;
|
||||
|
||||
if (path == NULL) {
|
||||
|
@ -59,17 +59,17 @@ int c_mkdirs(const char *path, mode_t mode) {
|
|||
char subpath[tmp + 1];
|
||||
memcpy(subpath, path, tmp);
|
||||
subpath[tmp] = '\0';
|
||||
swpath = c_multibyte(subpath);
|
||||
swpath = c_utf8_to_locale(subpath);
|
||||
if (_tstat(swpath, &sb) == 0) {
|
||||
if (! S_ISDIR(sb.st_mode)) {
|
||||
errno = ENOTDIR;
|
||||
return -1;
|
||||
}
|
||||
} else if (errno != ENOENT) {
|
||||
c_free_multibyte(swpath);
|
||||
c_free_locale_string(swpath);
|
||||
return -1;
|
||||
} else if (c_mkdirs(subpath, mode) < 0) {
|
||||
c_free_multibyte(swpath);
|
||||
c_free_locale_string(swpath);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ int c_mkdirs(const char *path, mode_t mode) {
|
|||
#else
|
||||
tmp = _tmkdir(wpath, mode);
|
||||
#endif
|
||||
c_free_multibyte(swpath);
|
||||
c_free_multibyte(wpath);
|
||||
c_free_locale_string(swpath);
|
||||
c_free_locale_string(wpath);
|
||||
|
||||
if ((tmp < 0) && (errno == EEXIST)) {
|
||||
return 0;
|
||||
|
@ -93,7 +93,7 @@ int c_rmdirs(const char *path) {
|
|||
csync_stat_t sb;
|
||||
char *fname = NULL;
|
||||
mbchar_t *wfname = NULL;
|
||||
mbchar_t *wpath = c_multibyte(path);
|
||||
mbchar_t *wpath = c_utf8_to_locale(path);
|
||||
char *rd_name = NULL;
|
||||
|
||||
if ((d = _topendir(wpath)) != NULL) {
|
||||
|
@ -114,10 +114,10 @@ int c_rmdirs(const char *path) {
|
|||
|
||||
while ((dp = _treaddir(d)) != NULL) {
|
||||
size_t len;
|
||||
rd_name = c_utf8(dp->d_name);
|
||||
rd_name = c_utf8_from_locale(dp->d_name);
|
||||
/* skip '.' and '..' */
|
||||
if( c_streq( rd_name, "." ) || c_streq( rd_name, ".." ) ) {
|
||||
c_free_utf8(rd_name);
|
||||
c_free_locale_string(rd_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ int c_rmdirs(const char *path) {
|
|||
return -1;
|
||||
}
|
||||
snprintf(fname, len, "%s/%s", path, rd_name);
|
||||
wfname = c_multibyte(fname);
|
||||
wfname = c_utf8_to_locale(fname);
|
||||
|
||||
/* stat the file */
|
||||
if (_tstat(wfname, &sb) != -1) {
|
||||
|
@ -141,7 +141,7 @@ int c_rmdirs(const char *path) {
|
|||
if (errno == EACCES) {
|
||||
_tclosedir(d);
|
||||
SAFE_FREE(fname);
|
||||
c_free_multibyte(wfname);
|
||||
c_free_locale_string(wfname);
|
||||
return -1;
|
||||
}
|
||||
c_rmdirs(fname);
|
||||
|
@ -151,8 +151,8 @@ int c_rmdirs(const char *path) {
|
|||
}
|
||||
} /* lstat */
|
||||
SAFE_FREE(fname);
|
||||
c_free_multibyte(wfname);
|
||||
c_free_utf8(rd_name);
|
||||
c_free_locale_string(wfname);
|
||||
c_free_locale_string(rd_name);
|
||||
} /* readdir */
|
||||
|
||||
_trewinddir(d);
|
||||
|
@ -167,13 +167,13 @@ int c_rmdirs(const char *path) {
|
|||
|
||||
int c_isdir(const char *path) {
|
||||
csync_stat_t sb;
|
||||
mbchar_t *wpath = c_multibyte(path);
|
||||
mbchar_t *wpath = c_utf8_to_locale(path);
|
||||
|
||||
if (_tstat (wpath, &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
||||
c_free_multibyte(wpath);
|
||||
c_free_locale_string(wpath);
|
||||
return 1;
|
||||
}
|
||||
c_free_multibyte(wpath);
|
||||
c_free_locale_string(wpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
/* check if path is a file */
|
||||
int c_isfile(const char *path) {
|
||||
csync_stat_t sb;
|
||||
mbchar_t *wpath = c_multibyte(path);
|
||||
mbchar_t *wpath = c_utf8_to_locale(path);
|
||||
|
||||
int re = _tstat(wpath, &sb);
|
||||
c_free_multibyte(wpath);
|
||||
c_free_locale_string(wpath);
|
||||
|
||||
if (re< 0) {
|
||||
return 0;
|
||||
|
@ -70,8 +70,8 @@ int c_copy(const char* src, const char *dst, mode_t mode) {
|
|||
|
||||
#ifdef _WIN32
|
||||
if(src && dst) {
|
||||
mbchar_t *wsrc = c_multibyte(src);
|
||||
mbchar_t *wdst = c_multibyte(dst);
|
||||
mbchar_t *wsrc = c_utf8_to_locale(src);
|
||||
mbchar_t *wdst = c_utf8_to_locale(dst);
|
||||
if (CopyFileW(wsrc, wdst, FALSE)) {
|
||||
rc = 0;
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ out:
|
|||
}
|
||||
|
||||
int c_rename( const char *src, const char *dst ) {
|
||||
mbchar_t *nuri = c_multibyte(dst);
|
||||
mbchar_t *ouri = c_multibyte(src);
|
||||
mbchar_t *nuri = c_utf8_to_locale(dst);
|
||||
mbchar_t *ouri = c_utf8_to_locale(src);
|
||||
|
||||
#ifdef _WIN32
|
||||
if(ouri && nuri) {
|
||||
|
@ -176,7 +176,7 @@ int c_rename( const char *src, const char *dst ) {
|
|||
#else
|
||||
return rename(ouri, nuri);
|
||||
#endif
|
||||
c_free_multibyte(nuri);
|
||||
c_free_multibyte(ouri);
|
||||
c_free_locale_string(nuri);
|
||||
c_free_locale_string(ouri);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ char *c_lowercase(const char* str) {
|
|||
}
|
||||
|
||||
/* Convert a wide multibyte String to UTF8 */
|
||||
char* c_utf8(const mbchar_t *wstr)
|
||||
char* c_utf8_from_locale(const mbchar_t *wstr)
|
||||
{
|
||||
char *dst = NULL;
|
||||
|
||||
|
@ -304,7 +304,7 @@ char* c_utf8(const mbchar_t *wstr)
|
|||
}
|
||||
|
||||
/* Convert a an UTF8 string to multibyte */
|
||||
mbchar_t* c_multibyte(const char *str)
|
||||
mbchar_t* c_utf8_to_locale(const char *str)
|
||||
{
|
||||
mbchar_t *dst = NULL;
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -143,7 +143,7 @@ char *c_uppercase(const char* str);
|
|||
char *c_lowercase(const char* str);
|
||||
|
||||
/**
|
||||
* @brief Convert a multibyte string to utf8 (Win32).
|
||||
* @brief Convert a platform locale string to utf8.
|
||||
*
|
||||
* This function is part of the multi platform abstraction of basic file
|
||||
* operations to handle various platform encoding correctly.
|
||||
|
@ -153,22 +153,21 @@ char *c_lowercase(const char* str);
|
|||
*
|
||||
* To convert path names returned by these functions to the internally used
|
||||
* utf8 format this function has to be used. The returned string has to
|
||||
* be freed by c_free_utf(). On some platforms this method allocates memory
|
||||
* and on others not but it has never to be cared about as long as
|
||||
* c_free_utf8() is used.
|
||||
* be freed by c_free_locale_string(). On some platforms this method allocates
|
||||
* memory and on others not but it has never to be cared about.
|
||||
*
|
||||
* @param str The multibyte encoded string to convert
|
||||
*
|
||||
* @return The malloced converted string or NULL on error.
|
||||
*
|
||||
* @see c_free_utf8()
|
||||
* @see c_multibyte()
|
||||
* @see c_free_locale_string()
|
||||
* @see c_utf8_to_locale()
|
||||
*
|
||||
*/
|
||||
char* c_utf8(const mbchar_t *str);
|
||||
char* c_utf8_from_locale(const mbchar_t *str);
|
||||
|
||||
/**
|
||||
* @brief Convert a utf8 encoded string to multibyte (Win32).
|
||||
* @brief Convert a utf8 encoded string to platform specific locale.
|
||||
*
|
||||
* This function is part of the multi platform abstraction of basic file
|
||||
* operations to handle various platform encoding correctly.
|
||||
|
@ -178,23 +177,24 @@ char *c_lowercase(const char* str);
|
|||
*
|
||||
* To convert path names as input for the cross platform functions from the
|
||||
* internally used utf8 format, this function has to be used.
|
||||
* The returned string has to be freed by c_free_multibyte(). On some
|
||||
* The returned string has to be freed by c_free_locale_string(). On some
|
||||
* platforms this method allocates memory and on others not but it has never
|
||||
* sto be cared about as long as c_free_multibyte() is used.
|
||||
* sto be cared about.
|
||||
*
|
||||
* @param str The utf8 string to convert.
|
||||
*
|
||||
* @return The malloced converted multibyte string or NULL on error.
|
||||
*
|
||||
* @see c_free_multibyte()
|
||||
* @see c_utf8()
|
||||
* @see c_free_locale_string()
|
||||
* @see c_utf8_from_locale()
|
||||
*
|
||||
*/
|
||||
mbchar_t* c_multibyte(const char *wstr);
|
||||
mbchar_t* c_utf8_to_locale(const char *wstr);
|
||||
|
||||
#if defined(_WIN32) || defined(WITH_ICONV)
|
||||
|
||||
/**
|
||||
* @brief Free buffer malloced by c_utf8().
|
||||
* @brief Free buffer malloced by c_utf8_from_locale or c_utf8_to_locale().
|
||||
*
|
||||
* This function is part of the multi platform abstraction of basic file
|
||||
* operations to handle various platform encoding correctly.
|
||||
|
@ -203,37 +203,16 @@ mbchar_t* c_multibyte(const char *wstr);
|
|||
* defined in c_private.h have to be used instead.
|
||||
*
|
||||
* This function frees the memory that was allocated by a previous call to
|
||||
* c_utf8().
|
||||
* c_utf8_to_locale() or c_utf8_from_locale().
|
||||
*
|
||||
* @param buf The buffer to free.
|
||||
*
|
||||
* @see c_utf8()
|
||||
* @see c_utf8_from_locale(), c_utf8_to_locale()
|
||||
*
|
||||
*/
|
||||
|
||||
#define c_free_multibyte(x) SAFE_FREE(x)
|
||||
|
||||
/**
|
||||
* @brief Free buffer malloced by c_multibyte().
|
||||
*
|
||||
* This function is part of the multi platform abstraction of basic file
|
||||
* operations to handle various platform encoding correctly.
|
||||
*
|
||||
* Instead of using the standard file operations the multi platform aliases
|
||||
* defined in c_private.h have to be used instead.
|
||||
*
|
||||
* This function frees the memory that was allocated by a previous call to
|
||||
* c_multibyte().
|
||||
*
|
||||
* @param buf The buffer to free.
|
||||
*
|
||||
* @see c_multibyte()
|
||||
*
|
||||
*/
|
||||
#define c_free_utf8(x) SAFE_FREE(x)
|
||||
#define c_free_locale_string(x) SAFE_FREE(x)
|
||||
#else
|
||||
#define c_free_multibyte(x) (void)x
|
||||
#define c_free_utf8(x) (void)x
|
||||
#define c_free_locale_string(x) (void)x
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,9 +70,9 @@ double c_secdiff(struct timespec clock1, struct timespec clock0) {
|
|||
|
||||
#ifdef HAVE_UTIMES
|
||||
int c_utimes(const char *uri, const struct timeval *times) {
|
||||
mbchar_t *wuri = c_multibyte(uri);
|
||||
mbchar_t *wuri = c_utf8_to_locale(uri);
|
||||
int ret = utimes(wuri, times);
|
||||
c_free_multibyte(wuri);
|
||||
c_free_locale_string(wuri);
|
||||
return ret;
|
||||
}
|
||||
#else // HAVE_UTIMES
|
||||
|
@ -97,7 +97,7 @@ int c_utimes(const char *uri, const struct timeval *times) {
|
|||
FILETIME LastAccessTime;
|
||||
FILETIME LastModificationTime;
|
||||
HANDLE hFile;
|
||||
mbchar_t *wuri = c_multibyte( uri );
|
||||
mbchar_t *wuri = c_utf8_to_locale( uri );
|
||||
|
||||
if(times) {
|
||||
UnixTimevalToFileTime(times[0], &LastAccessTime);
|
||||
|
|
|
@ -62,24 +62,24 @@ int csync_vio_init(CSYNC *ctx, const char *module, const char *args) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mpath = c_multibyte(path);
|
||||
mpath = c_utf8_to_locale(path);
|
||||
if (_tstat(mpath, &sb) < 0) {
|
||||
SAFE_FREE(path);
|
||||
if (asprintf(&path, "%s/modules/csync_%s.%s", BINARYDIR, module, MODULE_EXTENSION) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
c_free_multibyte(mpath);
|
||||
c_free_locale_string(mpath);
|
||||
|
||||
#ifdef _WIN32
|
||||
mpath = c_multibyte(path);
|
||||
mpath = c_utf8_to_locale(path);
|
||||
if (_tstat(mpath, &sb) < 0) {
|
||||
SAFE_FREE(path);
|
||||
if (asprintf(&path, "modules/csync_%s.%s", module, MODULE_EXTENSION) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
c_free_multibyte(mpath);
|
||||
c_free_locale_string(mpath);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
|
@ -42,23 +42,23 @@ typedef struct fhandle_s {
|
|||
csync_vio_method_handle_t *csync_vio_local_open(const char *durl, int flags, mode_t mode) {
|
||||
fhandle_t *handle = NULL;
|
||||
int fd = -1;
|
||||
mbchar_t *url = c_multibyte(durl);
|
||||
mbchar_t *url = c_utf8_to_locale(durl);
|
||||
|
||||
if ((fd = _topen(url, flags, mode)) < 0) {
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
handle = c_malloc(sizeof(fhandle_t));
|
||||
if (handle == NULL) {
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
handle->fd = fd;
|
||||
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
|
||||
return (csync_vio_method_handle_t *) handle;
|
||||
}
|
||||
|
@ -66,22 +66,22 @@ csync_vio_method_handle_t *csync_vio_local_open(const char *durl, int flags, mod
|
|||
csync_vio_method_handle_t *csync_vio_local_creat(const char *durl, mode_t mode) {
|
||||
fhandle_t *handle = NULL;
|
||||
int fd = -1;
|
||||
mbchar_t *url = c_multibyte(durl);
|
||||
mbchar_t *url = c_utf8_to_locale(durl);
|
||||
|
||||
if(( fd = _tcreat( url, mode)) < 0) {
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
handle = c_malloc(sizeof(fhandle_t));
|
||||
if (handle == NULL) {
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
handle->fd = fd;
|
||||
c_free_multibyte(url);
|
||||
c_free_locale_string(url);
|
||||
return (csync_vio_method_handle_t *) handle;
|
||||
}
|
||||
|
||||
|
@ -158,21 +158,21 @@ typedef struct dhandle_s {
|
|||
|
||||
csync_vio_method_handle_t *csync_vio_local_opendir(const char *name) {
|
||||
dhandle_t *handle = NULL;
|
||||
mbchar_t *dirname = c_multibyte(name);
|
||||
mbchar_t *dirname = c_utf8_to_locale(name);
|
||||
|
||||
handle = c_malloc(sizeof(dhandle_t));
|
||||
if (handle == NULL) {
|
||||
c_free_multibyte(dirname);
|
||||
c_free_locale_string(dirname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
handle->dh = _topendir( dirname );
|
||||
if (handle->dh == NULL) {
|
||||
c_free_multibyte(dirname);
|
||||
c_free_locale_string(dirname);
|
||||
SAFE_FREE(handle);
|
||||
return NULL;
|
||||
}
|
||||
handle->path = c_utf8(dirname);
|
||||
handle->path = c_utf8_from_locale(dirname);
|
||||
|
||||
return (csync_vio_method_handle_t *) handle;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_method_handle_t *dhandl
|
|||
goto err;
|
||||
}
|
||||
|
||||
file_stat->name = c_utf8(dirent->d_name);
|
||||
file_stat->name = c_utf8_from_locale(dirent->d_name);
|
||||
file_stat->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
|
||||
/* Check for availability of d_type, see manpage. */
|
||||
|
@ -259,21 +259,21 @@ int csync_vio_local_mkdir(const char *uri, mode_t mode) {
|
|||
}
|
||||
|
||||
int csync_vio_local_rmdir(const char *uri) {
|
||||
mbchar_t *dirname = c_multibyte(uri);
|
||||
mbchar_t *dirname = c_utf8_to_locale(uri);
|
||||
int re = -1;
|
||||
|
||||
re = _trmdir(dirname);
|
||||
c_free_multibyte(dirname);
|
||||
c_free_locale_string(dirname);
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
||||
csync_stat_t sb;
|
||||
mbchar_t *wuri = c_multibyte( uri );
|
||||
mbchar_t *wuri = c_utf8_to_locale( uri );
|
||||
|
||||
if( _tstat(wuri, &sb) < 0) {
|
||||
c_free_multibyte(wuri);
|
||||
c_free_locale_string(wuri);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
|
||||
if (buf->name == NULL) {
|
||||
csync_vio_file_stat_destroy(buf);
|
||||
c_free_multibyte(wuri);
|
||||
c_free_locale_string(wuri);
|
||||
return -1;
|
||||
}
|
||||
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
|
@ -357,7 +357,7 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
buf->ctime = sb.st_ctime;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_CTIME;
|
||||
|
||||
c_free_multibyte(wuri);
|
||||
c_free_locale_string(wuri);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -366,18 +366,18 @@ int csync_vio_local_rename(const char *olduri, const char *newuri) {
|
|||
}
|
||||
|
||||
int csync_vio_local_unlink(const char *uri) {
|
||||
mbchar_t *nuri = c_multibyte(uri);
|
||||
mbchar_t *nuri = c_utf8_to_locale(uri);
|
||||
int re = _tunlink( nuri );
|
||||
c_free_multibyte(nuri);
|
||||
c_free_locale_string(nuri);
|
||||
return re;
|
||||
}
|
||||
|
||||
int csync_vio_local_chmod(const char *uri, mode_t mode) {
|
||||
mbchar_t *nuri = c_multibyte(uri);
|
||||
mbchar_t *nuri = c_utf8_to_locale(uri);
|
||||
int re = -1;
|
||||
|
||||
re = _tchmod(nuri, mode);
|
||||
c_free_multibyte(nuri);
|
||||
c_free_locale_string(nuri);
|
||||
return re;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue