aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-13 13:12:39 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-13 13:12:39 +0000
commitb5eff53d07b52bb7a6642bb6863546b00e33d774 (patch)
treec8646a852ca89a71978d4e91d9b3e4eaf3594acb
parent0a2a62634282bd7f9400bfaa16e0a75873e0cc3d (diff)
Use AV_WB16 instead of ugly memcpy hacks
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25726 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--stream/pnm.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/stream/pnm.c b/stream/pnm.c
index f8136e0e5c..fd94abfcbf 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -105,9 +105,6 @@ struct pnm_s {
unsigned int packet; /* number of last recieved packet */
};
-/* D means direct (no pointer) */
-#define BE_16D(x) ((x & 0xff00) >> 8)|((x & 0x00ff) << 8)
-
/* sizes */
#define PREAMBLE_SIZE 8
#define CHECKSUM_SIZE 3
@@ -459,7 +456,7 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) {
/* client id string */
p->buffer[c]=PNA_CLIENT_STRING;
- i16=BE_16D((strlen(client_string)-1)); /* don't know why do we have -1 here */
+ AV_WB16(&p->buffer[c+1], strlen(client_string)-1); /* don't know why do we have -1 here */
memcpy(&p->buffer[c+1],&i16,2);
memcpy(&p->buffer[c+3],client_string,strlen(client_string)+1);
c=c+3+strlen(client_string)+1;
@@ -467,8 +464,7 @@ static void pnm_send_request(pnm_t *p, uint32_t bandwidth) {
/* file path */
p->buffer[c]=0;
p->buffer[c+1]=PNA_PATH_REQUEST;
- i16=BE_16D(strlen(p->path));
- memcpy(&p->buffer[c+2],&i16,2);
+ AV_WB16(&p->buffer[c+2], strlen(p->path));
memcpy(&p->buffer[c+4],p->path,strlen(p->path));
c=c+4+strlen(p->path);
@@ -750,10 +746,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
p->recv[0]=0; /* object version */
p->recv[1]=0;
- fof2=AV_RB16(&fof2);
- memcpy(&p->recv[2], &fof2, 2);
- /*p->recv[2]=(fof2>>8)%0xff;*/ /* length */
- /*p->recv[3]=(fof2)%0xff;*/
+ AV_WB16(&p->recv[2], fof2); /* length */
p->recv[4]=0; /* stream number */
p->recv[5]=stream;