changeset 25701:d3943c815424

Use AV_WB*
author reimar
date Sun, 13 Jan 2008 13:25:07 +0000
parents 5ac12852a918
children c4275201a489
files stream/pnm.c
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/stream/pnm.c	Sun Jan 13 13:22:01 2008 +0000
+++ b/stream/pnm.c	Sun Jan 13 13:25:07 2008 +0000
@@ -406,10 +406,8 @@
 static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, 
     const char *chunk, char *data) {
 
-  data[0]=(chunk_id>>8)%0xff;
-  data[1]=chunk_id%0xff;
-  data[2]=(length>>8)%0xff;
-  data[3]=length%0xff;
+  AV_WB16(&data[0], chunk_id);
+  AV_WB16(&data[2], length);
   memcpy(&data[4],chunk,length);
   
   return length+4;
@@ -543,12 +541,7 @@
   }
   
   /* set data offset */
-  size--;
-  prop_hdr[42]=(size>>24)%0xff;
-  prop_hdr[43]=(size>>16)%0xff;
-  prop_hdr[44]=(size>>8)%0xff;
-  prop_hdr[45]=(size)%0xff;
-  size++;
+  AV_WB32(&prop_hdr[42], size - 1);
 
   /* read challenge */
   memcpy (p->buffer, ptr, PREAMBLE_SIZE);