Adapt to new multybyte api after merge

(Search and replace)
This commit is contained in:
Olivier Goffart 2013-08-18 16:43:46 +02:00
parent 9f5388544a
commit 2afdc9d095
8 changed files with 30 additions and 30 deletions

View file

@ -71,7 +71,7 @@ static int _csync_config_copy_default (const char *config) {
int rc;
#ifdef _WIN32
/* For win32, try to copy the conf file from the directory from where the app was started. */
_TCHAR tcharbuf[MAX_PATH+1];
mbchar_t tcharbuf[MAX_PATH+1];
char *buf;
int len = 0;

View file

@ -62,12 +62,12 @@ int csync_get_statedb_exists(CSYNC *ctx) {
/* Set the hide attribute in win32. That makes it invisible in normal explorers */
static void _csync_win32_hide_file( const char *file ) {
#ifdef _WIN32
_TCHAR *fileName;
mbchar_t *fileName;
DWORD dwAttrs;
if( !file ) return;
fileName = c_multibyte( file );
fileName = c_utf8_to_locale( file );
dwAttrs = GetFileAttributesW(fileName);
if (dwAttrs==INVALID_FILE_ATTRIBUTES) return;
@ -76,7 +76,7 @@ static void _csync_win32_hide_file( const char *file ) {
SetFileAttributesW(fileName, dwAttrs | FILE_ATTRIBUTE_HIDDEN );
}
c_free_multibyte(fileName);
c_free_locale_string(fileName);
#else
(void) file;
#endif
@ -398,10 +398,10 @@ int csync_statedb_close(const char *statedb, sqlite3 *db, int jwritten) {
c_free_locale_string(mb_statedb);
}
wstatedb_tmp = c_multibyte(statedb_tmp);
wstatedb_tmp = c_utf8_to_locale(statedb_tmp);
if (wstatedb_tmp) {
_tunlink(wstatedb_tmp);
c_free_multibyte(wstatedb_tmp);
c_free_locale_string(wstatedb_tmp);
}
SAFE_FREE(statedb_tmp);

View file

@ -375,11 +375,11 @@ out:
void csync_win32_set_file_hidden( const char *file, bool h ) {
#ifdef _WIN32
const _TCHAR *fileName;
const mbchar_t *fileName;
DWORD dwAttrs;
if( !file ) return;
fileName = c_multibyte( file );
fileName = c_utf8_to_locale( file );
dwAttrs = GetFileAttributesW(fileName);
if (dwAttrs==INVALID_FILE_ATTRIBUTES) return;
@ -390,7 +390,7 @@ void csync_win32_set_file_hidden( const char *file, bool h ) {
SetFileAttributesW(fileName, dwAttrs & ~FILE_ATTRIBUTE_HIDDEN );
}
c_free_multibyte(fileName);
c_free_locale_string(fileName);
#else
(void) h;
(void) file;

View file

@ -64,17 +64,17 @@ int c_isfile(const char *path) {
#ifdef _WIN32
int c_copy(const char* src, const char *dst, mode_t mode) {
int rc = -1;
_TCHAR *wsrc = 0;
_TCHAR *wdst = 0;
mbchar_t *wsrc = 0;
mbchar_t *wdst = 0;
(void) mode; /* unused on win32 */
if(src && dst) {
wsrc = c_multibyte(src);
wdst = c_multibyte(dst);
wsrc = c_utf8_to_locale(src);
wdst = c_utf8_to_locale(dst);
if (CopyFileW(wsrc, wdst, FALSE)) {
rc = 0;
}
c_free_multibyte(wsrc);
c_free_multibyte(wdst);
c_free_locale_string(wsrc);
c_free_locale_string(wdst);
if( rc < 0 ) {
errno = GetLastError();
}
@ -193,8 +193,8 @@ out:
}
int c_rename( const char *src, const char *dst ) {
_TCHAR *nuri = NULL;
_TCHAR *ouri = NULL;
mbchar_t *nuri = NULL;
mbchar_t *ouri = NULL;
int rc = 0;
nuri = c_utf8_to_locale(dst);
@ -250,7 +250,7 @@ int c_rename( const char *src, const char *dst ) {
}
int c_compare_file( const char *f1, const char *f2 ) {
_TCHAR *wf1, *wf2;
mbchar_t *wf1, *wf2;
int fd1 = -1, fd2 = -1;
size_t size1, size2;
char buffer1[BUFFER_SIZE];
@ -262,11 +262,11 @@ int c_compare_file( const char *f1, const char *f2 ) {
if(f1 == NULL || f2 == NULL) return -1;
wf1 = c_multibyte(f1);
wf1 = c_utf8_to_locale(f1);
if(wf1 == NULL) {
return -1;
}
wf2 = c_multibyte(f2);
wf2 = c_utf8_to_locale(f2);
if(wf2 == NULL) {
return -1;
}
@ -323,8 +323,8 @@ out:
if(fd1 > -1) close(fd1);
if(fd2 > -1) close(fd2);
c_free_multibyte(wf1);
c_free_multibyte(wf2);
c_free_locale_string(wf1);
c_free_locale_string(wf2);
return rc;
}

View file

@ -140,7 +140,7 @@ int c_utimes(const char *uri, const struct timeval *times) {
}
CloseHandle(hFile);
c_free_multibyte(wuri);
c_free_locale_string(wuri);
return 0;
}

View file

@ -99,11 +99,11 @@ int csync_vio_init(CSYNC *ctx, const char *module, const char *args) {
/* cut the trailing filename off */
if ((last_bslash = strrchr(buf, '\\')) != NULL) {
*last_bslash='\0';
pathBuf = c_multibyte(buf);
pathBuf = c_utf8_to_locale(buf);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Win32: changing current working dir to %s", buf);
_wchdir(pathBuf);
c_free_multibyte(pathBuf);
c_free_locale_string(pathBuf);
}
c_free_utf8(buf);

View file

@ -378,7 +378,7 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
FILE_ATTRIBUTE_NORMAL+FILE_FLAG_BACKUP_SEMANTICS, NULL );
if( h == INVALID_HANDLE_VALUE ) {
errno = GetLastError();
c_free_multibyte(wuri);
c_free_locale_string(wuri);
return -1;
} else {

View file

@ -156,10 +156,10 @@ static void teardown_toplevel_dir( void **state ) {
static void stat_local_file( csync_stat_t *sb, const char *file )
{
_TCHAR *mpath = NULL;
mpath = c_multibyte(file);
mbchar_t *mpath = NULL;
mpath = c_utf8_to_locale(file);
assert_int_not_equal(_tstat(mpath, sb), -1);
c_free_multibyte(mpath);
c_free_locale_string(mpath);
assert_null(mpath);
}
@ -225,7 +225,7 @@ static void download_a_file( const char* local, void **state, const char *durl)
char path[256];
char src_path[256];
int did;
_TCHAR tlocal[256];
mbchar_t tlocal[256];
csync_vio_method_handle_t *handle;
ssize_t count;