diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2007-07-12 21:11:10 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2007-07-12 21:11:10 +0000 |
commit | 49ce3e5160a9576e797bf87cef012b09d1c54ecb (patch) | |
tree | 9b8e476de272cfd92bb3d857aa3c6eef273140b7 /docs/examples/fopen.c | |
parent | 4a728747e6f8845e500910e397dfc99aaf4a7984 (diff) |
Fixed some compile warnings and errors and improved portability in the
examples.
Removed ftp3rdparty.c since libcurl doesn't support 3rd party FTP transfers
any longer.
Diffstat (limited to 'docs/examples/fopen.c')
-rw-r--r-- | docs/examples/fopen.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c index de235bbc4..7c50b0cc6 100644 --- a/docs/examples/fopen.c +++ b/docs/examples/fopen.c @@ -70,7 +70,7 @@ struct fcurl_data typedef struct fcurl_data URL_FILE; /* exported functions */ -URL_FILE *url_fopen(char *url,const char *operation); +URL_FILE *url_fopen(const char *url,const char *operation); int url_fclose(URL_FILE *file); int url_feof(URL_FILE *file); size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file); @@ -93,11 +93,11 @@ write_callback(char *buffer, URL_FILE *url = (URL_FILE *)userp; size *= nitems; - rembuff=url->buffer_len - url->buffer_pos;//remaining space in buffer + rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */ if(size > rembuff) { - //not enuf space in buffer + /* not enough space in buffer */ newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff)); if(newbuff==NULL) { @@ -211,7 +211,7 @@ use_buffer(URL_FILE *file,int want) URL_FILE * -url_fopen(char *url,const char *operation) +url_fopen(const char *url,const char *operation) { /* this code could check for URLs or types in the 'url' and basicly use the real fopen() for standard files */ @@ -236,7 +236,7 @@ url_fopen(char *url,const char *operation) curl_easy_setopt(file->handle.curl, CURLOPT_URL, url); curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file); - curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, FALSE); + curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0); curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback); if(!multi_handle) @@ -466,7 +466,7 @@ main(int argc, char *argv[]) int nread; char buffer[256]; - char *url; + const char *url; if(argc < 2) { @@ -481,7 +481,7 @@ main(int argc, char *argv[]) outf=fopen("fgets.test","w+"); if(!outf) { - perror("couldnt open fgets output file\n"); + perror("couldn't open fgets output file\n"); return 1; } @@ -508,7 +508,7 @@ main(int argc, char *argv[]) outf=fopen("fread.test","w+"); if(!outf) { - perror("couldnt open fread output file\n"); + perror("couldn't open fread output file\n"); return 1; } @@ -533,7 +533,7 @@ main(int argc, char *argv[]) outf=fopen("rewind.test","w+"); if(!outf) { - perror("couldnt open fread output file\n"); + perror("couldn't open fread output file\n"); return 1; } |