aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2019-05-25 10:06:08 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2019-06-05 20:38:06 +0200
commite23c52b3295a525fbaae9e7ed3e7061fea6dffc2 (patch)
tree4a74cf5ed3496a6126f1cc7c4284b6620108db06 /docs/examples
parent04ac54e1965041684fc1b6532eba90f58601264e (diff)
build: fix Codacy warnings
Reduce variable scopes and remove redundant variable stores. Closes https://github.com/curl/curl/pull/3975
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/ftp-wildcard.c4
-rw-r--r--docs/examples/synctime.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/docs/examples/ftp-wildcard.c b/docs/examples/ftp-wildcard.c
index f249bc135..ee815973d 100644
--- a/docs/examples/ftp-wildcard.c
+++ b/docs/examples/ftp-wildcard.c
@@ -41,8 +41,6 @@ static size_t write_it(char *buff, size_t size, size_t nmemb,
int main(int argc, char **argv)
{
- int rc = CURLE_OK;
-
/* curl easy handle */
CURL *handle;
@@ -50,7 +48,7 @@ int main(int argc, char **argv)
struct callback_data data = { 0 };
/* global initialization */
- rc = curl_global_init(CURL_GLOBAL_ALL);
+ int rc = curl_global_init(CURL_GLOBAL_ALL);
if(rc)
return rc;
diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c
index 905f51189..0113007c8 100644
--- a/docs/examples/synctime.c
+++ b/docs/examples/synctime.c
@@ -137,7 +137,6 @@ size_t SyncTime_CURL_WriteOutput(void *ptr, size_t size, size_t nmemb,
size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
void *stream)
{
- int i, RetVal;
char TmpStr1[26], TmpStr2[26];
(void)stream;
@@ -156,11 +155,13 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
TmpStr1 & 2? */
AutoSyncTime = 0;
else {
- RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
- TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
- &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);
+ int RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
+ TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
+ &SYSTime.wHour, &SYSTime.wMinute,
+ &SYSTime.wSecond);
if(RetVal == 7) {
+ int i;
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
for(i = 0; i<12; i++) {
if(strcmp(MthStr[i], TmpStr2) == 0) {