patch for gnome-stream-efs.c
- From: Dietmar Maurer <dietmar maurer-it com>
- To: "gnome-components-list gnome org" <gnome-components-list gnome org>
- Subject: patch for gnome-stream-efs.c
- Date: Tue, 19 Sep 2000 09:05:03 +0200
Here is a patch for gnome-stream-efs.c to work with the
new libefs code.
Regards,
Dietmar
Index: gnome-stream-efs.c
===================================================================
RCS file: /cvs/gnome/bonobo/storage-modules/gnome-stream-efs.c,v
retrieving revision 1.11
diff -u -r1.11 gnome-stream-efs.c
--- gnome-stream-efs.c 2000/08/28 15:03:55 1.11
+++ gnome-stream-efs.c 2000/09/19 07:01:41
@@ -42,7 +42,7 @@
BonoboStreamEFS *stream_efs = BONOBO_STREAM_EFS (stream);
if (efs_file_write (stream_efs->file, buffer->_buffer,
- buffer->_length) == -1) {
+ buffer->_length)) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
return 0;
@@ -58,7 +58,8 @@
{
BonoboStreamEFS *stream_efs = BONOBO_STREAM_EFS (stream);
CORBA_octet *data;
- CORBA_long bytes;
+ gint32 bytes_read;
+ EFSResult result;
if (count < 0) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
@@ -70,17 +71,17 @@
CORBA_sequence_set_release (*buffer, TRUE);
data = CORBA_sequence_CORBA_octet_allocbuf (count);
- bytes = efs_file_read (stream_efs->file, data, count);
-
- if (bytes < 0) {
+ result = efs_file_read (stream_efs->file, data, count, &bytes_read);
+
+ if (!result || (result == EFS_ERR_EOF)) {
+ (*buffer)->_buffer = data;
+ (*buffer)->_length = bytes_read;
+ } else {
CORBA_free (data);
CORBA_free (*buffer);
*buffer = NULL;
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Stream_IOError, NULL);
- } else {
- (*buffer)->_buffer = data;
- (*buffer)->_length = bytes;
}
}
@@ -88,17 +89,25 @@
real_seek (BonoboStream *stream, CORBA_long offset, Bonobo_Stream_SeekType whence,
CORBA_Environment *ev)
{
+ guint32 pos;
+
BonoboStreamEFS *stream_efs = BONOBO_STREAM_EFS (stream);
int fw;
if (whence == Bonobo_Stream_SEEK_CUR)
- fw = SEEK_CUR;
+ fw = EFS_SEEK_CUR;
else if (whence == Bonobo_Stream_SEEK_END)
- fw = SEEK_END;
+ fw = EFS_SEEK_END;
else
- fw = SEEK_SET;
+ fw = EFS_SEEK_SET;
+
+ if (efs_file_seek (stream_efs->file, offset, fw, &pos)) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Stream_IOError, NULL);
+ return 0;
+ }
- return efs_file_seek (stream_efs->file, offset, fw);
+ return pos;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]