MEDIUM: chunks: make the chunk struct's fields match the buffer struct

Chunks are only a subset of a buffer (a non-wrapping version with no head
offset). Despite this we still carry a lot of duplicated code between
buffers and chunks. Replacing chunks with buffers would significantly
reduce the maintenance efforts. This first patch renames the chunk's
fields to match the name and types used by struct buffers, with the goal
of isolating the code changes from the declaration changes.

Most of the changes were made with spatch using this coccinelle script :

  @rule_d1@
  typedef chunk;
  struct chunk chunk;
  @@
  - chunk.str
  + chunk.area

  @rule_d2@
  typedef chunk;
  struct chunk chunk;
  @@
  - chunk.len
  + chunk.data

  @rule_i1@
  typedef chunk;
  struct chunk *chunk;
  @@
  - chunk->str
  + chunk->area

  @rule_i2@
  typedef chunk;
  struct chunk *chunk;
  @@
  - chunk->len
  + chunk->data

Some minor updates to 3 http functions had to be performed to take size_t
ints instead of ints in order to match the unsigned length here.
diff --git a/src/cli.c b/src/cli.c
index 0bc4722..4440f25 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -117,7 +117,7 @@
 	}
 	chunk_init(&out, NULL, 0);
 	chunk_dup(&out, tmp);
-	dynamic_usage_msg = out.str;
+	dynamic_usage_msg = out.area;
 
 end:
 	if (dynamic_usage_msg) {
@@ -403,8 +403,8 @@
 	appctx->st2 = 0;
 	memset(&appctx->ctx.cli, 0, sizeof(appctx->ctx.cli));
 
-	p = appctx->chunk->str;
-	end = p + appctx->chunk->len;
+	p = appctx->chunk->area;
+	end = p + appctx->chunk->data;
 
 	/*
 	 * Get the payload start if there is one.
@@ -454,7 +454,7 @@
 		i++;
 	}
 	/* fill unused slots */
-	p = appctx->chunk->str + appctx->chunk->len;
+	p = appctx->chunk->area + appctx->chunk->data;
 	for (; i < MAX_STATS_ARGS + 1; i++)
 		args[i] = p;
 
@@ -500,7 +500,7 @@
 	}
 	chunk_appendf(tmp, "%s", msg);
 
-	return ci_putblk(chn, tmp->str, strlen(tmp->str));
+	return ci_putblk(chn, tmp->area, strlen(tmp->area));
 }
 
 /* This I/O handler runs as an applet embedded in a stream interface. It is
@@ -557,7 +557,7 @@
 				}
 			}
 
-			str = appctx->chunk->str + appctx->chunk->len;
+			str = appctx->chunk->area + appctx->chunk->data;
 
 			/* ensure we have some output room left in the event we
 			 * would want to return some info right after parsing.
@@ -568,7 +568,8 @@
 			}
 
 			/* '- 1' is to ensure a null byte can always be inserted at the end */
-			reql = co_getline(si_oc(si), str, appctx->chunk->size - appctx->chunk->len - 1);
+			reql = co_getline(si_oc(si), str,
+					  appctx->chunk->size - appctx->chunk->data - 1);
 			if (reql <= 0) { /* closed or EOL not found */
 				if (reql == 0)
 					break;
@@ -607,12 +608,12 @@
 				len--;
 
 			str[len] = '\0';
-			appctx->chunk->len += len;
+			appctx->chunk->data += len;
 
 			if (appctx->st1 & APPCTX_CLI_ST1_PAYLOAD) {
-				appctx->chunk->str[appctx->chunk->len] = '\n';
-				appctx->chunk->str[appctx->chunk->len + 1] = 0;
-				appctx->chunk->len++;
+				appctx->chunk->area[appctx->chunk->data] = '\n';
+				appctx->chunk->area[appctx->chunk->data + 1] = 0;
+				appctx->chunk->data++;
 			}
 
 			appctx->st0 = CLI_ST_PROMPT;
@@ -621,8 +622,8 @@
 				/* empty line */
 				if (!len) {
 					/* remove the last two \n */
-					appctx->chunk->len -= 2;
-					appctx->chunk->str[appctx->chunk->len] = 0;
+					appctx->chunk->data -= 2;
+					appctx->chunk->area[appctx->chunk->data] = 0;
 
 					if (!cli_parse_request(appctx))
 						cli_gen_usage_msg(appctx);
@@ -641,7 +642,7 @@
 				 * Its location is not remembered here, this is just to switch
 				 * to a gathering mode.
 				 */
-				if (!strcmp(appctx->chunk->str + appctx->chunk->len - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN))
+				if (!strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN))
 					appctx->st1 |= APPCTX_CLI_ST1_PAYLOAD;
 				else {
 					/* no payload, the command is complete: parse the request */
@@ -705,7 +706,7 @@
 					 * when entering a payload with interactive mode, change the prompt
 					 * to emphasize that more data can still be sent
 					 */
-					if (appctx->chunk->len && appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)
+					if (appctx->chunk->data && appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)
 						prompt = "+ ";
 					else
 						prompt = "\n> ";
@@ -1053,7 +1054,7 @@
 								}
 							}
 							/* replace the latest comma by a newline */
-							trash.str[trash.len-1] = '\n';
+							trash.area[trash.data-1] = '\n';
 
 						} else {
 							chunk_appendf(&trash, "all\n");