From: short <> Date: Mon, 1 Sep 2003 15:18:57 +0000 (+0000) Subject: Reverted previous 'indirect' patch - we will rewrite the data instead. X-Git-Tag: gnome_vfs_httpcaptive_2_3_8captive1~14 X-Git-Url: http://git.jankratochvil.net/?p=gnome-vfs-httpcaptive.git;a=commitdiff_plain;h=91ed3c8a69b0ed61805430093c5f751ca37667df;ds=sidebyside Reverted previous 'indirect' patch - we will rewrite the data instead. --- diff --git a/modules/http-method.c b/modules/http-method.c index 0c4d49e..c2b3dc7 100644 --- a/modules/http-method.c +++ b/modules/http-method.c @@ -1654,10 +1654,6 @@ http_handle_close (HttpFileHandle *handle, ANALYZE_HTTP ("==> -http_handle_close"); } -typedef struct { - HttpFileHandle *http_file_handle; - } GnomeVFSHttpMethodHandle; - static GnomeVFSResult do_open (GnomeVFSMethod *method, GnomeVFSMethodHandle **method_handle, @@ -1666,7 +1662,6 @@ do_open (GnomeVFSMethod *method, GnomeVFSContext *context) { HttpFileHandle *handle; - GnomeVFSHttpMethodHandle *http_method_handle; GnomeVFSResult result = GNOME_VFS_OK; g_return_val_if_fail (uri->parent == NULL, GNOME_VFS_ERROR_INVALID_URI); @@ -1685,9 +1680,7 @@ do_open (GnomeVFSMethod *method, handle = http_file_handle_new(NULL, uri); /* shrug */ } if (result == GNOME_VFS_OK) { - http_method_handle = g_new (GnomeVFSHttpMethodHandle, 1); - http_method_handle->http_file_handle = handle; - *method_handle = (GnomeVFSMethodHandle *) http_method_handle; + *method_handle = (GnomeVFSMethodHandle *) handle; } else { *method_handle = NULL; } @@ -1782,7 +1775,6 @@ do_close (GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) { - GnomeVFSHttpMethodHandle *http_method_handle; HttpFileHandle *old_handle; HttpFileHandle *new_handle; GnomeVFSResult result; @@ -1790,10 +1782,8 @@ do_close (GnomeVFSMethod *method, ANALYZE_HTTP ("==> +do_close"); DEBUG_HTTP (("+Close handle:0x%08x", (unsigned int)method_handle)); - http_method_handle = (GnomeVFSHttpMethodHandle *) method_handle; - old_handle = http_method_handle->http_file_handle; - g_free (http_method_handle); - + old_handle = (HttpFileHandle *) method_handle; + /* if the handle was opened in write mode then: * 1) there won't be a connection open, and * 2) there will be data to_be_written... @@ -1853,7 +1843,7 @@ do_write (GnomeVFSMethod *method, DEBUG_HTTP (("+Write handle:0x%08x", (unsigned int)method_handle)); - handle = ((GnomeVFSHttpMethodHandle *) method_handle)->http_file_handle; + handle = (HttpFileHandle *) method_handle; if(handle->to_be_written == NULL) { handle->to_be_written = g_byte_array_new(); @@ -1881,7 +1871,7 @@ do_read (GnomeVFSMethod *method, ANALYZE_HTTP ("==> +do_read"); DEBUG_HTTP (("+Read handle=0x%08x", (unsigned int) method_handle)); - handle = ((GnomeVFSHttpMethodHandle *) method_handle)->http_file_handle; + handle = (HttpFileHandle *) method_handle; if (handle->file_info->flags & GNOME_VFS_FILE_INFO_FIELDS_SIZE) { GnomeVFSFileSize max_bytes; @@ -2213,14 +2203,9 @@ make_propfind_request (HttpFileHandle **handle_return, if (result == GNOME_VFS_OK) { do { - GnomeVFSHttpMethodHandle *http_method_handle; - - http_method_handle = g_new (GnomeVFSHttpMethodHandle, 1); - http_method_handle->http_file_handle = *handle_return; - result = do_read (NULL, (GnomeVFSMethodHandle *) http_method_handle, + result = do_read (NULL, (GnomeVFSMethodHandle *) *handle_return, buffer, num_bytes, &bytes_read, context); - g_free (http_method_handle); - + if (result != GNOME_VFS_OK ) { break; } @@ -2336,7 +2321,6 @@ do_open_directory(GnomeVFSMethod *method, HttpFileHandle *handle = NULL; GnomeVFSFileInfo * file_info_cached; GList *child_file_info_cached_list = NULL; - GnomeVFSHttpMethodHandle *http_method_handle; ANALYZE_HTTP ("==> +do_open_directory"); DEBUG_HTTP (("+Open_Directory options: %d URI: '%s'", options, gnome_vfs_uri_to_string (uri, 0))); @@ -2390,11 +2374,8 @@ do_open_directory(GnomeVFSMethod *method, handle = NULL; } } - - http_method_handle = g_new (GnomeVFSHttpMethodHandle, 1); - http_method_handle->http_file_handle = handle; - - *method_handle = (GnomeVFSMethodHandle *)http_method_handle; + + *method_handle = (GnomeVFSMethodHandle *)handle; error: DEBUG_HTTP (("-Open_Directory (%d) handle:0x%08x", result, (unsigned int)handle)); @@ -2409,14 +2390,11 @@ do_close_directory (GnomeVFSMethod *method, GnomeVFSContext *context) { HttpFileHandle *handle; - GnomeVFSHttpMethodHandle *http_method_handle; DEBUG_HTTP (("+Close_Directory")); - - http_method_handle = (GnomeVFSHttpMethodHandle *) method_handle; - handle = http_method_handle->http_file_handle; - g_free (http_method_handle); - + + handle = (HttpFileHandle *) method_handle; + http_handle_close(handle, context); DEBUG_HTTP (("-Close_Directory (0) handle:0x%08x", (unsigned int) method_handle)); @@ -2435,7 +2413,7 @@ do_read_directory (GnomeVFSMethod *method, DEBUG_HTTP (("+Read_Directory handle:0x%08x", (unsigned int) method_handle)); - handle = ((GnomeVFSHttpMethodHandle *) method_handle)->http_file_handle; + handle = (HttpFileHandle *) method_handle; if (handle->files && g_list_length (handle->files)) { GnomeVFSFileInfo *original_info = g_list_nth_data (handle->files, 0); @@ -2573,8 +2551,8 @@ do_get_file_info_from_handle (GnomeVFSMethod *method, DEBUG_HTTP (("+Get_File_Info_From_Handle")); - handle = ((GnomeVFSHttpMethodHandle *) method_handle)->http_file_handle; - + handle = (HttpFileHandle *) method_handle; + gnome_vfs_file_info_copy (file_info, handle->file_info); DEBUG_HTTP (("-Get_File_Info_From_Handle"));