aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/smooth-gtk-thread.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-02-11 09:42:38 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-02-11 09:44:45 +0100
commit3a6563d668406df1703edb4202afc038fcf9d30e (patch)
tree0fbb9438d99c13049f72b10c966583e582e4e238 /docs/examples/smooth-gtk-thread.c
parent936d8f07dfbf2ac22ffd216f5363152bcecc2651 (diff)
examples: adhere to curl code style
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.
Diffstat (limited to 'docs/examples/smooth-gtk-thread.c')
-rw-r--r--docs/examples/smooth-gtk-thread.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c
index b0d297a21..8756494c1 100644
--- a/docs/examples/smooth-gtk-thread.c
+++ b/docs/examples/smooth-gtk-thread.c
@@ -74,8 +74,7 @@ void *pull_one_url(void *NaN)
/* Stop threads from entering unless j is incremented */
pthread_mutex_lock(&lock);
- while ( j < num_urls )
- {
+ while(j < num_urls) {
printf("j = %d\n", j);
http =
@@ -85,11 +84,9 @@ void *pull_one_url(void *NaN)
printf( "http %s", http );
curl = curl_easy_init();
- if(curl)
- {
+ if(curl) {
- outfile = fopen(urls[j], "w");
- /* printf("fopen\n"); */
+ outfile = fopen(urls[j], "wb");
/* Set the URL and transfer type */
curl_easy_setopt(curl, CURLOPT_URL, http);
@@ -219,7 +216,7 @@ int main(int argc, char **argv)
g_signal_connect(G_OBJECT (top_window), "delete-event",
G_CALLBACK(cb_delete), NULL);
- if (!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0)
+ if(!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0)
g_warning("can't create the thread");
gtk_main();
@@ -228,4 +225,3 @@ int main(int argc, char **argv)
return 0;
}
-