Yang Tse | 1 Sep 2008 02:05
Picon

Re: yangtse: curl/docs/examples 10-at-a-time.c, 1.7, 1.8 anyauthput.c, 1.6, 1.7 fopen.c, 1.11, 1.12 ftpuploadresume.c, 1.4, 1.5

2008/8/31, Gisle Vanem wrote:

> > --- anyauthput.c 22 May 2008 21:20:08 -0000 1.6
> > +++ anyauthput.c 31 Aug 2008 12:12:35 -0000 1.7
> >
> ...
> > +#ifdef _MSC_VER
> > +#  ifdef _WIN64
> > +     typedef __int64 intptr_t;
> > +#  else
> > +     typedef int intptr_t;
> > +#  endif
> > +#endif
> >
>
> How about using 'LONG_PTR'? I should have the correct size on
> Win32/Win64.

Hmmm. I didn't inspect enough the source of that example. It failed to
compile with MSVC due to the lack of 'intptr_t', and I simply provided
a valid definition of it for MSVC.

But, as you have noticed intptr_t is being used in that example
assuming size characteristics of that data type that actually it
doesn't have.

As you point out, it could simply use (long *) or maybe even better
just (void *)

--

-- 
(Continue reading)

Daniel Stenberg | 1 Sep 2008 10:51
Picon
Favicon
Gravatar

Re: A HTTPPOST question

On Sun, 31 Aug 2008, Serge Skorokhodov wrote:

>> You can free the entire post with curl_formfree() after the
>> curl_easy_perform() call. But you need to make sure that you either set
>> another request method or set a new formpost in the handle before you call
>> curl_easy_perform() again on the same handle.
>>
> Thanks, it is. I've looked into the code briefly and it seems that 
> curl_easy_reset should be sufficient. Is it? Or is it better to set GET 
> method?

You can do either way. curl_easy_reset() will reset all options back to 
default state, but you only _need_ to set the method back to GET.

--

-- 

  / daniel.haxx.se

bennacer hanane | 1 Sep 2008 15:45
Picon
Favicon

hello

 
hello, I try to incorporate a new option in cURL.

 
ie I want to see the contents of the output of the curl in a file archiving warc.


I need to know exactly where I can find the function  that allows me to add the option and its treatment.

thanks

Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
Yang Tse | 1 Sep 2008 15:54
Picon

Re: yangtse: curl/docs/examples 10-at-a-time.c, 1.7, 1.8 anyauthput.c, 1.6, 1.7 fopen.c, 1.11, 1.12 ftpuploadresume.c, 1.4, 1.5

2008/8/31, Gisle Vanem wrote:

> > --- anyauthput.c 22 May 2008 21:20:08 -0000 1.6
> > +++ anyauthput.c 31 Aug 2008 12:12:35 -0000 1.7
> >
> ...
> > +#ifdef _MSC_VER
> > +#  ifdef _WIN64
> > +     typedef __int64 intptr_t;
> > +#  else
> > +     typedef int intptr_t;
> > +#  endif
> > +#endif
> >
>
> How about using 'LONG_PTR'? I should have the correct size on
> Win32/Win64.

Gisle,

Discard what I've said in previous post in this thread.  Stepping back
and leaving something alone for a good while lets you see things more
clearly. ;-)

What was committed to CVS is appropriate 'as is', no need to change
anything. What rules here is the sizeof(void *) which under _WIN64 is
8 and under _WIN32 is 4. So, the introduced change for MSVC is
appropriate for both _WIN64 and _WIN32, and allows compilation under
MSVC without an intptr_t.

If the example should be using in some points a pointer to FILE
instead of a pointer to file descriptor and later using fileno() is
something I don't know. It much depends on the intention of example
author.

--

-- 
-=[Yang]=-

Daniel Stenberg | 1 Sep 2008 15:54
Picon
Favicon
Gravatar

Re: hello

On Mon, 1 Sep 2008, bennacer hanane wrote:

>  ie I want to see the contents of the output of the curl in a file archiving 
> warc.

warc as in web archive warc? Why would that be incorporated into libcurl? It 
seems such an obvious thing for the app to deal with, not the library...

> I need to know exactly where I can find the function  that allows me to add 
> the option and its treatment.

lib/url.c:Curl_setopt() should be a starting point.

--

-- 

  / daniel.haxx.se
Daniel Stenberg | 1 Sep 2008 15:59
Picon
Favicon
Gravatar

Re: yangtse: curl/docs/examples 10-at-a-time.c, 1.7, 1.8 anyauthput.c, 1.6, 1.7 fopen.c, 1.11, 1.12 ftpuploadresume.c, 1.4, 1.5

On Mon, 1 Sep 2008, Yang Tse wrote:

> If the example should be using in some points a pointer to FILE instead of a 
> pointer to file descriptor and later using fileno() is something I don't 
> know. It much depends on the intention of example author.

We need to keep in mind that the purpose of the examples is to show how to use 
libcurl. I therefore think we can leave some leeway in some of the portability 
areas in the cases where the real solution is large and the "good enough" 
solution is smallish.

This is meant as a general comment, not really pointing out these particular 
changes as I haven't reviewed them in detail.

--

-- 

  / daniel.haxx.se

bennacer hanane | 1 Sep 2008 16:25
Picon
Favicon

Hello

I started to read the source code of main() and I think that the treatment option is a function opererate(), but I do not know at what level

thinks..


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
Daniel Stenberg | 1 Sep 2008 16:31
Picon
Favicon
Gravatar

Re: Hello

On Mon, 1 Sep 2008, bennacer hanane wrote:

Really, this is the second mail with "Hello" as subject which was bad already 
in your first mail. Please use something sensible to allow us to get a clue 
about what the mail is about!

> I started to read the source code of main() and I think that the treatment 
> option is a function opererate(), but I do not know at what level

main() and operate() are functions in the curl tool, not in libcurl.

And didn't I already answer? If that wasn't good enough, can you then please 
aks specific questions about what isn't clear?

--

-- 

  / daniel.haxx.se

Gisle Vanem | 1 Sep 2008 17:53
Picon
Gravatar

Re: yangtse: curl/docs/examples 10-at-a-time.c, 1.7, 1.8 anyauthput.c, 1.6, 1.7 fopen.c, 1.11, 1.12 ftpuploadresume.c, 1.4, 1.5

"Yang Tse" <yangsita <at> gmail.com> wrote:

> What was committed to CVS is appropriate 'as is', no need to change
> anything. What rules here is the sizeof(void *) which under _WIN64 is
> 8 and under _WIN32 is 4.

I know. Hence my suggestion to use 'ULONG_PTR' to reduce the
#ifdef clutter.

--gv

Yang Tse | 1 Sep 2008 19:34
Picon

Re: yangtse: curl/docs/examples 10-at-a-time.c, 1.7, 1.8 anyauthput.c, 1.6, 1.7 fopen.c, 1.11, 1.12 ftpuploadresume.c, 1.4, 1.5

2008/9/1, Gisle Vanem wrote:

> > What was committed to CVS is appropriate 'as is', no need to change
> > anything. What rules here is the sizeof(void *) which under _WIN64 is
> > 8 and under _WIN32 is 4.
> >
>
> I know. Hence my suggestion to use 'ULONG_PTR' to reduce the
> #ifdef clutter.

'long' is still 4 bytes wide under _WIN64 even when void pointers are
8 bytes wide. So maybe what you are suggesting is doing the following
?

Index: docs/examples/anyauthput.c
===================================================================
RCS file: /cvsroot/curl/curl/docs/examples/anyauthput.c,v
retrieving revision 1.7
diff -u -r1.7 anyauthput.c
--- docs/examples/anyauthput.c  31 Aug 2008 12:12:35 -0000      1.7
+++ docs/examples/anyauthput.c  1 Sep 2008 17:30:35 -0000
 <at>  <at>  -20,11 +20,7  <at>  <at> 
 #include <sys/stat.h>

 #ifdef _MSC_VER
-#  ifdef _WIN64
-     typedef __int64 intptr_t;
-#  else
-     typedef int intptr_t;
-#  endif
+#  define INT_PTR intptr_t
 #endif

 #include <curl/curl.h>

--

-- 
-=[Yang]=-


Gmane