rem: if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error)) { const char *id, *type, *options; size_t size, n; if (!soap->dime.ptr) return soap->error; id = soap->dime.id; type = soap->dime.type; options = soap->dime.options; for (;;) { size = soap->dime.size; for (;;) { n = soap->buflen - soap->bufidx; if (size < n) n = size; if ((soap->error = soap->fdimewrite(soap, (void*)soap->dime.ptr, soap->buf + soap->bufidx, n))) break; size -= n; if (!size) { soap->bufidx += n; break; } if (soap_recv(soap)) { soap->error = SOAP_EOF; goto end; } } if (soap_move(soap, -(long)soap->dime.size&3)) { soap->error = SOAP_EOF; break; } if (!(soap->dime.flags & SOAP_DIME_CF)) break; if (soap_getdimehdr(soap)) break; } end: if (soap->fdimewriteclose) soap->fdimewriteclose(soap, (void*)soap->dime.ptr); soap->dime.size = 0; soap->dime.id = id; soap->dime.type = type; soap->dime.options = options; } else if (soap->dime.flags & SOAP_DIME_CF) { const char *id, *type, *options; register soap_wchar c; register char *s; register int i; id = soap->dime.id; type = soap->dime.type; options = soap->dime.options; if (soap_new_block(soap)) return SOAP_EOM; for (;;) { s = (char*)soap_push_block(soap, soap->dime.size); if (!s) return soap->error = SOAP_EOM; for (i = soap->dime.size; i > 0; i--) { if ((int)(c = soap_get1(soap)) == EOF) return soap->error = SOAP_EOF; *s++ = (char)c; } if (soap_move(soap, -(long)soap->dime.size&3)) return soap->error = SOAP_EOF; if (!(soap->dime.flags & SOAP_DIME_CF)) break; if (soap_getdimehdr(soap)) return soap->error; } soap->dime.size = soap->blist->size++;  if (!(soap->dime.ptr = soap_save_block(soap, NULL, 0))) return soap->error; soap->dime.ptr[soap->dime.size] = '\0';  soap->dime.id = id; soap->dime.type = type; soap->dime.options = options; } else soap->dime.ptr = soap_getdimefield(soap, soap->dime.size); content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size); if (!content) return soap->error = SOAP_EOM; content->id = soap->dime.id; content->type = soap->dime.type; content->options = soap->dime.options; return soap->error;
add: return soap->error = SOAP_OK;
context: soap_getdime(struct soap *soap){ struct soap_multipart *content;  if (soap_getdimehdr(soap))    return soap->error;  if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error))  { const char *id, *type, *options;    size_t size, n;    if (!soap->dime.ptr)      return soap->error;    id = soap->dime.id;    type = soap->dime.type;    options = soap->dime.options;    for (;;)    { size = soap->dime.size;      for (;;)      { n = soap->buflen - soap->bufidx;        if (size < n)          n = size;        if ((soap->error = soap->fdimewrite(soap, (void*)soap->dime.ptr, soap->buf + soap->bufidx, n)))          break;	size -= n;	if (!size)	{ soap->bufidx += n;	  break;	}	if (soap_recv(soap))        { soap->error = SOAP_EOF;	  goto end;        }      }      if (soap_move(soap, -(long)soap->dime.size&3))      { soap->error = SOAP_EOF;	break;      }      if (!(soap->dime.flags & SOAP_DIME_CF))        break;      if (soap_getdimehdr(soap))        break;    }end:    if (soap->fdimewriteclose)      soap->fdimewriteclose(soap, (void*)soap->dime.ptr);    soap->dime.size = 0;    soap->dime.id = id;    soap->dime.type = type;    soap->dime.options = options;  }  else if (soap->dime.flags & SOAP_DIME_CF)  { const char *id, *type, *options;    register soap_wchar c;    register char *s;    register int i;    id = soap->dime.id;    type = soap->dime.type;    options = soap->dime.options;    if (soap_new_block(soap))      return SOAP_EOM;    for (;;)    { s = (char*)soap_push_block(soap, soap->dime.size);      if (!s)        return soap->error = SOAP_EOM;      for (i = soap->dime.size; i > 0; i--)      { if ((int)(c = soap_get1(soap)) == EOF)          return soap->error = SOAP_EOF;        *s++ = (char)c;      }      if (soap_move(soap, -(long)soap->dime.size&3))        return soap->error = SOAP_EOF;      if (!(soap->dime.flags & SOAP_DIME_CF))        break;      if (soap_getdimehdr(soap))        return soap->error;    }    soap->dime.size = soap->blist->size++; /* allocate one more for '\0' */    if (!(soap->dime.ptr = soap_save_block(soap, NULL, 0)))      return soap->error;    soap->dime.ptr[soap->dime.size] = '\0'; /* force 0-terminated */    soap->dime.id = id;    soap->dime.type = type;    soap->dime.options = options;  }  else    soap->dime.ptr = soap_getdimefield(soap, soap->dime.size);  content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size);  if (!content)    return soap->error = SOAP_EOM;  content->id = soap->dime.id;  content->type = soap->dime.type;  content->options = soap->dime.options;  return soap->error;}