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
This commit is contained in:
manus
2009-02-04 01:05:57 +00:00
parent 2f1e4e561b
commit 925fdcd979
4 changed files with 92 additions and 11 deletions

79
cURL-safe.ecf Normal file
View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-4-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-4-0 http://www.eiffel.com/developers/xml/configuration-1-4-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>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).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" is_void_safe="true" syntax_level="1" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="wel" location="$ISE_LIBRARY\library\wel\wel-safe.ecf"/>
<cluster name="curl" location=".\" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<condition>
<platform excluded_value="windows"/>
</condition>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -35,16 +35,17 @@ feature -- Command
-- Redefine -- Redefine
local local
l_c_string: C_STRING l_c_string: C_STRING
l_string: CURL_STRING
l_identified: IDENTIFIED l_identified: IDENTIFIED
do do
Result := a_size * a_nmemb 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 create l_identified
l_string ?= l_identified.id_object (a_object_id.to_integer_32) if {l_string: CURL_STRING} l_identified.id_object (a_object_id.to_integer_32) then
check not_void: l_string /= Void end
l_string.append (l_c_string.string) l_string.append (l_c_string.string)
else
check False end
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 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 local
l_c_string: C_STRING l_c_string: C_STRING
do 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) print ("%N" + a_text + "%N" + l_c_string.string)
end end

View File

@@ -145,8 +145,9 @@ feature -- Special setting
curl_function: CURL_FUNCTION curl_function: CURL_FUNCTION
-- cURL functions in curl_easy_setopt. -- cURL functions in curl_easy_setopt.
do do
Result := internal_curl_function if {l_curl_function: like curl_function} internal_curl_function then
if Result = Void then Result := l_curl_function
else
create {CURL_DEFAULT_FUNCTION} Result.make create {CURL_DEFAULT_FUNCTION} Result.make
internal_curl_function := Result internal_curl_function := Result
end end
@@ -197,7 +198,7 @@ feature -- Special setting
feature {NONE} -- Implementation feature {NONE} -- Implementation
internal_curl_function: CURL_FUNCTION internal_curl_function: ?CURL_FUNCTION
-- cURL functions. -- cURL functions.
api_loader: API_LOADER api_loader: API_LOADER

View File

@@ -31,7 +31,7 @@ create
make_empty, make_empty,
make_filled, make_filled,
make_from_string, make_from_string,
make_from_c, make_from_c_pointer,
make_from_cil make_from_cil
note note