On Sat, May 7, 2011 at 2:37 PM, William Demchick <[email protected]
> wrote:
> Hi,
>
> I have plans to do a code review of the HTTP FS this week. I'll let
> you know if I encounter the same sorts of failures.
>
Attaching a patch, this fixes the build. Quite a few code removal and stuff
just to get it compiled. Just a crude approach to get libgnupdf build
complete with fsys http enabled :-)
Thanks
--
Harshavardhana
=== modified file 'src/base/pdf-fsys-http.c'
--- src/base/pdf-fsys-http.c 2011-03-10 19:41:03 +0000
+++ src/base/pdf-fsys-http.c 2011-05-07 08:06:44 +0000
@@ -513,7 +513,7 @@
}
else
{
- ret_code = pdf_list_new (NULL, NULL, PDF_TRUE,
+ ret_code = (pdf_status_t) pdf_list_new (NULL, NULL, PDF_TRUE,
&(pdf_fsys_http_data->file_list) );
}
@@ -624,7 +624,7 @@
/* Get path name of the father of a given item in the filesystem */
pdf_status_t
pdf_fsys_http_get_parent (void *data,
- pdf_text_t *path_name,
+ const pdf_text_t *path_name,
pdf_text_t **parent_path)
{
/* No clear meaning for URL request. */
@@ -668,13 +668,13 @@
{
#warning This is wrong, curl expects always a URI as per RFC2396
/* convert path_name into host-encoding for curl */
- url = __pdf_fsys_http_get_url (path_name);
+ url = __pdf_fsys_http_get_url (path_name, NULL);
ret_code = (url ? PDF_OK : PDF_ERROR);
}
if (PDF_OK == ret_code)
{
- res = curl_easy_setopt (curl, CURLOPT_URL, host_path);
+ res = curl_easy_setopt (curl, CURLOPT_URL, path_name);
if (CURLE_OK != res)
{
@@ -713,8 +713,6 @@
memset (&(props->creation_date), 0, sizeof (pdf_time_t));
memset (&(props->modification_date), 0,
sizeof (pdf_time_t));
- props->file_size_high = (pdf_u32_t)UINT32_MAX;
- props->file_size_low = (pdf_u32_t)UINT32_MAX;
props->folder_size = (pdf_u32_t)0;
res = curl_easy_getinfo (curl,
@@ -729,13 +727,7 @@
/* divide by 2^32 to get high-32-bits in temp_d */
temp_d = file_len / TWO_RAISED_TO_32_AS_DOUBLE;
- /* cast temp_d to assign high */
- props->file_size_high = (pdf_u32_t)temp_d;
- /* move back to double domain to calculate low */
- temp_d = file_len - (((double)props->file_size_high)
- * TWO_RAISED_TO_32_AS_DOUBLE);
- /* cast temp_d to assign low */
- props->file_size_low = (pdf_u32_t)temp_d;
+
}
else
{
@@ -945,17 +937,7 @@
rv = PDF_EBADPERMS;
}
- if ((UINT32_MAX == item_props.file_size_high)
- && (UINT32_MAX == item_props.file_size_low))
- {
- /* we need to receive content_len from server to set up rx
- buffer */
- len_avail = PDF_FALSE;
- }
- else
- {
- len_avail = PDF_TRUE;
- }
+ len_avail = PDF_TRUE;
}
if (PDF_OK == rv)
@@ -996,12 +978,15 @@
if (PDF_OK == rv)
{
-
+
+#warning "Implement __pdf_fsys_http_get_host_path function."
+/*
rv = __pdf_fsys_http_get_host_path (path_name,
&(http_file->host_path),
&(http_file->host_path_size));
-
+*/
fsys->implementation = &pdf_fsys_http_implementation;
+
file->fs = fsys;
file->data = http_file;
@@ -1293,8 +1278,8 @@
pdf_status_t pdf_fsys_http_build_path (void *data,
pdf_text_t **output,
- pdf_text_t *first_element,
- pdf_list_t *rest)
+ const pdf_text_t *first_element,
+ const pdf_list_t **rest)
{
/* TODO: Implement me! */
return PDF_ERROR;
@@ -1304,7 +1289,7 @@
/* Check if paths are same/equivalent */
pdf_bool_t
pdf_fsys_http_file_same_p (pdf_fsys_file_t file,
- pdf_text_t *path_name)
+ const pdf_text_t *path_name)
{
/* TODO: Implement me! */
#warning "pdf_fsys_http_file_same_p is not yet implemented."
=== modified file 'src/base/pdf-fsys-http.h'
--- src/base/pdf-fsys-http.h 2011-03-10 19:41:03 +0000
+++ src/base/pdf-fsys-http.h 2011-05-07 08:17:53 +0000
@@ -32,15 +32,15 @@
#include <pdf-fsys.h>
-#include <curl/curl.h>
-
#include <pthread.h>
/* BEGIN PUBLIC */
+#include <curl/curl.h>
+
extern const struct pdf_fsys_impl_s pdf_fsys_http_implementation;
-/* END PUBLIC */
+
/* Filesystem internal data associated with open files */
struct pdf_fsys_http_file_s
@@ -181,6 +181,7 @@
pdf_status_t pdf_fsys_http_file_reopen (pdf_fsys_file_t file,
enum pdf_fsys_file_mode_e mode);
+/* END PUBLIC */
#endif /* !PDF_FSYS_HTTP_H */
=== modified file 'src/pdf-global.c'
--- src/pdf-global.c 2011-03-24 19:30:20 +0000
+++ src/pdf-global.c 2011-05-07 07:41:18 +0000
@@ -111,7 +111,7 @@
*/
if (curl_global_init (CURL_GLOBAL_ALL) != 0)
{
- inner_error = pdf_error_new (PDF_EDOMAIN_FS,
+ inner_error = pdf_error_new (PDF_EDOMAIN_BASE_FS,
PDF_ERROR,
"couldn't initialize curl");
}