summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-26 15:01:37 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-26 15:01:37 +0000
commitb63759b175cf9ddd9735ca0d2f803fe62f69c3c3 (patch)
treea583febda46545afc4ed20ccbdbed0ae3165a5c4 /stream
parentfad137d7fe3bfef6a258518a1e86a4d811d3b4b5 (diff)
downloadmpv-b63759b175cf9ddd9735ca0d2f803fe62f69c3c3.tar.bz2
mpv-b63759b175cf9ddd9735ca0d2f803fe62f69c3c3.tar.xz
Do not cast the results of malloc/calloc/realloc.
These functions return void*, which is compatible with any pointer, so there is no need for casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/http.c6
-rw-r--r--stream/stream_netstream.h3
-rw-r--r--stream/tvi_def.h4
-rw-r--r--stream/tvi_dshow.c21
4 files changed, 16 insertions, 18 deletions
diff --git a/stream/http.c b/stream/http.c
index bda6c060c7..d79f7632ca 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -332,7 +332,7 @@ http_response_append( HTTP_header_t *http_hdr, char *response, int length ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Bad size in memory (re)allocation\n");
return -1;
}
- http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 );
+ http_hdr->buffer = realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 );
if( http_hdr->buffer==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n");
return -1;
@@ -428,7 +428,7 @@ http_response_parse( HTTP_header_t *http_hdr ) {
while( *ptr!='\r' && *ptr!='\n' ) ptr++;
len = ptr-hdr_ptr;
if( len==0 ) break;
- field = (char*)realloc(field, len+1);
+ field = realloc(field, len+1);
if( field==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n");
return -1;
@@ -520,7 +520,7 @@ char *
http_get_field( HTTP_header_t *http_hdr, const char *field_name ) {
if( http_hdr==NULL || field_name==NULL ) return NULL;
http_hdr->field_search_pos = http_hdr->first_field;
- http_hdr->field_search = (char*)realloc( http_hdr->field_search, strlen(field_name)+1 );
+ http_hdr->field_search = realloc( http_hdr->field_search, strlen(field_name)+1 );
if( http_hdr->field_search==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n");
return NULL;
diff --git a/stream/stream_netstream.h b/stream/stream_netstream.h
index a81bc37c83..4d3e30e849 100644
--- a/stream/stream_netstream.h
+++ b/stream/stream_netstream.h
@@ -89,8 +89,7 @@ static int net_read(int fd, char* buf, int len) {
static mp_net_stream_packet_t* read_packet(int fd) {
uint16_t len;
- mp_net_stream_packet_t* pack =
- (mp_net_stream_packet_t*)malloc(sizeof(mp_net_stream_packet_t));
+ mp_net_stream_packet_t* pack = malloc(sizeof(mp_net_stream_packet_t));
if(!net_read(fd,(char*)pack,sizeof(mp_net_stream_packet_t))) {
free(pack);
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 261a8ee4cd..43de8c6423 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -47,11 +47,11 @@ static const tvi_functions_t functions =
static tvi_handle_t *new_handle(void)
{
- tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
+ tvi_handle_t *h = malloc(sizeof(tvi_handle_t));
if (!h)
return NULL;
- h->priv = (priv_t *)malloc(sizeof(priv_t));
+ h->priv = malloc(sizeof(priv_t));
if (!h->priv)
{
free(h);
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 9aec47ed54..354c0f541b 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -796,19 +796,19 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize,
mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Capture buffer: %d blocks of %d bytes.\n",
rb->buffersize, rb->blocksize);
- rb->ringbuffer = (char **) malloc(rb->buffersize * sizeof(char *));
+ rb->ringbuffer = malloc(rb->buffersize * sizeof(char *));
if (!rb)
return E_POINTER;
memset(rb->ringbuffer, 0, rb->buffersize * sizeof(char *));
for (i = 0; i < rb->buffersize; i++) {
- rb->ringbuffer[i] = (char *) malloc(rb->blocksize * sizeof(char));
+ rb->ringbuffer[i] = malloc(rb->blocksize * sizeof(char));
if (!rb->ringbuffer[i]) {
destroy_ringbuffer(rb);
return E_OUTOFMEMORY;
}
}
- rb->dpts = (double*) malloc(rb->buffersize * sizeof(double));
+ rb->dpts = malloc(rb->buffersize * sizeof(double));
if (!rb->dpts) {
destroy_ringbuffer(rb);
return E_OUTOFMEMORY;
@@ -817,7 +817,7 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize,
rb->tail = 0;
rb->count = 0;
rb->tStart = -1;
- rb->pMutex = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION));
+ rb->pMutex = malloc(sizeof(CRITICAL_SECTION));
if (!rb->pMutex) {
destroy_ringbuffer(rb);
return E_OUTOFMEMORY;
@@ -966,7 +966,7 @@ static HRESULT load_freq_table(int nCountry, int nInputType,
}
*pnFirst = plFreqTable[0];
*pnLen = (int) (plFreqTable[1] - plFreqTable[0] + 1);
- *pplFreqTable = (long *) malloc((*pnLen) * sizeof(long));
+ *pplFreqTable = malloc((*pnLen) * sizeof(long));
if (!*pplFreqTable) {
FreeLibrary(hDLL);
return E_FAIL;
@@ -1273,7 +1273,7 @@ static void get_capabilities(priv_t * priv)
OLE_CALL_ARGS(priv->pCrossbar, get_PinCounts, &lOutputPins,
&lInputPins);
- tv_available_inputs = (long *) malloc(sizeof(long) * lInputPins);
+ tv_available_inputs = malloc(sizeof(long) * lInputPins);
tv_available_inputs_count = 0;
mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_AvailableVideoInputs);
@@ -2063,11 +2063,11 @@ static HRESULT get_available_formats_stream(chain_t *chain)
}
done = 0;
- arpmt = (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *));
+ arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *));
if (arpmt) {
memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *));
- pBuf = (void **) malloc((count + 1) * sizeof(void *));
+ pBuf = malloc((count + 1) * sizeof(void *));
if (pBuf) {
memset(pBuf, 0, (count + 1) * sizeof(void *));
@@ -2170,8 +2170,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder,
OLE_CALL(pEnum,Reset);
count = i;
- arpmt =
- (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *));
+ arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *));
if (!arpmt)
return E_OUTOFMEMORY;
memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *));
@@ -2184,7 +2183,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder,
OLE_RELEASE_SAFE(pEnum);
- pBuf = (void **) malloc((count + 1) * sizeof(void *));
+ pBuf = malloc((count + 1) * sizeof(void *));
if (!pBuf) {
for (i = 0; i < count; i++)
if (arpmt[i])