← Commit list

af274feabf

Daniel Stenberg
Daniel Stenberg
2026-01-16
SUCCESS Duration: 353s

Subject

lib: use STRCONST() when possible in curlx_strcopy() calls

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/hsts.c+1 -1
@@ -294,7 +294,7 @@ static CURLcode hsts_push(struct Curl_easy *data,
stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
}
else
- curlx_strcopy(e.expire, sizeof(e.expire), UNLIMITED, strlen(UNLIMITED));
+ curlx_strcopy(e.expire, sizeof(e.expire), STRCONST(UNLIMITED));
sc = data->set.hsts_write(data, &e, i, data->set.hsts_write_userp);
*stop = (sc != CURLSTS_OK);
lib/imap.c+1 -1
@@ -1966,7 +1966,7 @@ static CURLcode imap_connect(struct Curl_easy *data, bool *done)
imap_state(data, imapc, IMAP_SERVERGREET);
/* Start off with an response id of '*' */
- curlx_strcopy(imapc->resptag, sizeof(imapc->resptag), "*", 1);
+ curlx_strcopy(imapc->resptag, sizeof(imapc->resptag), STRCONST("*"));
result = imap_multi_statemach(data, done);
lib/mime.c+1 -1
@@ -573,7 +573,7 @@ static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
}
}
if(softlinebreak) {
- curlx_strcopy(buf, sizeof(buf), "\x3D\x0D\x0A", 3); /* "=\r\n" */
+ curlx_strcopy(buf, sizeof(buf), STRCONST("\x3D\x0D\x0A")); /* =\r\n */
len = 3;
consumed = 0;
}
lib/progress.c+2 -2
@@ -43,7 +43,7 @@ UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
{
curl_off_t h;
if(seconds <= 0) {
- curlx_strcopy(r, rsize, " ", 7);
+ curlx_strcopy(r, rsize, STRCONST(" "));
return;
}
h = seconds / 3600;
@@ -76,7 +76,7 @@ UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
if(y <= 99999)
curl_msnprintf(r, rsize, "%6" FMT_OFF_T "y", y);
else
- curlx_strcopy(r, rsize, ">99999y", 7);
+ curlx_strcopy(r, rsize, STRCONST(">99999y"));
}
}
}
lib/strerror.c+4 -4
@@ -656,12 +656,12 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen)
else
curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err);
}
-#else
+#else /* !CURL_DISABLE_VERBOSE_STRINGS */
+ (void)txt;
if(err == SEC_E_OK)
- txt = "No error";
+ curlx_strcopy(buf, buflen, STRCONST("No error"));
else
- txt = "Error";
- curlx_strcopy(buf, buflen, txt, strlen(txt));
+ curlx_strcopy(buf, buflen, STRCONST("Error"));
#endif
if(errno != old_errno)