mirror of
https://github.com/gryf/gryf-overlay.git
synced 2026-04-19 07:53:34 +02:00
initial import
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
diff -ru xmms-musepack-1.1/src/libmpc.cpp xmms-musepack-1.1-patched/src/libmpc.cpp
|
||||
--- xmms-musepack-1.1/src/libmpc.cpp 2004-11-28 08:15:57.000000000 -0800
|
||||
+++ xmms-musepack-1.1-patched/src/libmpc.cpp 2004-12-29 15:21:10.810832296 -0800
|
||||
@@ -12,6 +12,7 @@
|
||||
}
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
+#include <iconv.h>
|
||||
#include <math.h>
|
||||
#include "tags.h"
|
||||
#include "equalizer.h"
|
||||
@@ -115,12 +116,28 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
-static char* convertUTF8toLocale(char* utf8) {
|
||||
- char* temp=g_locale_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
- if(temp==NULL)
|
||||
- return g_strdup(utf8);
|
||||
- else
|
||||
- return temp;
|
||||
+static char*
|
||||
+convertUTF8toLocale(char* utf8)
|
||||
+{
|
||||
+ // note - opens a new iconv descriptor for each call
|
||||
+ // will have to find a way to reuse the descriptor if this turns
|
||||
+ // out to be too slow
|
||||
+ iconv_t idesc = iconv_open("", "UTF-8");
|
||||
+ if (idesc == (iconv_t) -1) {
|
||||
+ perror("iconv_open failed");
|
||||
+ return g_strdup(utf8);
|
||||
+ }
|
||||
+
|
||||
+ size_t in_left = strlen(utf8);
|
||||
+ size_t out_left = 2 * in_left + 1;
|
||||
+ char *buf = (char *)g_malloc(out_left);
|
||||
+ char *in = utf8;
|
||||
+ char *out = buf;
|
||||
+
|
||||
+ memset(buf, 0, out_left);
|
||||
+ size_t err = iconv(idesc, &in, &in_left, &out, &out_left);
|
||||
+ iconv_close(idesc);
|
||||
+ return buf;
|
||||
}
|
||||
|
||||
static void convertLE32to16(MPC_SAMPLE_FORMAT* sample_buffer, char* xmms_buffer, unsigned int status) {
|
||||
Reference in New Issue
Block a user