in src/generic/formdata.c [454:496]
int mimeSplitIsBoundary(Tcl_Obj * cur, Tcl_Obj * prev,
const char *boundary, int *isLast)
{
int bLen = 0;
int cLen = 0;
int pLen = 0;
char *line = NULL;
if ((cur == NULL) || (boundary == NULL))
return TCL_ERROR;
/* check for CR on prev line */
if (prev != NULL) {
line = Tcl_GetStringFromObj(prev, &pLen);
if (pLen > 0)
if (line[pLen - 1] != '\r')
return TCL_ERROR;
}
bLen = strlen(boundary);
line = Tcl_GetStringFromObj(cur, &cLen);
*isLast = TCL_ERROR;
/* printf("DBG mimeSplitIsBoundary - checking %s\n",line); fflush(stdout); */
if (cLen >= 2 + bLen)
if (strncmp(line, "--", 2) == 0)
if (strncmp(&(line[2]), boundary, bLen) == 0) {
if (cLen >= (4 + bLen))
if (strncmp(&(line[2 + bLen]), "--", 2) == 0)
*isLast = TCL_OK;
if (prev != NULL) {
/* cut CR from line if it was a boundary */
Tcl_SetObjLength(prev, pLen - 1);
}
return TCL_OK;
}
return TCL_ERROR;
}