author | Michael Krelin <hacker@klever.net> | 2007-11-26 21:14:28 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-11-26 21:14:28 (UTC) |
commit | 34dcd4dd9af494eab2f6e47498c270d27954bf19 (patch) (unidiff) | |
tree | 19eeac758bf09905e9e55a24fa2494930ee5c890 /lib/curl.cc | |
parent | d788db9c490575e63506ce502a2f089eaaa624ee (diff) | |
download | libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.zip libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.gz libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.bz2 |
encapsulated write functionality into curl_t
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/curl.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/curl.cc b/lib/curl.cc index 418aa79..3e69b47 100644 --- a/lib/curl.cc +++ b/lib/curl.cc | |||
@@ -36,7 +36,19 @@ namespace opkele { | |||
36 | ; | 36 | ; |
37 | return r; | 37 | return r; |
38 | } | 38 | } |
39 | 39 | ||
40 | static size_t _write(void *p,size_t s,size_t nm,void *stream) { | ||
41 | return ((curl_t*)stream)->write(p,s,nm); | ||
42 | } | ||
43 | |||
44 | CURLcode curl_t::set_write() { | ||
45 | assert(_c); | ||
46 | CURLcode r; | ||
47 | (r = easy_setopt(CURLOPT_WRITEDATA,this)) | ||
48 | || (r = easy_setopt(CURLOPT_WRITEFUNCTION,_write)); | ||
49 | return r; | ||
50 | } | ||
51 | |||
40 | } | 52 | } |
41 | 53 | ||
42 | } | 54 | } |