fun easy_setopt(opt: CURLOption, obj: Object): CURLCode
do
if obj isa Int then return native_setopt_int(opt, obj)
- if obj isa Bool and obj == true then return native_setopt_int(opt, 1)
- if obj isa Bool and obj == false then return native_setopt_int(opt, 0)
+ if obj == true then return native_setopt_int(opt, 1)
+ if obj == false then return native_setopt_int(opt, 0)
if obj isa String then return native_setopt_string(opt, obj)
if obj isa FileWriter then return native_setopt_file(opt, obj._file.as(not null))
if obj isa CURLSList then return native_setopt_slist(opt, obj)
`}
# Convert given string to URL encoded string
- fun escape(url: String): String import String.to_cstring, CString.to_s_with_copy `{
+ fun escape(url: String): String import String.to_cstring, CString.to_s `{
char *orig_url, *encoded_url = NULL;
orig_url = String_to_cstring(url);
encoded_url = curl_easy_escape( self, orig_url, strlen(orig_url));
- String b_url = CString_to_s_with_copy(encoded_url);
+ String b_url = CString_to_s(encoded_url);
curl_free(encoded_url);
return b_url;
`}
fun is_valid_protocol: Bool `{ return self == CURLE_UNSUPPORTED_PROTOCOL; `}
fun is_valid_init: Bool `{ return self == CURLE_FAILED_INIT; `}
fun to_i: Int do return code end
- redef fun to_s import CString.to_s_with_copy `{
+ redef fun to_s import CString.to_s `{
char *c = (char*)curl_easy_strerror(self);
- return CString_to_s_with_copy(c);
+ return CString_to_s(c);
`}
end
var r = new Array[String]
var cursor = self
loop
- if native_data_reachable(cursor) != true then break
+ if not native_data_reachable(cursor) then break
r.add(native_data(cursor))
cursor = native_next(cursor)
end