input_stream: removed nmemb argument

The nmemb argument isn't actually useful, and one of nmemb and size
was always passed as 1.  Remove it.
This commit is contained in:
Max Kellermann 2008-10-17 17:53:59 +02:00
parent b73ecbb073
commit 4984639b72
8 changed files with 12 additions and 16 deletions

View File

@ -115,7 +115,7 @@ size_t decoder_read(struct decoder *decoder,
dc.command != DECODE_COMMAND_NONE)
return 0;
nbytes = readFromInputStream(inStream, buffer, 1, length);
nbytes = readFromInputStream(inStream, buffer, length);
if (nbytes > 0 || inputStreamAtEOF(inStream))
return nbytes;

View File

@ -71,7 +71,7 @@ static int mp4_getAACTrack(mp4ff_t * infile)
static uint32_t mp4_inputStreamReadCallback(void *inStream, void *buffer,
uint32_t length)
{
return readFromInputStream((InputStream *) inStream, buffer, 1, length);
return readFromInputStream((InputStream *) inStream, buffer, length);
}
static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)

View File

@ -54,9 +54,9 @@ int seekInputStream(struct input_stream *inStream, long offset, int whence)
}
size_t readFromInputStream(struct input_stream *inStream,
void *ptr, size_t size, size_t nmemb)
void *ptr, size_t size)
{
return inStream->readFunc(inStream, ptr, size, nmemb);
return inStream->readFunc(inStream, ptr, size);
}
int closeInputStream(struct input_stream *inStream)

View File

@ -26,7 +26,7 @@ typedef struct input_stream InputStream;
typedef int (*InputStreamSeekFunc) (struct input_stream *inStream, long offset,
int whence);
typedef size_t(*InputStreamReadFunc) (struct input_stream *inStream, void *ptr,
size_t size, size_t nmemb);
size_t size);
typedef int (*InputStreamCloseFunc) (struct input_stream *inStream);
typedef int (*InputStreamAtEOFFunc) (struct input_stream *inStream);
typedef int (*InputStreamBufferFunc) (struct input_stream *inStream);
@ -67,6 +67,6 @@ int inputStreamAtEOF(struct input_stream *inStream);
int bufferInputStream(struct input_stream *inStream);
size_t readFromInputStream(struct input_stream *inStream,
void *ptr, size_t size, size_t nmemb);
void *ptr, size_t size);
#endif

View File

@ -71,12 +71,11 @@ int inputStream_fileSeek(struct input_stream *inStream, long offset,
}
size_t inputStream_fileRead(struct input_stream *inStream,
void *ptr, size_t size,
size_t nmemb)
void *ptr, size_t size)
{
size_t readSize;
readSize = fread(ptr, size, nmemb, (FILE *) inStream->data);
readSize = fread(ptr, 1, size, (FILE *) inStream->data);
if (readSize <= 0 && ferror((FILE *) inStream->data)) {
inStream->error = errno;
DEBUG("inputStream_fileRead: error reading: %s\n",

View File

@ -29,8 +29,7 @@ int inputStream_fileSeek(struct input_stream *inStream, long offset,
int whence);
size_t inputStream_fileRead(struct input_stream *inStream,
void *ptr, size_t size,
size_t nmemb);
void *ptr, size_t size);
int inputStream_fileClose(struct input_stream *inStream);

View File

@ -890,11 +890,10 @@ static size_t read_with_metadata(InputStream *is, unsigned char *ptr,
return readed;
}
size_t inputStream_httpRead(InputStream * is, void *_ptr, size_t size,
size_t nmemb)
size_t inputStream_httpRead(InputStream * is, void *_ptr, size_t size)
{
struct http_data *data = (struct http_data *) is->data;
size_t len = size * nmemb;
size_t len = size;
size_t r;
unsigned char *ptr = _ptr, *ptr0 = _ptr;
long tries = len / 128; /* try harder for bigger reads */

View File

@ -27,8 +27,7 @@ int inputStream_httpOpen(InputStream * inStream, char *filename);
int inputStream_httpSeek(InputStream * inStream, long offset, int whence);
size_t inputStream_httpRead(InputStream * inStream, void *ptr, size_t size,
size_t nmemb);
size_t inputStream_httpRead(InputStream * inStream, void *ptr, size_t size);
int inputStream_httpClose(InputStream * inStream);