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.
|
-- Set object and function addresses.
|
||||||
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function'.
|
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function'.
|
||||||
do
|
do
|
||||||
c_set_object (Current)
|
c_set_object ($Current)
|
||||||
c_set_progress_function_address ($progress_function)
|
c_set_progress_function_address ($progress_function)
|
||||||
c_set_write_function_address ($write_function)
|
c_set_write_function_address ($write_function)
|
||||||
c_set_debug_function_address ($debug_function)
|
c_set_debug_function_address ($debug_function)
|
||||||
@@ -110,45 +110,43 @@ feature -- cURL curl_easy_setopt functions
|
|||||||
|
|
||||||
feature {NONE} -- Externals
|
feature {NONE} -- Externals
|
||||||
|
|
||||||
c_set_object (a_object: like Current) is
|
c_set_object (a_object: POINTER) is
|
||||||
-- Set Current object address.
|
-- Set Current object address.
|
||||||
external
|
external
|
||||||
"C macro signature (EIF_OBJECT) use %"eiffel_curl.h%""
|
"C signature (EIF_REFERENCE) use %"eiffel_curl.h%""
|
||||||
end
|
end
|
||||||
|
|
||||||
c_release_object is
|
c_release_object is
|
||||||
-- Release Current pointer in C
|
-- Release Current pointer in C
|
||||||
external
|
external
|
||||||
"C [macro %"eiffel_curl.h%"]"
|
"C use %"eiffel_curl.h%""
|
||||||
end
|
end
|
||||||
|
|
||||||
c_set_progress_function_address (a_address: POINTER) is
|
c_set_progress_function_address (a_address: POINTER) is
|
||||||
-- Set progress function address.
|
-- Set progress function address.
|
||||||
external
|
external
|
||||||
"C [macro %"eiffel_curl.h%"]"
|
"C use %"eiffel_curl.h%""
|
||||||
end
|
end
|
||||||
|
|
||||||
c_set_write_function_address (a_address: POINTER) is
|
c_set_write_function_address (a_address: POINTER) is
|
||||||
-- Set write function address.
|
-- Set write function address.
|
||||||
external
|
external
|
||||||
"C [macro %"eiffel_curl.h%"]"
|
"C use %"eiffel_curl.h%""
|
||||||
end
|
end
|
||||||
|
|
||||||
c_set_debug_function_address (a_address: POINTER) is
|
c_set_debug_function_address (a_address: POINTER) is
|
||||||
-- Set write function address.
|
-- Set write function address.
|
||||||
external
|
external
|
||||||
"C [macro %"eiffel_curl.h%"]"
|
"C use %"eiffel_curl.h%""
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
dispose is
|
dispose is
|
||||||
-- Wean `Current'
|
-- Wean `Current'
|
||||||
local
|
|
||||||
default_object: like Current
|
|
||||||
do
|
do
|
||||||
c_release_object
|
c_release_object
|
||||||
c_set_object (default_object)
|
c_set_object (default_pointer)
|
||||||
end
|
end
|
||||||
|
|
||||||
indexing
|
indexing
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ typedef EIF_INTEGER (* EIF_CURL_DEBUG_PROC) (
|
|||||||
EIF_POINTER /* a_user_pointer */
|
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 */
|
/* Address of Eiffel object CURL_FUNCTION */
|
||||||
|
|
||||||
static EIF_CURL_PROGRESS_PROC eiffel_progress_function = NULL;
|
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 */
|
/* Set Eiffel CURL_FUNCTION object address */
|
||||||
static void c_set_object(EIF_REFERENCE a_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 */
|
/* 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_INTEGER) nmemb,
|
||||||
(EIF_POINTER) data));
|
(EIF_POINTER) data));
|
||||||
} else {
|
} 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_ultotal,
|
||||||
(EIF_REAL_64) a_ulnow));
|
(EIF_REAL_64) a_ulnow));
|
||||||
} else {
|
} 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_INTEGER) a_size,
|
||||||
(EIF_POINTER) a_object_id));
|
(EIF_POINTER) a_object_id));
|
||||||
} else {
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user