]> granicus.if.org Git - curl/commitdiff
mime: replace 'struct Curl_mimepart' by 'curl_mimepart' in encoder code.
authorPatrick Monnerat <patrick@monnerat.net>
Tue, 5 Sep 2017 17:20:06 +0000 (18:20 +0100)
committerPatrick Monnerat <patrick@monnerat.net>
Tue, 5 Sep 2017 17:20:06 +0000 (18:20 +0100)
mime_state is now a typedef.

lib/mime.c
lib/mime.h

index 38a20ed2d32703df2045cb65da138223c01130c6..89fbfc81e28cee9110e477a6b0dc622d1e89fc53 100644 (file)
 
 /* Encoders. */
 static size_t encoder_nop_read(char *buffer, size_t size, bool ateof,
-                                struct Curl_mimepart *part);
-static curl_off_t encoder_nop_size(struct Curl_mimepart *part);
+                                curl_mimepart *part);
+static curl_off_t encoder_nop_size(curl_mimepart *part);
 static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
-                                struct Curl_mimepart *part);
+                                curl_mimepart *part);
 static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
-                                struct Curl_mimepart *part);
-static curl_off_t encoder_base64_size(struct Curl_mimepart *part);
+                                curl_mimepart *part);
+static curl_off_t encoder_base64_size(curl_mimepart *part);
 static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
-                              struct Curl_mimepart *part);
-static curl_off_t encoder_qp_size(struct Curl_mimepart *part);
+                              curl_mimepart *part);
+static curl_off_t encoder_qp_size(curl_mimepart *part);
 
 static const mime_encoder encoders[] = {
   {"binary", encoder_nop_read, encoder_nop_size},
@@ -266,8 +266,7 @@ static char *Curl_basename(char *path)
 
 
 /* Set readback state. */
-static void mimesetstate(struct mime_state *state,
-                         enum mimestate tok, void *ptr)
+static void mimesetstate(mime_state *state, enum mimestate tok, void *ptr)
 {
   state->state = tok;
   state->ptr = ptr;
@@ -355,7 +354,7 @@ static void cleanup_encoder_state(mime_encoder_state *p)
 
 /* Dummy encoder. This is used for 8bit and binary content encodings. */
 static size_t encoder_nop_read(char *buffer, size_t size, bool ateof,
-                               struct Curl_mimepart *part)
+                               curl_mimepart *part)
 {
   mime_encoder_state *st = &part->encstate;
   size_t insize = st->bufend - st->bufbeg;
@@ -370,7 +369,7 @@ static size_t encoder_nop_read(char *buffer, size_t size, bool ateof,
   return size;
 }
 
-static curl_off_t encoder_nop_size(struct Curl_mimepart *part)
+static curl_off_t encoder_nop_size(curl_mimepart *part)
 {
   return part->datasize;
 }
@@ -378,7 +377,7 @@ static curl_off_t encoder_nop_size(struct Curl_mimepart *part)
 
 /* 7bit encoder: the encoder is just a data validity check. */
 static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
-                                struct Curl_mimepart *part)
+                                curl_mimepart *part)
 {
   size_t i;
   mime_encoder_state *st = &part->encstate;
@@ -402,7 +401,7 @@ static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
 
 /* Base64 content encoder. */
 static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
-                                struct Curl_mimepart *part)
+                                curl_mimepart *part)
 {
   mime_encoder_state *st = &part->encstate;
   size_t cursize = 0;
@@ -474,7 +473,7 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
   return cursize;
 }
 
-static curl_off_t encoder_base64_size(struct Curl_mimepart *part)
+static curl_off_t encoder_base64_size(curl_mimepart *part)
 {
   curl_off_t size = part->datasize;
 
@@ -509,7 +508,7 @@ static int qp_lookahead_eol(mime_encoder_state *st, int ateof, size_t n)
 
 /* Quoted-printable encoder. */
 static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
-                              struct Curl_mimepart *part)
+                              curl_mimepart *part)
 {
   mime_encoder_state *st = &part->encstate;
   char *ptr = buffer;
@@ -610,7 +609,7 @@ static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
   return cursize;
 }
 
-static curl_off_t encoder_qp_size(struct Curl_mimepart *part)
+static curl_off_t encoder_qp_size(curl_mimepart *part)
 {
   /* Determining the size can only be done by reading the data: unless the
      data size is 0, we return it as unknown (-1). */
@@ -744,7 +743,7 @@ static void mime_namedfile_free(void *ptr)
 /* Argument is a pointer to the mime structure. */
 
 /* Readback a byte string segment. */
-static size_t readback_bytes(struct mime_state *state,
+static size_t readback_bytes(mime_state *state,
                              char *buffer, size_t bufsize,
                              const char *bytes, size_t numbytes,
                              const char *trail)
@@ -776,7 +775,7 @@ static size_t readback_bytes(struct mime_state *state,
 }
 
 /* Read a non-encoded part content. */
-static size_t read_part_content(struct Curl_mimepart *part,
+static size_t read_part_content(curl_mimepart *part,
                                 char *buffer, size_t bufsize)
 {
   size_t sz = 0;
@@ -787,7 +786,7 @@ static size_t read_part_content(struct Curl_mimepart *part,
 }
 
 /* Read and encode part content. */
-static size_t read_encoded_part_content(struct Curl_mimepart *part,
+static size_t read_encoded_part_content(curl_mimepart *part,
                                         char *buffer, size_t bufsize)
 {
   mime_encoder_state *st = &part->encstate;
index 5d2e9477b1c087cb6ae7a8c1b4d4580b5b04485d..0ca4f69c933af258b29eff6bd5020fb360d657d6 100644 (file)
@@ -79,11 +79,11 @@ typedef struct {
 }  mime_encoder_state;
 
 /* Mime readback state. */
-struct mime_state {
+typedef struct {
   enum mimestate state;       /* Current state token. */
   void *ptr;                  /* State-dependent pointer. */
   size_t offset;              /* State-dependent offset. */
-};
+}  mime_state;
 
 /* A mime multipart. */
 struct curl_mime_s {
@@ -92,7 +92,7 @@ struct curl_mime_s {
   curl_mimepart *firstpart;        /* First part. */
   curl_mimepart *lastpart;         /* Last part. */
   char *boundary;                  /* The part boundary. */
-  struct mime_state state;         /* Current readback state. */
+  mime_state state;                /* Current readback state. */
 };
 
 /* A mime part. */
@@ -116,7 +116,7 @@ struct curl_mimepart_s {
   curl_off_t origin;               /* Origin file offset. */
   curl_off_t datasize;             /* Expected data size. */
   unsigned int flags;              /* Flags. */
-  struct mime_state state;         /* Current readback state. */
+  mime_state state;                /* Current readback state. */
   const mime_encoder *encoder;     /* Content data encoder. */
   mime_encoder_state encstate;     /* Data encoder state. */
 };