cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curlopt_seekfunction

From: Biju N <bijuatapache_at_gmail.com>
Date: Mon, 3 Oct 2016 15:11:49 -0400

Probably my understanding is incorrect. When we make the function call "res
= curl_easy_setopt(d_curl, CURLOPT_SEEKDATA, userp);" will "userp" not get
initialized with a valid pointer value? Please let me know.

On Sun, Oct 2, 2016 at 2:07 PM, Colin Ngam <Colin.Ngam_at_quantum.com> wrote:

> Hi,
>
>
>
> Is userp ever initialized? As is, it is going to be garbage ..
>
>
>
> Thanks.
>
>
>
> Colin
>
>
>
> *From: *curl-library <curl-library-bounces_at_cool.haxx.se> on behalf of
> Biju N <bijuatapache_at_gmail.com>
> *Reply-To: *libcurl development <curl-library_at_cool.haxx.se>
> *Date: *Sunday, October 2, 2016 at 9:12 AM
> *To: *libcurl development <curl-library_at_cool.haxx.se>
> *Subject: *Re: curlopt_seekfunction
>
>
>
> Thanks Dan and Colin, A curl handler (d_curl) is used. Since I the
> original code is restricted, I had to type it myself to be make is more
> meaningful to ask the questions. Sorry about the typos.
>
>
>
> void* userp;
>
> res = curl_easy_setopt(d_curl, CURLOPT_SEEKDATA, userp);
>
> if (res != CURLE_OK)
>
> throw CurlError(res);
>
> res = curl_easy_setopt(d_curl, CURLOPT_SEEKFUNCTION, seek_callback);
>
> if (res != CURLE_OK)
>
> throw CurlError(res);
>
> int seek_callback(void *userp, curl_off_t offset, int origin){
>
> FILE* in = static_cast<FILE *>(userp);
>
> long f_offset = (long) offset;
>
> int ret = fseek(in, f_offset, origin);
>
> return ret;
>
> }
>
>
>
> On Sat, Oct 1, 2016 at 1:35 AM, Dan Fandrich <dan_at_coneharvesters.com>
> wrote:
>
> On Fri, Sep 30, 2016 at 11:39:26PM +0000, Colin Ngam wrote:
> > Hi,
> >
> >
> >
> > Why are you using *userp as a curl handle?
> >
> >
> >
> > CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
>
> Indeed. And even if it is a curl handle (you didn't show that part of your
> code), then it makes no sense to use it as a FILE* handle.
>
> res = curl_easy_setopt(d_curl, CURLOPT_SEEKDATA, *userp);
>
> >>> Dan
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__cool.haxx.se_list_listinfo_curl-2Dlibrary&d=DQMFaQ&c=8S5idjlO_n28Ko3lg6lskTMwneSC-WqZ5EBTEEvDlkg&r=GgZxxOrjo7rUSi2a3aY7DXfeWcIXQ3Xn4a7ByYeR4wA&m=jmQkuO8zrhcl5GQHnAyY0uGrRg8G4yGcQnZ5rFv_iCM&s=7zWNxug_bKu6n4lI4EAqdXQCYA_XcDz9hqDu4pQW1i0&e=>
> Etiquette: https://curl.haxx.se/mail/etiquette.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__curl.haxx.se_mail_etiquette.html&d=DQMFaQ&c=8S5idjlO_n28Ko3lg6lskTMwneSC-WqZ5EBTEEvDlkg&r=GgZxxOrjo7rUSi2a3aY7DXfeWcIXQ3Xn4a7ByYeR4wA&m=jmQkuO8zrhcl5GQHnAyY0uGrRg8G4yGcQnZ5rFv_iCM&s=zIgEXxuu82rMPz53anoQcJRyDpc5mibnnbid3XgWpOM&e=>
>
>
> ------------------------------
> The information contained in this transmission may be confidential. Any
> disclosure, copying, or further distribution of confidential information is
> not permitted unless such privilege is explicitly granted in writing by
> Quantum. Quantum reserves the right to have electronic communications,
> including email and attachments, sent across its networks filtered through
> anti virus and spam software programs and retain such messages in order to
> comply with applicable data security and retention requirements. Quantum is
> not responsible for the proper and complete transmission of the substance
> of this communication or for any delay in its receipt.
>
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-10-03