aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-09 13:16:53 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-09 13:16:53 +0800
commitfbf55cd7f31b6a413ebe785579b840a0091d390c (patch)
treecaf6c732cb655949ef79f81ce8e77c2cbcfad6ba /e-util
parenta0522bcc255a194232d46dd52ba4a719c66d42f6 (diff)
downloadgsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar.gz
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar.bz2
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar.lz
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar.xz
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.tar.zst
gsoc2013-evolution-fbf55cd7f31b6a413ebe785579b840a0091d390c.zip
Added uncompiled e_read_uri function.
2000-08-09 Christopher James Lahey <clahey@helixcode.com> * e-util.c, e-util.h: Added uncompiled e_read_uri function. svn path=/trunk/; revision=4629
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog4
-rw-r--r--e-util/e-util.c50
-rw-r--r--e-util/e-util.c-861150
-rw-r--r--e-util/e-util.h3
-rw-r--r--e-util/e-util.h-290023
5 files changed, 108 insertions, 2 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 053cd8c3f1..f5d1c2a4de 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,5 +1,9 @@
2000-08-09 Christopher James Lahey <clahey@helixcode.com>
+ * e-util.c, e-util.h: Added uncompiled e_read_uri function.
+
+2000-08-09 Christopher James Lahey <clahey@helixcode.com>
+
* e-popup-menu.c, e-popup-menu.h: Added a hide_mask argument to
the two popup menu functions.
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 83e83f7a75..90a5697fb0 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -29,6 +29,9 @@
#include <string.h>
#include "e-util.h"
+#if 0
+#include <libgnomevfs/gnome-vfs.h>
+#endif
int
g_str_compare(const void *x, const void *y)
@@ -105,7 +108,9 @@ e_read_file(const char *filename)
bytes = read(fd, buffer, BUFF_SIZE);
while (bytes) {
if (bytes > 0) {
- list = g_list_prepend(list, g_strndup(buffer, bytes));
+ char *temp = g_malloc(bytes);
+ memcpy (temp, buffer, bytes);
+ list = g_list_prepend(list, temp);
lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes));
length += bytes;
} else {
@@ -161,6 +166,49 @@ e_write_file(const char *filename, const char *data, int flags)
return 0;
}
+#if 0
+char *
+e_read_uri(const char *uri)
+{
+ GnomeVFSHandle *handle;
+ GList *list = NULL, *list_iterator;
+ GList *lengths = NULL, *lengths_iterator;
+ gchar buffer[1025];
+ gchar *ret_val;
+ int length = 0;
+ GnomeVFSFileSize bytes;
+
+ gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ);
+
+ gnome_vfs_read(handle, buffer, 1024, &bytes);
+ while (bytes) {
+ if (bytes) {
+ char *temp = g_malloc(bytes);
+ memcpy (temp, buffer, bytes);
+ list = g_list_prepend(list, temp);
+ lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes));
+ length += bytes;
+ }
+ gnome_vfs_read(handle, buffer, 1024, &bytes);
+ }
+
+ ret_val = g_new(char, length + 1);
+ ret_val[length] = 0;
+ lengths_iterator = lengths;
+ list_iterator = list;
+ for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
+ int this_length = GPOINTER_TO_INT(lengths_iterator->data);
+ length -= this_length;
+ memcpy(ret_val + length, list_iterator->data, this_length);
+ }
+ gnome_vfs_close(handle);
+ g_list_foreach(list, (GFunc) g_free, NULL);
+ g_list_free(list);
+ g_list_free(lengths);
+ return ret_val;
+}
+#endif
+
typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
gint arg1,
gint arg2,
diff --git a/e-util/e-util.c-8611 b/e-util/e-util.c-8611
index 83e83f7a75..90a5697fb0 100644
--- a/e-util/e-util.c-8611
+++ b/e-util/e-util.c-8611
@@ -29,6 +29,9 @@
#include <string.h>
#include "e-util.h"
+#if 0
+#include <libgnomevfs/gnome-vfs.h>
+#endif
int
g_str_compare(const void *x, const void *y)
@@ -105,7 +108,9 @@ e_read_file(const char *filename)
bytes = read(fd, buffer, BUFF_SIZE);
while (bytes) {
if (bytes > 0) {
- list = g_list_prepend(list, g_strndup(buffer, bytes));
+ char *temp = g_malloc(bytes);
+ memcpy (temp, buffer, bytes);
+ list = g_list_prepend(list, temp);
lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes));
length += bytes;
} else {
@@ -161,6 +166,49 @@ e_write_file(const char *filename, const char *data, int flags)
return 0;
}
+#if 0
+char *
+e_read_uri(const char *uri)
+{
+ GnomeVFSHandle *handle;
+ GList *list = NULL, *list_iterator;
+ GList *lengths = NULL, *lengths_iterator;
+ gchar buffer[1025];
+ gchar *ret_val;
+ int length = 0;
+ GnomeVFSFileSize bytes;
+
+ gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ);
+
+ gnome_vfs_read(handle, buffer, 1024, &bytes);
+ while (bytes) {
+ if (bytes) {
+ char *temp = g_malloc(bytes);
+ memcpy (temp, buffer, bytes);
+ list = g_list_prepend(list, temp);
+ lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes));
+ length += bytes;
+ }
+ gnome_vfs_read(handle, buffer, 1024, &bytes);
+ }
+
+ ret_val = g_new(char, length + 1);
+ ret_val[length] = 0;
+ lengths_iterator = lengths;
+ list_iterator = list;
+ for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
+ int this_length = GPOINTER_TO_INT(lengths_iterator->data);
+ length -= this_length;
+ memcpy(ret_val + length, list_iterator->data, this_length);
+ }
+ gnome_vfs_close(handle);
+ g_list_foreach(list, (GFunc) g_free, NULL);
+ g_list_free(list);
+ g_list_free(lengths);
+ return ret_val;
+}
+#endif
+
typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
gint arg1,
gint arg2,
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 91856de1cc..87af6032c2 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -41,6 +41,9 @@ void e_free_string_list (GList *list);
char *e_read_file (const char *filename);
gint e_write_file(const char *filename, const char *data, int flags);
+#if 0
+char *e_read_uri (const char *uri);
+#endif
gchar **e_strsplit (const gchar *string,
const gchar *delimiter,
diff --git a/e-util/e-util.h-29002 b/e-util/e-util.h-29002
index 91856de1cc..87af6032c2 100644
--- a/e-util/e-util.h-29002
+++ b/e-util/e-util.h-29002
@@ -41,6 +41,9 @@ void e_free_string_list (GList *list);
char *e_read_file (const char *filename);
gint e_write_file(const char *filename, const char *data, int flags);
+#if 0
+char *e_read_uri (const char *uri);
+#endif
gchar **e_strsplit (const gchar *string,
const gchar *delimiter,