summaryrefslogtreecommitdiff
path: root/src/input/pnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/pnm.c')
-rw-r--r--src/input/pnm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/input/pnm.c b/src/input/pnm.c
index 564151279..3caaf41bd 100644
--- a/src/input/pnm.c
+++ b/src/input/pnm.c
@@ -21,6 +21,10 @@
* based upon code from joschka
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <config.h>
#include <unistd.h>
@@ -413,8 +417,8 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) {
*/
static void pnm_send_response(pnm_t *p, const char *response) {
-
- int size=strlen(response);
+ /** @TODO should check that sze is always < 256 */
+ size_t size=strlen(response);
p->buffer[0]=0x23;
p->buffer[1]=0;
@@ -629,10 +633,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
*/
n=0;
while (p->buffer[0] != 0x5a) {
- int i;
- for (i=1; i<8; i++) {
- p->buffer[i-1]=p->buffer[i];
- }
+ memmove(p->buffer, &p->buffer[1], 8);
_x_io_tcp_read (p->stream, p->s, &p->buffer[7], 1);
n++;
}
@@ -718,7 +719,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) {
mrl_ptr+=6;
- p = xine_xmalloc(sizeof(pnm_t));
+ p = calloc(1, sizeof(pnm_t));
p->stream = stream;
p->port=7070;
p->url=strdup(mrl);