pike.git / src / modules / _Stdio / sendfile.c

version» Context lines:

pike.git/src/modules/_Stdio/sendfile.c:920:    /* FIXME: Ought to fix fp so that the backtraces look right. */       /* Check that we're called with the right kind of objects. */    if (sf.to_file->prog == file_program) {    sf.to = (struct my_file *)(sf.to_file->storage);    } else if (!(sf.to = get_storage(sf.to_file, file_program))) {    struct svalue *sval;    if (!(sval = get_storage(sf.to_file, file_ref_program)) ||    (TYPEOF(*sval) != T_OBJECT) ||    !(sf.to = get_storage(sval->u.object, file_program))) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 6, "object(Stdio.File)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 6, "object(Stdio.File)");    }    add_ref(sval->u.object);   #ifdef PIKE_DEBUG    if ((TYPEOF(sp[5-args]) != T_OBJECT) ||    (sp[5-args].u.object != sf.to_file)) {    Pike_fatal("sendfile: Stack out of sync(1).\n");    }   #endif /* PIKE_DEBUG */    sf.to_file = sval->u.object;    free_object(sp[5-args].u.object);    sp[5-args].u.object = sf.to_file;    }    if ((sf.to->flags & FILE_LOCK_FD) ||    (sf.to->box.fd < 0)) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 6, "object(Stdio.File)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 6, "object(Stdio.File)");    }    sf.to_fd = sf.to->box.fd;       if (sf.from_file && !sf.len) {    /* No need for the from_file object. */    /* NOTE: We need to zap from_file from the stack too. */    free_object(sf.from_file);    sf.from_file = NULL;    sf.from = NULL;    SET_SVAL(sp[1-args], T_INT, NUMBER_NUMBER, integer, 0);    }       if (sf.from_file) {    if (sf.from_file->prog == file_program) {    sf.from = (struct my_file *)(sf.from_file->storage);    } else if (!(sf.from = get_storage(sf.from_file, file_program))) {    struct svalue *sval;    if (!(sval = get_storage(sf.from_file, file_ref_program)) ||    (TYPEOF(*sval) != T_OBJECT) ||    !(sf.from = get_storage(sval->u.object, file_program))) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 2, "object(Stdio.File)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 2, "object(Stdio.File)");    }    add_ref(sval->u.object);   #ifdef PIKE_DEBUG    if ((TYPEOF(sp[1-args]) != T_OBJECT) ||    (sp[1-args].u.object != sf.from_file)) {    Pike_fatal("sendfile: Stack out of sync(2).\n");    }   #endif /* PIKE_DEBUG */    sf.from_file = sval->u.object;    free_object(sp[1-args].u.object);    sp[1-args].u.object = sf.from_file;    }    if ((sf.from->flags & FILE_LOCK_FD) ||    (sf.from->box.fd < 0)) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 2, "object(Stdio.File)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 2, "object(Stdio.File)");    }    sf.from_fd = sf.from->box.fd;    }       /* Do some extra arg checking */    sf.hd_cnt = 0;    if (sf.headers) {    struct array *a = sf.headers;    int i;       for (i=0; i < a->size; i++) {    if ((TYPEOF(a->item[i]) != T_STRING) || (a->item[i].u.string->size_shift)) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 1, "array(string)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 1, "array(string)");    }    }    iovcnt = a->size;    sf.hd_cnt = a->size;    }       sf.tr_cnt = 0;    if (sf.trailers) {    struct array *a = sf.trailers;    int i;       for (i=0; i < a->size; i++) {    if ((TYPEOF(a->item[i]) != T_STRING) || (a->item[i].u.string->size_shift)) { -  SIMPLE_BAD_ARG_ERROR("sendfile", 5, "array(string)"); +  SIMPLE_ARG_TYPE_ERROR("sendfile", 5, "array(string)");    }    }    iovcnt += a->size;    sf.tr_cnt = a->size;    }       /* Set up the iovec's */    if (iovcnt) {   #ifdef HAVE_HPUX_SENDFILE    iovcnt = 2;