Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [aef122] default Maximize Restore History

Merge from -plugin-loader branch.

base64.{c,h} functions are given "xine_" prefixes and are exported.

Darren Salt Darren Salt 2008-01-24

1 2 3 .. 101 > >> (Page 1 of 101)
removed src/libxineadec
removed src/libxineadec/nosefart
removed src/libxineadec/nosefart/vrcvisnd.c
removed src/libxineadec/nosefart/vrcvisnd.h
removed src/libxineadec/nosefart/memguard.c
removed src/libxineadec/nosefart/memguard.h
removed src/libxineadec/nosefart/osd.h
removed src/libxineadec/nosefart/Makefile.am
removed src/libxineadec/nosefart/nes6502.c
removed src/libxineadec/nosefart/nes6502.h
removed src/libxineadec/nosefart/vrc7_snd.h
changed src/xine-utils/Makefile.am
changed src/input/Makefile.am
changed src/input/input_cdda.c
changed src/xine-engine/xine.c
changed src/xine-engine/configfile.c
changed src/xine-engine/load_plugins.c
changed include/xine/xineutils.h
changed include/xine/plugin_catalog.h
changed include/xine/Makefile.am
changed include/xine/configfile.h
copied src/input/base64.c -> include/xine/base64.h
copied src/input/base64.h -> src/xine-utils/base64.c
src/libxineadec
File was removed.
src/libxineadec/nosefart
File was removed.
src/libxineadec/nosefart/osd.h
File was removed.
src/xine-utils/Makefile.am Diff Switch to side-by-side view
Loading...
src/input/Makefile.am Diff Switch to side-by-side view
Loading...
src/input/input_cdda.c Diff Switch to side-by-side view
Loading...
src/xine-engine/xine.c Diff Switch to side-by-side view
Loading...
src/xine-engine/configfile.c Diff Switch to side-by-side view
Loading...
src/xine-engine/load_plugins.c Diff Switch to side-by-side view
Loading...
include/xine/xineutils.h Diff Switch to side-by-side view
Loading...
include/xine/plugin_catalog.h Diff Switch to side-by-side view
Loading...
include/xine/Makefile.am Diff Switch to side-by-side view
Loading...
include/xine/configfile.h Diff Switch to side-by-side view
Loading...
src/input/base64.c to include/xine/base64.h
--- a/src/input/base64.c
+++ b/include/xine/base64.h
@@ -83,49 +83,12 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <ctype.h>
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
+#ifndef BASE64_H
+#define BASE64_H
 
-#include "base64.h"
+unsigned char *xine_rfc822_binary (void *src,unsigned long srcl,unsigned long *len) XINE_PROTECTED;
 
+char *xine_base64_encode (const void *src, unsigned long srcl, unsigned long *len) XINE_PROTECTED;
+void *xine_base64_decode (const char *src, unsigned long srcl, unsigned long *len) XINE_PROTECTED;
 
-/* NOTE: This is not true RFC822 anymore. The use of the characters
-   '/', '+', and '=' is no bueno when the ID will be used as part of a URL.
-   '_', '.', and '-' have been used instead
-*/
-
-/* Convert binary contents to BASE64
- * Accepts: source
- *	    length of source
- *	    pointer to return destination length
- * Returns: destination as BASE64
- */
-
-unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len)
-{
-  unsigned char *ret,*d;
-  unsigned char *s = (unsigned char *) src;
-  static const char v[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
-  unsigned long i = ((srcl + 2) / 3) * 4;
-  *len = i += 2 * ((i / 60) + 1);
-  d = ret = (unsigned char *) malloc ((size_t) ++i);
-  for (i = 0; srcl; s += 3) {	/* process tuplets */
-    *d++ = v[s[0] >> 2];	/* byte 1: high 6 bits (1) */
-				/* byte 2: low 2 bits (1), high 4 bits (2) */
-    *d++ = v[((s[0] << 4) + (--srcl ? (s[1] >> 4) : 0)) & 0x3f];
-				/* byte 3: low 4 bits (2), high 2 bits (3) */
-    *d++ = srcl ? v[((s[1] << 2) + (--srcl ? (s[2] >> 6) : 0)) & 0x3f] : '-';
-				/* byte 4: low 6 bits (3) */
-    *d++ = srcl ? v[s[2] & 0x3f] : '-';
-    if (srcl) srcl--;		/* count third character if processed */
-    if ((++i) == 15) {		/* output 60 characters? */
-      i = 0;			/* restart line break count, insert CRLF */
-      *d++ = '\015'; *d++ = '\012';
-    }
-  }
-  *d = '\0';			/* tie off string */
-
-  return ret;			/* return the resulting string */
-}
+#endif
src/input/base64.h to src/xine-utils/base64.c
--- a/src/input/base64.h
+++ b/src/xine-utils/base64.c
@@ -83,9 +83,116 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef BASE64_H
-#define BASE64_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
-unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len);
+#include <ctype.h>
+#include <stdio.h>
+#include <time.h>
+#include <stdlib.h>
 
-#endif
+#include <xine/base64.h>
+
+
+/* NOTE: This is not true RFC822 anymore. The use of the characters
+   '/', '+', and '=' is no bueno when the ID will be used as part of a URL.
+   '_', '.', and '-' have been used instead
+*/
+
+/* Convert binary contents to BASE64
+ * Accepts: source
+ *	    length of source
+ *	    pointer to return destination length
+ * Returns: destination as BASE64
+ */
+
+unsigned char *xine_rfc822_binary (void *src,unsigned long srcl,unsigned long *len)
+{
+  unsigned char *ret,*d;
+  unsigned char *s = (unsigned char *) src;
+  static const char v[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
+  unsigned long i = ((srcl + 2) / 3) * 4;
+  *len = i += 2 * ((i / 60) + 1);
+  d = ret = (unsigned char *) malloc ((size_t) ++i);
+  for (i = 0; srcl; s += 3) {	/* process tuplets */
+    *d++ = v[s[0] >> 2];	/* byte 1: high 6 bits (1) */
+				/* byte 2: low 2 bits (1), high 4 bits (2) */
+    *d++ = v[((s[0] << 4) + (--srcl ? (s[1] >> 4) : 0)) & 0x3f];
+				/* byte 3: low 4 bits (2), high 2 bits (3) */
+    *d++ = srcl ? v[((s[1] << 2) + (--srcl ? (s[2] >> 6) : 0)) & 0x3f] : '-';
+				/* byte 4: low 6 bits (3) */
+    *d++ = srcl ? v[s[2] & 0x3f] : '-';
+    if (srcl) srcl--;		/* count third character if processed */
+    if ((++i) == 15) {		/* output 60 characters? */
+      i = 0;			/* restart line break count, insert CRLF */
+      *d++ = '\015'; *d++ = '\012';
+    }
+  }
+  *d = '\0';			/* tie off string */
+
+  return ret;			/* return the resulting string */
+}
+
+char *xine_base64_encode (const void *src, unsigned long srcl, unsigned long *len)
+{
+  char *ret, *d;
+  unsigned char *s = (unsigned char *) src;
+  char *v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
+  unsigned long i = ((srcl + 2) / 3) * 4;
+  *len = i;
+  d = ret = (char *) malloc ((size_t) ++i);
+  for (i = 0; srcl; s += 3) {	/* process tuplets */
+    *d++ = v[s[0] >> 2];	/* byte 1: high 6 bits (1) */
+				/* byte 2: low 2 bits (1), high 4 bits (2) */
+    *d++ = v[((s[0] << 4) + (--srcl ? (s[1] >> 4) : 0)) & 0x3f];
+				/* byte 3: low 4 bits (2), high 2 bits (3) */
+    *d++ = srcl ? v[((s[1] << 2) + (--srcl ? (s[2] >> 6) : 0)) & 0x3f] : '-';
+				/* byte 4: low 6 bits (3) */
+    *d++ = srcl ? v[s[2] & 0x3f] : '-';
+    if (srcl) srcl--;		/* count third character if processed */
+  }
+  *d = '\0';			/* tie off string */
+
+  return ret;			/* return the resulting string */
+}
+
+void *xine_base64_decode (const char *src, unsigned long srcl, unsigned long *len)
+{
+  void *ret;
+  unsigned char *d;
+  unsigned long i = ((srcl + 3) / 4) * 3;
+  *len = i;
+  d = ret = (void *) malloc ((size_t)i);
+  for (i = 0; srcl; src += 4) {	/* process tuplets */
+    unsigned char tuplet[4];
+    int j;
+
+    for (j = 0; j < 4; j += 1) {
+      if (srcl) {
+        if ((src[j] >= 'A') && (src[j] <= 'Z')) {
+          tuplet[j] = src[j] - 'A';
+        } else if ((src[j] >= 'a') && (src[j] <= 'z')) {
+          tuplet[j] = src[j] - 'a' + 26;
+        } else if ((src[j] >= '0') && (src[j] <= '9')) {
+          tuplet[j] = src[j] - '0' + 52;
+        } else if (src[j] == '.') {
+          tuplet[j] = 62;
+        } else if (src[j] == '_') {
+          tuplet[j] = 63;
+        } else {
+          tuplet[j] = 64;
+        }
+        srcl--;
+      } else {
+        (*len)--;
+      }
+    }
+
+    *d++ = (tuplet[0] << 2) + ((tuplet[1] & 0x3f) >> 4);
+    *d++ = (tuplet[1] << 4) + ((tuplet[2] & 0x3f) >> 2);
+    *d++ = (tuplet[2] << 6) + (tuplet[3] & 0x3f);
+  }
+
+  return ret;			/* return the resulting string */
+}
1 2 3 .. 101 > >> (Page 1 of 101)