cups-dbus-utf8.patch: set encoding type, and fixed validate_utf8 function.
This commit is contained in:
parent
611cccd2e1
commit
65ecaf3aea
@ -1,16 +1,17 @@
|
|||||||
diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
||||||
--- cups-1.6.1/notifier/dbus.c.dbus-utf8 2012-01-20 19:00:32.000000000 +0000
|
--- cups-1.6.1/notifier/dbus.c.dbus-utf8 2012-01-20 19:00:32.000000000 +0000
|
||||||
+++ cups-1.6.1/notifier/dbus.c 2012-10-30 17:03:40.260833091 +0000
|
+++ cups-1.6.1/notifier/dbus.c 2012-10-31 11:04:47.686973616 +0000
|
||||||
@@ -31,6 +31,8 @@
|
@@ -31,6 +31,9 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
+#include <assert.h>
|
+#include <assert.h>
|
||||||
|
+#include <locale.h>
|
||||||
+#include <wchar.h>
|
+#include <wchar.h>
|
||||||
|
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
# include <dbus/dbus.h>
|
# include <dbus/dbus.h>
|
||||||
@@ -157,10 +159,78 @@ enum
|
@@ -157,10 +160,82 @@ enum
|
||||||
* Local functions...
|
* Local functions...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -47,6 +48,10 @@ diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
|||||||
+ str_len = strlen (str);
|
+ str_len = strlen (str);
|
||||||
+ if (str_len > buflen)
|
+ if (str_len > buflen)
|
||||||
+ {
|
+ {
|
||||||
|
+ if (buffer == NULL)
|
||||||
|
+ /* Set encoding type to UTF-8 the first time we need to */
|
||||||
|
+ setlocale (LC_CTYPE, "en_US.UTF-8");
|
||||||
|
+
|
||||||
+ buflen = str_len + 1;
|
+ buflen = str_len + 1;
|
||||||
+ buffer = realloc (buffer, buflen);
|
+ buffer = realloc (buffer, buflen);
|
||||||
+ }
|
+ }
|
||||||
@ -83,14 +88,14 @@ diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ *p = '\0';
|
+ *p = '\0';
|
||||||
+ return p;
|
+ return buffer;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+/*
|
+/*
|
||||||
* 'main()' - Read events and send DBUS notifications.
|
* 'main()' - Read events and send DBUS notifications.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -366,7 +436,7 @@ main(int argc, /* I - Number of comm
|
@@ -366,7 +441,7 @@ main(int argc, /* I - Number of comm
|
||||||
attr = ippFindAttribute(msg, "notify-text", IPP_TAG_TEXT);
|
attr = ippFindAttribute(msg, "notify-text", IPP_TAG_TEXT);
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
{
|
||||||
@ -99,7 +104,7 @@ diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
|||||||
if (!dbus_message_iter_append_string(&iter, &val))
|
if (!dbus_message_iter_append_string(&iter, &val))
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
@@ -530,7 +600,7 @@ main(int argc, /* I - Number of comm
|
@@ -530,7 +605,7 @@ main(int argc, /* I - Number of comm
|
||||||
attr = ippFindAttribute(msg, "job-name", IPP_TAG_NAME);
|
attr = ippFindAttribute(msg, "job-name", IPP_TAG_NAME);
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user