summaryrefslogtreecommitdiffabout
path: root/lib/curl.cc
authorMichael Krelin <hacker@klever.net>2007-11-26 21:14:28 (UTC)
committer Michael Krelin <hacker@klever.net>2007-11-26 21:14:28 (UTC)
commit34dcd4dd9af494eab2f6e47498c270d27954bf19 (patch) (side-by-side diff)
tree19eeac758bf09905e9e55a24fa2494930ee5c890 /lib/curl.cc
parentd788db9c490575e63506ce502a2f089eaaa624ee (diff)
downloadlibopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.zip
libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.gz
libopkele-34dcd4dd9af494eab2f6e47498c270d27954bf19.tar.bz2
encapsulated write functionality into curl_t
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'lib/curl.cc') (more/less context) (show whitespace changes)
-rw-r--r--lib/curl.cc12
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
@@ -37,6 +37,18 @@ namespace opkele {
return r;
}
+ static size_t _write(void *p,size_t s,size_t nm,void *stream) {
+ return ((curl_t*)stream)->write(p,s,nm);
+ }
+
+ CURLcode curl_t::set_write() {
+ assert(_c);
+ CURLcode r;
+ (r = easy_setopt(CURLOPT_WRITEDATA,this))
+ || (r = easy_setopt(CURLOPT_WRITEFUNCTION,_write));
+ return r;
+ }
+
}
}