[MPlayer-cvslog] r25750 - trunk/stream/realrtsp/real.c

rtogni subversion at mplayerhq.hu
Sun Jan 13 22:21:25 CET 2008


Author: rtogni
Date: Sun Jan 13 22:21:25 2008
New Revision: 25750

Log:
Simplify/cleanup of real_calc_response_and_checksum()


Modified:
   trunk/stream/realrtsp/real.c

Modified: trunk/stream/realrtsp/real.c
==============================================================================
--- trunk/stream/realrtsp/real.c	(original)
+++ trunk/stream/realrtsp/real.c	Sun Jan 13 22:21:25 2008
@@ -90,12 +90,7 @@ static void real_calc_response_and_check
   int   i;
   unsigned char zres[16], buf[64];
 
-  /* initialize return values */
-  memset(response, 0, 41);
-  memset(chksum, 0, 9);
-
   /* initialize buffer */
-  memset(buf, 0, 64);
   AV_WB32(buf, 0xa1e9149d);
   AV_WB32(buf+4, 0x0e6b3b59);
 
@@ -105,14 +100,12 @@ static void real_calc_response_and_check
     ch_len = strlen (challenge);
 
     if (ch_len == 40) /* what a hack... */
-    {
-      challenge[32]=0;
       ch_len=32;
-    }
     if ( ch_len > 56 ) ch_len=56;
     
     /* copy challenge to buf */
     memcpy(buf+8, challenge, ch_len);
+    memset(buf+8+ch_len, 0, 56-ch_len);
   }
   
     /* xor challenge bytewise with xor_table */
@@ -131,6 +124,7 @@ static void real_calc_response_and_check
   /* calculate checksum */
   for (i=0; i<8; i++)
     chksum[i] = response[i*4];
+  chksum[8] = 0;
 }
 
 



More information about the MPlayer-cvslog mailing list