summaryrefslogtreecommitdiff
path: root/lib/mime.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-05-11 23:40:58 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-05-21 23:21:47 +0200
commitcb529b713f4882ac65a074ae8d87faa41d19168e (patch)
treeb9f23f33a817107127020630c7b9b5764e8685f0 /lib/mime.c
parentf3d836b73601fc6d14cb917e1cd72f43b9056dff (diff)
downloadcurl-cb529b713f4882ac65a074ae8d87faa41d19168e.tar.gz
checksrc: make sure sizeof() is used *with* parentheses
... and unify the source code to adhere. Closes #2563
Diffstat (limited to 'lib/mime.c')
-rw-r--r--lib/mime.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/mime.c b/lib/mime.c
index 4c0d2eeba..7319b7caa 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -787,10 +787,10 @@ static size_t read_encoded_part_content(curl_mimepart *part,
st->bufbeg = 0;
st->bufend = len;
}
- if(st->bufend >= sizeof st->buf)
+ if(st->bufend >= sizeof(st->buf))
return cursize? cursize: READ_ERROR; /* Buffer full. */
sz = read_part_content(part, st->buf + st->bufend,
- sizeof st->buf - st->bufend);
+ sizeof(st->buf) - st->bufend);
switch(sz) {
case 0:
ateof = TRUE;
@@ -1220,7 +1220,7 @@ curl_mime *curl_mime_init(struct Curl_easy *easy)
{
curl_mime *mime;
- mime = (curl_mime *) malloc(sizeof *mime);
+ mime = (curl_mime *) malloc(sizeof(*mime));
if(mime) {
mime->easy = easy;
@@ -1247,7 +1247,7 @@ curl_mime *curl_mime_init(struct Curl_easy *easy)
/* Initialize a mime part. */
void Curl_mime_initpart(curl_mimepart *part, struct Curl_easy *easy)
{
- memset((char *) part, 0, sizeof *part);
+ memset((char *) part, 0, sizeof(*part));
part->easy = easy;
mimesetstate(&part->state, MIMESTATE_BEGIN, NULL);
}
@@ -1260,7 +1260,7 @@ curl_mimepart *curl_mime_addpart(curl_mime *mime)
if(!mime)
return NULL;
- part = (curl_mimepart *) malloc(sizeof *part);
+ part = (curl_mimepart *) malloc(sizeof(*part));
if(part) {
Curl_mime_initpart(part, mime->easy);
@@ -1670,7 +1670,7 @@ const char *Curl_mime_contenttype(const char *filename)
size_t len1 = strlen(filename);
const char *nameend = filename + len1;
- for(i = 0; i < sizeof ctts / sizeof ctts[0]; i++) {
+ for(i = 0; i < sizeof(ctts) / sizeof(ctts[0]); i++) {
size_t len2 = strlen(ctts[i].extension);
if(len1 >= len2 && strcasecompare(nameend - len2, ctts[i].extension))