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:
parent
b73ecbb073
commit
4984639b72
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user