From 925fdcd9791aa817de41fdfe239959be1f1ec1c9 Mon Sep 17 00:00:00 2001 From: manus Date: Wed, 4 Feb 2009 01:05:57 +0000 Subject: [PATCH] Made the cURL library void-safe. git-svn-id: https://svn.origo.ethz.ch/eiffelstudio/trunk/Src/library/cURL@76961 8089f293-4706-0410-a29e-feb5c42a2edf --- cURL-safe.ecf | 79 +++++++++++++++++++++++++++++++++++++++++ curl_default_function.e | 13 +++---- curl_easy_externals.e | 9 ++--- curl_string.e | 2 +- 4 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 cURL-safe.ecf diff --git a/cURL-safe.ecf b/cURL-safe.ecf new file mode 100644 index 00000000..6feff68e --- /dev/null +++ b/cURL-safe.ecf @@ -0,0 +1,79 @@ + + + + cURL: libcURL wrapper library for Eiffel. + Copyright (c) 1984-2006, Eiffel Software and others. + Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt). + + + /\.svn$ + /EIFGEN.{0,1}$ + /temp$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /spec$ + /Clib$ + + + /gtk$ + + + + + + /mswin$ + + + + + + + diff --git a/curl_default_function.e b/curl_default_function.e index 5b755885..644142fb 100644 --- a/curl_default_function.e +++ b/curl_default_function.e @@ -35,16 +35,17 @@ feature -- Command -- Redefine local l_c_string: C_STRING - l_string: CURL_STRING l_identified: IDENTIFIED do Result := a_size * a_nmemb - create l_c_string.share_from_pointer_and_count (a_data_pointer, Result) + create l_c_string.make_shared_from_pointer_and_count (a_data_pointer, Result) create l_identified - l_string ?= l_identified.id_object (a_object_id.to_integer_32) - check not_void: l_string /= Void end - l_string.append (l_c_string.string) + if {l_string: CURL_STRING} l_identified.id_object (a_object_id.to_integer_32) then + l_string.append (l_c_string.string) + else + check False end + end end debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER @@ -85,7 +86,7 @@ feature {NONE} -- Implementation local l_c_string: C_STRING do - create l_c_string.share_from_pointer_and_count (a_char_pointer, a_size) + create l_c_string.make_shared_from_pointer_and_count (a_char_pointer, a_size) print ("%N" + a_text + "%N" + l_c_string.string) end diff --git a/curl_easy_externals.e b/curl_easy_externals.e index cfe97b38..0c88d61a 100644 --- a/curl_easy_externals.e +++ b/curl_easy_externals.e @@ -131,7 +131,7 @@ feature -- Query do Result := (api_loader.module_pointer (module_name) /= default_pointer) end - + feature -- Special setting set_curl_function (a_curl_function: CURL_FUNCTION) @@ -145,8 +145,9 @@ feature -- Special setting curl_function: CURL_FUNCTION -- cURL functions in curl_easy_setopt. do - Result := internal_curl_function - if Result = Void then + if {l_curl_function: like curl_function} internal_curl_function then + Result := l_curl_function + else create {CURL_DEFAULT_FUNCTION} Result.make internal_curl_function := Result end @@ -197,7 +198,7 @@ feature -- Special setting feature {NONE} -- Implementation - internal_curl_function: CURL_FUNCTION + internal_curl_function: ?CURL_FUNCTION -- cURL functions. api_loader: API_LOADER diff --git a/curl_string.e b/curl_string.e index 5f38934c..87ad63c6 100644 --- a/curl_string.e +++ b/curl_string.e @@ -31,7 +31,7 @@ create make_empty, make_filled, make_from_string, - make_from_c, + make_from_c_pointer, make_from_cil note