aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/fopen.c
AgeCommit message (Collapse)Author
2019-06-05examples/fopen: fix comparisonMarcel Raad
As want is size_t, (file->buffer_pos - want) is unsigned, so checking if it's less than zero makes no sense. Check if file->buffer_pos is less than want instead to avoid the unsigned integer wraparound. Closes https://github.com/curl/curl/pull/3975
2018-04-15all: Refactor malloc+memset to use callocDaniel Gustafsson
When a zeroed out allocation is required, use calloc() rather than malloc() followed by an explicit memset(). The result will be the same, but using calloc() everywhere increases consistency in the codebase and avoids the risk of subtle bugs when code is injected between malloc and memset by accident. Closes https://github.com/curl/curl/pull/2497
2017-09-12code style: use space after semicolonDaniel Stenberg
2017-09-11code style: use spaces around plusesDaniel Stenberg
2017-09-11code style: use spaces around equals signsDaniel Stenberg
2017-04-30examples: declare TU-local variables staticMarcel Raad
This fixes missing-variable-declarations warnings when building with clang.
2017-03-28examples/fopen: checksrc complianceJay Satiro
2017-03-26spelling fixesklemens
Closes #1356
2016-11-24checksrc: code style: use 'char *name' styleDaniel Stenberg
2016-02-11examples: adhere to curl code styleDaniel Stenberg
All plain C examples now (mostly) adhere to the curl code style. While they are only examples, they had diverted so much and contained all sorts of different mixed code styles by now. Having them use a unified style helps users and readability. Also, as they get copy-and-pasted widely by users, making sure they're clean and nice is a good idea. 573 checksrc warnings were addressed.
2015-06-18examples: more descriptionsDaniel Stenberg
2015-06-08fopen.c: fix a few compiler warningsDaniel Stenberg
2015-06-08docs: Spelling fixesVille Skyttä
2015-03-16Bug #149: Deletion of unnecessary checks before calls of the function "free"Markus Elfring
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.0-rc24. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2014-11-19examples: Wait recommended 100ms when no file descriptors are readyJay Satiro
Prior to this change when no file descriptors were ready on platforms other than Windows the multi examples would sleep whatever was in timeout, which may or may not have been less than the minimum recommended value [1] of 100ms. [1]: http://curl.haxx.se/libcurl/c/curl_multi_fdset.html
2014-11-15examples: Don't call select() to sleep on windowsJay Satiro
Windows does not support using select() for sleeping without a dummy socket. Instead use Windows' Sleep() and sleep for 100ms which is the minimum suggested value in the curl_multi_fdset() doc. Prior to this change the multi examples would exit prematurely since select() would error instead of sleeping when called without an fd. Reported-by: Johan Lantz Bug: http://curl.haxx.se/mail/lib-2014-11/0221.html
2010-12-17example: fix compiler warnings in fopen.cDaniel Stenberg
2010-11-04fopen.c: re-indented, fixed previous mistakeDaniel Stenberg
I've made the code intended using curl-style now to look more like other examples. My previous "fix" was a bit too invasive but is now fixed again.
2010-11-04multi use: call multi_perform even on select() timeoutsDaniel Stenberg
2010-09-30multi & hiper examples: updates and cleanupsDirk Manske
all multi and hiper examples: * don't loop curl_multi_perform calls, that was <7.20.0 style, currently the exported multi functions will not return CURLM_CALL_MULTI_PERFORM all hiper examples: * renamed check_run_count to check_multi_info * don't compare current running handle count with previous value, this was the wrong way to check for finished requests, simply call curl_multi_info_read * it's also safe to call curl_multi_remove_handle inside the curl_multi_info_read loop. ghiper.c: * replaced curl_multi_socket (that function is marked as obsolete) calls with curl_multi_socket_action calls (as in hiperfifo.c and evhiperfifo.c) ghiper.c and evhiperfifo.c: * be smart as hiperfifo.c, don't do uncessary curl_multi_* calls in new_conn and main
2010-07-14examples: add curl_multi_timeoutConstantine Sapuntzakis
Make the multi-interface using examples use curl_multi_timeout to properly educate users how to do things.
2010-04-24test536: do not fail with threaded DNS resolverKamil Dudka
Also tweaked comments in certain examples using curl_multi_fdset().
2010-02-26spellchecked by Stéphane FillodDaniel Stenberg
2008-09-06remove unnecessary typecasting of malloc()Yang Tse
2008-08-31MSVC adjustmentYang Tse
2008-05-22Fixed a surprising number of example programs that were passing int argumentsDan Fandrich
to curl_easy_setopt instead of long.
2008-04-04Give a hint as to why a url_fopen failed.Dan Fandrich
2007-07-12Fixed some compile warnings and errors and improved portability in theDan Fandrich
examples. Removed ftp3rdparty.c since libcurl doesn't support 3rd party FTP transfers any longer.
2006-10-13Added comments about checking return code and the maxfd counterDaniel Stenberg
2004-11-22remove curl_ prefix from functions not present in libcurlDaniel Stenberg
2004-10-06removed tabs and trailing whitespace from sourceDaniel Stenberg
2003-12-08removed old version checksDaniel Stenberg
2003-12-08use the newer option namesDaniel Stenberg
2003-08-11Vincent Sanders's massive update of this example code. One could argueDaniel Stenberg
weather this is still an "example" or a whole new API layer! ;-)
2003-01-27made it workDaniel Stenberg
made it cause less compiler warnings made it require 7.9.7 to build
2002-05-13fopen.c added, a fopen() style emulation for URL readingDaniel Stenberg