/* our notification system only works in a single direction; we should detect which
* direction is important and use the correct values in this call */
- php_stream_notify_progress(stream->context, dlnow, dltotal);
+ php_stream_notify_progress(stream->context, (size_t) dlnow, (size_t) dltotal);
return 0;
}
tv.tv_sec = 15; /* TODO: allow this to be configured from the script */
/* wait for data */
- switch (select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &tv)) {
+ switch ((curlstream->maxfd < 0) ? 1 :
+ select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &tv)) {
case -1:
/* error */
return 0;
curlstream->mcode = curl_multi_perform(curlstream->multi, &curlstream->pending);
} while (curlstream->mcode == CURLM_CALL_MULTI_PERFORM);
}
- } while (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0);
+ } while (curlstream->maxfd >= 0 &&
+ curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0);
}