[xiph-commits] r9075 - icecast/trunk/icecast/src

msmith at motherfish-iii.xiph.org msmith at motherfish-iii.xiph.org
Mon Mar 14 15:41:14 PST 2005


Author: msmith
Date: 2005-03-14 15:41:11 -0800 (Mon, 14 Mar 2005)
New Revision: 9075

Modified:
   icecast/trunk/icecast/src/util.c
Log:
A bug report indirectly suggested the base64 decode code was confusing (as the
treatment of padding was un-obvious), so added a comment explaining it.


Modified: icecast/trunk/icecast/src/util.c
===================================================================
--- icecast/trunk/icecast/src/util.c	2005-03-14 23:07:34 UTC (rev 9074)
+++ icecast/trunk/icecast/src/util.c	2005-03-14 23:41:11 UTC (rev 9075)
@@ -463,6 +463,10 @@
         }
 
         *out++ = vals[0]<<2 | vals[1]>>4;
+        /* vals[3] and (if that is) vals[2] can be '=' as padding, which is
+           looked up in the base64decode table as '-1'. Check for this case,
+           and output zero-terminators instead of characters if we've got
+           padding. */
         if(vals[2] >= 0)
             *out++ = ((vals[1]&0x0F)<<4) | (vals[2]>>2);
         else



More information about the commits mailing list