rem: if (--soap->dime_count == 0) soap->dime_flags |= SOAP_DIME_ME; if (soap_putdimehdr(soap)) return soap->error; return soap_putdimefield(soap, (char*)ptr, size);
add: return SOAP_OK;
context: soap_putdime(struct soap *soap, int i, char *id, char *type, char *options, void *ptr, size_t size){ void *h;  if (id)    soap->dime_id = id;  else  { sprintf(soap->id, soap->dime_id_format, i);    soap->dime_id = soap->id;  }  soap->dime_type = type;  soap->dime_options = options;  soap->dime_size = size;  soap->dime_flags = SOAP_DIME_VERSION | SOAP_DIME_MEDIA;  if (soap->fdimereadopen && ((h = soap->fdimereadopen(soap, (void*)ptr, soap->dime_id, type, options)) || soap->error))  { size_t n;    if (!h)    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadopen failed\n"));      return soap->error;    }    if (!size && ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE))    { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming DIME\n"));      n = sizeof(soap->tmpbuf);      do      { size = soap->fdimeread(soap, h, soap->tmpbuf, n);        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread returned %lu bytes\n", (unsigned long)size));        if (size == n)          soap->dime_flags |= SOAP_DIME_CF;        else 	{ soap->dime_flags &= ~SOAP_DIME_CF;          if (--soap->dime_count == 0)            soap->dime_flags |= SOAP_DIME_ME;        }	soap->dime_size = size;        if (soap_putdimehdr(soap)	 || soap_send_raw(soap, soap->tmpbuf, size)	 || soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime_size&3))          break;        if (soap->dime_id) 	{ soap->dime_flags &= ~(SOAP_DIME_MB | SOAP_DIME_MEDIA);          soap->dime_id = NULL;          soap->dime_type = NULL;          soap->dime_options = NULL;        }       } while (size >= n);    }    else    { if (--soap->dime_count == 0)        soap->dime_flags |= SOAP_DIME_ME;      if (soap_putdimehdr(soap))        return soap->error;      do      { if (size < sizeof(soap->tmpbuf))          n = size;        else          n = sizeof(soap->tmpbuf);        if (!(n = soap->fdimeread(soap, h, soap->tmpbuf, n)))        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)soap->dime_size));          soap->error = SOAP_EOF;	  break;        }        if (soap_send_raw(soap, soap->tmpbuf, n))          break;        size -= n;      } while (size);      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadclose\n"));      soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime_size&3);    }    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadclose\n"));    if (soap->fdimereadclose)      soap->fdimereadclose(soap, h);    return soap->error;  }  if (--soap->dime_count == 0)     soap->dime_flags |= SOAP_DIME_ME;  if (soap_putdimehdr(soap))     return soap->error;  return soap_putdimefield(soap, (char*)ptr, size);}