summaryrefslogtreecommitdiff
path: root/camel/camel-text-index.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-11-30 09:54:54 +0000
committerTor Lillqvist <tml@src.gnome.org>2005-11-30 09:54:54 +0000
commit934206b6ab4ee6a11940e649853d91c5efc00f0b (patch)
treee27a7950c6e75c31892618eb46991c49598229a9 /camel/camel-text-index.c
parentfef4ef16071ed9342cd8ffc1b245e5bcaaea3bd2 (diff)
downloadevolution-data-server-934206b6ab4ee6a11940e649853d91c5efc00f0b.tar.gz
Define O_BINARY as 0 on Unix. Add declarations for camel_read_socket() and
2005-11-30 Tor Lillqvist <tml@novell.com> * camel-file-utils.h: Define O_BINARY as 0 on Unix. Add declarations for camel_read_socket() and camel_write_socket(). (In a not yet committed addition to camel-file-utils.c.) * camel-block-file.c * camel-certdb.c * camel-data-cache.c * camel-disco-diary.c * camel-folder-summary.c * camel-mime-parser.c * camel-offline-journal.c * camel-provider.c * camel-session.c * camel-store-summary.c * camel-stream-fs.c * camel-text-index.c * camel-uid-cache.c * camel-vee-store.c: Use gstdio wrappers for full non-ASCII filename support on Windows. * camel-block-file.c (key_file_use) * camel-certdb.c (camel_certdb_save) * camel-disco-diary.c (camel_disco_diary_new) * camel-folder-summary.c (camel_folder_summary_load) * camel-offline-journal.c (camel_offline_journal_construct) * camel-store-summary.c (camel_store_summary_load, camel_store_summary_save, camel_store_summary_header_load) * camel-stream-fs.c (camel_stream_fs_new_with_name) * camel-text-index.c (dump_raw) * camel-uid-cache.c (camel_uid_cache_new, camel_uid_cache_save): Open file in binary mode. * camel-data-cache.c (data_cache_expire) * camel-provider.c (camel_provider_init): Use GDir instead of dirent API for portability and full non-ASCII filename support on Windows. * camel-folder-summary.c (camel_folder_summary_load): On Win32 unlink destination before attempting a rename. * camel-mime-parser.c: Drop unused includes. Use g_ascii_strcasecmp() instead of strcasecmp() for well-definedness, and the other string being compared is an ASCII literal anyway. * camel-provider.c (camel_provider_init) Use G_MODULE_SUFFIX instead of hardcoding .so. * camel-session.c (session_thread_wait): Use g_usleep() instead of usleep() for portability. * camel-utf8.c: Use g_htons() and g_ntohs() instead of htons() and ntohs() for portability.
Diffstat (limited to 'camel/camel-text-index.c')
-rw-r--r--camel/camel-text-index.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 67d351c1c..6308f9790 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -33,16 +33,17 @@
#include <fcntl.h>
#include <ctype.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
#include "libedataserver/e-msgport.h"
#include "libedataserver/e-memory.h"
-#include "camel/camel-object.h"
-
-#include "camel-text-index.h"
#include "camel-block-file.h"
+#include "camel-object.h"
#include "camel-partition-table.h"
-
-#include <glib/gunicode.h>
+#include "camel-private.h"
+#include "camel-text-index.h"
#define w(x)
@@ -513,9 +514,9 @@ fail:
/* clean up temp files always */
sprintf(savepath, "%s~.index", oldpath);
- unlink(savepath);
+ g_unlink(savepath);
sprintf(newpath, "%s.data", savepath);
- unlink(newpath);
+ g_unlink(newpath);
return ret;
}
@@ -932,17 +933,17 @@ camel_text_index_rename(const char *old, const char *new)
sprintf(oldname, "%s.index", old);
sprintf(newname, "%s.index", new);
- if (rename(oldname, newname) == -1 && errno != ENOENT)
+ if (g_rename(oldname, newname) == -1 && errno != ENOENT)
return -1;
sprintf(oldname, "%s.index.data", old);
sprintf(newname, "%s.index.data", new);
- if (rename(oldname, newname) == -1 && errno != ENOENT) {
+ if (g_rename(oldname, newname) == -1 && errno != ENOENT) {
err = errno;
sprintf(oldname, "%s.index", old);
sprintf(newname, "%s.index", new);
- rename(newname, oldname);
+ g_rename(newname, oldname);
errno = err;
return -1;
}
@@ -963,9 +964,9 @@ camel_text_index_remove(const char *old)
sprintf(block, "%s.index", old);
sprintf(key, "%s.index.data", old);
- if (unlink(block) == -1 && errno != ENOENT)
+ if (g_unlink(block) == -1 && errno != ENOENT)
ret = -1;
- if (unlink(key) == -1 && errno != ENOENT)
+ if (g_unlink(key) == -1 && errno != ENOENT)
ret = -1;
return ret;
@@ -1090,7 +1091,7 @@ dump_raw(GHashTable *map, char *path)
int fd;
camel_block_t id, total;
- fd = open(path, O_RDONLY);
+ fd = g_open(path, O_RDONLY|O_BINARY, 0);
if (fd == -1)
return;