Fixed various errors in the C interface.
Use new C external syntax. git-svn-id: https://svn.origo.ethz.ch/eiffelstudio/trunk/Src/library/cURL@71204 8089f293-4706-0410-a29e-feb5c42a2edf
This commit is contained in:
@@ -22,7 +22,7 @@ feature -- Interactive with C
|
||||
-- Set object and function addresses.
|
||||
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function'.
|
||||
do
|
||||
c_set_object (Current)
|
||||
c_set_object ($Current)
|
||||
c_set_progress_function_address ($progress_function)
|
||||
c_set_write_function_address ($write_function)
|
||||
c_set_debug_function_address ($debug_function)
|
||||
@@ -110,45 +110,43 @@ feature -- cURL curl_easy_setopt functions
|
||||
|
||||
feature {NONE} -- Externals
|
||||
|
||||
c_set_object (a_object: like Current) is
|
||||
c_set_object (a_object: POINTER) is
|
||||
-- Set Current object address.
|
||||
external
|
||||
"C macro signature (EIF_OBJECT) use %"eiffel_curl.h%""
|
||||
"C signature (EIF_REFERENCE) use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_release_object is
|
||||
-- Release Current pointer in C
|
||||
external
|
||||
"C [macro %"eiffel_curl.h%"]"
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_progress_function_address (a_address: POINTER) is
|
||||
-- Set progress function address.
|
||||
external
|
||||
"C [macro %"eiffel_curl.h%"]"
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_write_function_address (a_address: POINTER) is
|
||||
-- Set write function address.
|
||||
external
|
||||
"C [macro %"eiffel_curl.h%"]"
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_debug_function_address (a_address: POINTER) is
|
||||
-- Set write function address.
|
||||
external
|
||||
"C [macro %"eiffel_curl.h%"]"
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dispose is
|
||||
-- Wean `Current'
|
||||
local
|
||||
default_object: like Current
|
||||
do
|
||||
c_release_object
|
||||
c_set_object (default_object)
|
||||
c_set_object (default_pointer)
|
||||
end
|
||||
|
||||
indexing
|
||||
|
||||
@@ -58,7 +58,7 @@ typedef EIF_INTEGER (* EIF_CURL_DEBUG_PROC) (
|
||||
EIF_POINTER /* a_user_pointer */
|
||||
);
|
||||
|
||||
static EIF_REFERENCE eiffel_function_object = NULL;
|
||||
static EIF_OBJECT eiffel_function_object = NULL;
|
||||
/* Address of Eiffel object CURL_FUNCTION */
|
||||
|
||||
static EIF_CURL_PROGRESS_PROC eiffel_progress_function = NULL;
|
||||
@@ -73,7 +73,11 @@ static EIF_CURL_DEBUG_PROC eiffel_debug_function = NULL;
|
||||
/* Set Eiffel CURL_FUNCTION object address */
|
||||
static void c_set_object(EIF_REFERENCE a_address)
|
||||
{
|
||||
eiffel_function_object = (EIF_REFERENCE) eif_adopt (a_address);
|
||||
if (a_address) {
|
||||
eiffel_function_object = eif_protect (a_address);
|
||||
} else {
|
||||
eiffel_function_object = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release Eiffel CURL_FUNCTION object address */
|
||||
@@ -112,6 +116,7 @@ static size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *d
|
||||
(EIF_INTEGER) nmemb,
|
||||
(EIF_POINTER) data));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +133,7 @@ static size_t curl_progress_function (void * a_object_id, double a_dltotal, doub
|
||||
(EIF_REAL_64) a_ultotal,
|
||||
(EIF_REAL_64) a_ulnow));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +150,7 @@ static size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_in
|
||||
(EIF_INTEGER) a_size,
|
||||
(EIF_POINTER) a_object_id));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user