diff options
-rw-r--r-- | libpurple/plugins/perl/common/Account.xs | 27 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/AccountOpts.xs | 14 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/BuddyList.xs | 2 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/Conversation.xs | 30 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/PluginPref.xs | 2 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/Prefs.xs | 14 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/Roomlist.xs | 7 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/Server.xs | 6 | ||||
-rw-r--r-- | libpurple/plugins/perl/common/Status.xs | 6 | ||||
-rw-r--r-- | libpurple/plugins/perl/perl-common.c | 8 | ||||
-rw-r--r-- | libpurple/plugins/perl/perl-handlers.c | 40 | ||||
-rw-r--r-- | libpurple/plugins/perl/perl.c | 55 |
12 files changed, 86 insertions, 125 deletions
diff --git a/libpurple/plugins/perl/common/Account.xs b/libpurple/plugins/perl/common/Account.xs index 8a061030f1..837b81aa4e 100644 --- a/libpurple/plugins/perl/common/Account.xs +++ b/libpurple/plugins/perl/common/Account.xs @@ -107,10 +107,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(status_types)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); + purple_account_set_status_types(account, t_GL); void @@ -210,10 +209,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(list)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(list), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0))); + purple_account_add_buddies(account, t_GL); g_list_free(t_GL); @@ -240,18 +238,15 @@ PPCODE: t_GL1 = NULL; t_len = av_len((AV *)SvRV(A)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL1 = g_list_append(t_GL1, SvPV(*av_fetch((AV *)SvRV(A), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL1 = g_list_append(t_GL1, SvPVutf8_nolen(*av_fetch((AV *)SvRV(A), i, 0))); t_GL2 = NULL; t_len = av_len((AV *)SvRV(B)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL2 = g_list_append(t_GL2, SvPV(*av_fetch((AV *)SvRV(B), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL2 = g_list_append(t_GL2, SvPVutf8_nolen(*av_fetch((AV *)SvRV(B), i, 0))); + purple_account_remove_buddies(account, t_GL1, t_GL2); g_list_free(t_GL1); g_list_free(t_GL2); diff --git a/libpurple/plugins/perl/common/AccountOpts.xs b/libpurple/plugins/perl/common/AccountOpts.xs index 8296b4b4e9..e2a5986655 100644 --- a/libpurple/plugins/perl/common/AccountOpts.xs +++ b/libpurple/plugins/perl/common/AccountOpts.xs @@ -44,10 +44,9 @@ CODE: t_GL = NULL; t_len = av_len((AV *)SvRV(values)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(values), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); + RETVAL = purple_account_option_list_new(text, pref_name, t_GL); OUTPUT: RETVAL @@ -133,10 +132,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(values)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(values), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); + purple_account_option_set_list(option, t_GL); void diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs index 585e066431..46cd6e8594 100644 --- a/libpurple/plugins/perl/common/BuddyList.xs +++ b/libpurple/plugins/perl/common/BuddyList.xs @@ -362,7 +362,7 @@ CODE: for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { t_key = hv_iterkey(t_HE, &len); t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPV(t_SV, PL_na); + t_value = SvPVutf8_nolen(t_SV); g_hash_table_insert(t_GHash, t_key, t_value); } diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs index 180a94d9fa..523b7413ba 100644 --- a/libpurple/plugins/perl/common/Conversation.xs +++ b/libpurple/plugins/perl/common/Conversation.xs @@ -342,10 +342,8 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(users)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(users), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); @@ -382,10 +380,8 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(ignored)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(ignored), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); @@ -441,26 +437,20 @@ PPCODE: t_GL_users = NULL; t_len = av_len((AV *)SvRV(users)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL_users = g_list_append(t_GL_users, SvPV(*av_fetch((AV *)SvRV(users), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); t_GL_flags = NULL; t_len = av_len((AV *)SvRV(flags)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL_flags = g_list_append(t_GL_flags, SvPV(*av_fetch((AV *)SvRV(flags), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); t_GL_extra_msgs = NULL; t_len = av_len((AV *)SvRV(extra_msgs)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPV(*av_fetch((AV *)SvRV(extra_msgs), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); diff --git a/libpurple/plugins/perl/common/PluginPref.xs b/libpurple/plugins/perl/common/PluginPref.xs index d3e9869ce4..3d76db9ec5 100644 --- a/libpurple/plugins/perl/common/PluginPref.xs +++ b/libpurple/plugins/perl/common/PluginPref.xs @@ -62,7 +62,7 @@ purple_plugin_pref_add_choice(pref, label, choice) const char *label # Do the appropriate conversion based on the perl type specified. # Currently only Strings and Ints will work. - gpointer choice = (SvPOKp($arg) ? SvPV($arg, PL_na) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL)); + gpointer choice = (SvPOKp($arg) ? SvPVutf8_nolen($arg) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL)); void purple_plugin_pref_destroy(pref) diff --git a/libpurple/plugins/perl/common/Prefs.xs b/libpurple/plugins/perl/common/Prefs.xs index 24669f27fa..40e4b4b4a1 100644 --- a/libpurple/plugins/perl/common/Prefs.xs +++ b/libpurple/plugins/perl/common/Prefs.xs @@ -53,10 +53,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(value)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); + purple_prefs_add_string_list(name, t_GL); g_list_free(t_GL); @@ -171,10 +170,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(value)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); + purple_prefs_set_string_list(name, t_GL); g_list_free(t_GL); diff --git a/libpurple/plugins/perl/common/Roomlist.xs b/libpurple/plugins/perl/common/Roomlist.xs index 6523427163..be8d7745af 100644 --- a/libpurple/plugins/perl/common/Roomlist.xs +++ b/libpurple/plugins/perl/common/Roomlist.xs @@ -84,10 +84,9 @@ PPCODE: t_GL = NULL; t_len = av_len((AV *)SvRV(fields)); - for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(fields), i, 0), t_sl)); - } + for (i = 0; i < t_len; i++) + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(fields), i, 0))); + purple_roomlist_set_fields(list, t_GL); void diff --git a/libpurple/plugins/perl/common/Server.xs b/libpurple/plugins/perl/common/Server.xs index fe3fc3b8b8..11f56d077f 100644 --- a/libpurple/plugins/perl/common/Server.xs +++ b/libpurple/plugins/perl/common/Server.xs @@ -85,7 +85,7 @@ CODE: for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { t_key = hv_iterkey(t_HE, &len); t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPV(t_SV, PL_na); + t_value = SvPVutf8_nolen(t_SV); g_hash_table_insert(t_GHash, t_key, t_value); } @@ -140,7 +140,7 @@ CODE: for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { t_key = hv_iterkey(t_HE, &len); t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPV(t_SV, PL_na); + t_value = SvPVutf8_nolen(t_SV); g_hash_table_insert(t_GHash, t_key, t_value); } @@ -170,7 +170,7 @@ CODE: for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { t_key = hv_iterkey(t_HE, &len); t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPV(t_SV, PL_na); + t_value = SvPVutf8_nolen(t_SV); g_hash_table_insert(t_GHash, t_key, t_value); } diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs index e73cc5f8ed..4b1daabb99 100644 --- a/libpurple/plugins/perl/common/Status.xs +++ b/libpurple/plugins/perl/common/Status.xs @@ -86,8 +86,7 @@ PPCODE: t_len = av_len((AV *)SvRV(source_list)); for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(source_list), i, 0), t_sl)); + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); } purple_presence_add_list(presence, t_GL); g_list_free(t_GL); @@ -389,8 +388,7 @@ CODE: t_len = av_len((AV *)SvRV(status_types)); for (i = 0; i < t_len; i++) { - STRLEN t_sl; - t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl)); + t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); } RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id); g_list_free(t_GL); diff --git a/libpurple/plugins/perl/perl-common.c b/libpurple/plugins/perl/perl-common.c index 0ffef004b1..4266ab7626 100644 --- a/libpurple/plugins/perl/perl-common.c +++ b/libpurple/plugins/perl/perl-common.c @@ -176,7 +176,6 @@ execute_perl(const char *function, int argc, char **args) { int count = 0, i, ret_value = 1; SV *sv_args[argc]; - STRLEN na; dSP; PERL_SET_CONTEXT(my_perl); /* @@ -207,7 +206,7 @@ execute_perl(const char *function, int argc, char **args) if (SvTRUE(ERRSV)) { purple_debug(PURPLE_DEBUG_ERROR, "perl", "Perl function %s exited abnormally: %s\n", - function, SvPV(ERRSV, na)); + function, SvPVutf8_nolen(ERRSV)); (void)POPs; } else if (count != 1) { /* @@ -235,7 +234,7 @@ execute_perl(const char *function, int argc, char **args) * of hackish. I should fix it. Look how long this comment is. * Holy crap. */ - args[i] = g_strdup(SvPV(sv_args[i], na)); + args[i] = g_strdup(SvPVutf8_nolen(sv_args[i])); } } @@ -381,7 +380,6 @@ purple_perl_sv_from_value(const PurpleValue *value, va_list list) void * purple_perl_data_from_sv(PurpleValue *value, SV *sv) { - STRLEN na; switch (purple_value_get_type(value)) { case PURPLE_TYPE_BOOLEAN: return (void *)SvIV(sv); @@ -391,7 +389,7 @@ purple_perl_data_from_sv(PurpleValue *value, SV *sv) case PURPLE_TYPE_ULONG: return (void *)SvUV(sv); case PURPLE_TYPE_INT64: return (void *)SvIV(sv); case PURPLE_TYPE_UINT64: return (void *)SvUV(sv); - case PURPLE_TYPE_STRING: return g_strdup((void *)SvPV(sv, na)); + case PURPLE_TYPE_STRING: return g_strdup(SvPVutf8_nolen(sv)); case PURPLE_TYPE_POINTER: return (void *)SvIV(sv); case PURPLE_TYPE_BOXED: return (void *)SvIV(sv); diff --git a/libpurple/plugins/perl/perl-handlers.c b/libpurple/plugins/perl/perl-handlers.c index 50917ddfa9..2ad2b4c3eb 100644 --- a/libpurple/plugins/perl/perl-handlers.c +++ b/libpurple/plugins/perl/perl-handlers.c @@ -23,7 +23,6 @@ purple_perl_plugin_action_cb(PurplePluginAction *action) gchar *hvname; PurplePlugin *plugin; PurplePerlScript *gps; - STRLEN na; dSP; plugin = action->plugin; @@ -54,7 +53,7 @@ purple_perl_plugin_action_cb(PurplePluginAction *action) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl plugin action function exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } PUTBACK; @@ -68,7 +67,6 @@ purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context) GList *l = NULL; PurplePerlScript *gps; int i = 0, count = 0; - STRLEN na; dSP; gps = plugin->info->extra_info; @@ -94,7 +92,7 @@ purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl plugin actions lookup exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } if (count == 0) @@ -102,14 +100,10 @@ purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context) for (i = 0; i < count; i++) { SV *sv; - gchar *label; - PurplePluginAction *act = NULL; + PurplePluginAction *act; sv = POPs; - label = SvPV_nolen(sv); - /* XXX I think this leaks, but doing it without the strdup - * just showed garbage */ - act = purple_plugin_action_new(g_strdup(label), purple_perl_plugin_action_cb); + act = purple_plugin_action_new(SvPVutf8_nolen(sv), purple_perl_plugin_action_cb); l = g_list_prepend(l, act); } @@ -129,7 +123,6 @@ purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin) MAGIC *mg; GtkWidget *ret; PurplePerlScript *gps; - STRLEN na; dSP; gps = plugin->info->extra_info; @@ -147,7 +140,7 @@ purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl gtk plugin frame init exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } /* We have a Gtk2::Frame on top of the stack */ @@ -173,7 +166,6 @@ purple_perl_get_plugin_frame(PurplePlugin *plugin) int count; PurplePerlScript *gps; PurplePluginPrefFrame *ret_frame; - STRLEN na; dSP; gps = (PurplePerlScript *)plugin->info->extra_info; @@ -192,7 +184,7 @@ purple_perl_get_plugin_frame(PurplePlugin *plugin) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl plugin prefs frame init exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } if (count != 1) @@ -249,7 +241,6 @@ perl_timeout_cb(gpointer data) { PurplePerlTimeoutHandler *handler = data; gboolean ret = FALSE; - STRLEN na; dSP; ENTER; @@ -263,7 +254,7 @@ perl_timeout_cb(gpointer data) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl timeout function exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } ret = POPi; @@ -291,7 +282,6 @@ perl_signal_cb(va_list args, void *data) PurpleValue *ret_value, **values; SV **sv_args; DATATYPE **copy_args; - STRLEN na; dSP; ENTER; @@ -334,7 +324,7 @@ perl_signal_cb(va_list args, void *data) if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl function exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } /* See if any parameters changed. */ @@ -373,14 +363,13 @@ perl_signal_cb(va_list args, void *data) if (strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) { g_free(*((char **)copy_args[i])); *((char **)copy_args[i]) = - g_strdup(SvPV(sv_args[i], na)); + g_strdup(SvPVutf8_nolen(sv_args[i])); } + /* Clean up sv_args[i] - we're done with it */ + sv_2mortal(sv_args[i]); break; case PURPLE_TYPE_POINTER: - *((void **)copy_args[i]) = (void *)SvIV(sv_args[i]); - break; - case PURPLE_TYPE_BOXED: *((void **)copy_args[i]) = (void *)SvIV(sv_args[i]); break; @@ -392,6 +381,7 @@ perl_signal_cb(va_list args, void *data) break; } + #if 0 *((void **)copy_args[i]) = purple_perl_data_from_sv(values[i], sv_args[i]); @@ -564,7 +554,6 @@ perl_cmd_cb(PurpleConversation *conv, const gchar *command, gchar **args, gchar **error, void *data) { int i = 0, count, ret_value = PURPLE_CMD_RET_OK; - STRLEN na; SV *cmdSV, *tmpSV, *convSV; PurplePerlCmdHandler *handler = data; @@ -604,7 +593,7 @@ perl_cmd_cb(PurpleConversation *conv, const gchar *command, if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl plugin command function exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } SPAGAIN; @@ -718,7 +707,6 @@ perl_pref_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) { PurplePerlPrefsHandler *handler = data; - STRLEN na; dSP; ENTER; @@ -767,7 +755,7 @@ perl_pref_cb(const char *name, PurplePrefType type, gconstpointer value, if (SvTRUE(ERRSV)) { purple_debug_error("perl", "Perl prefs callback function exited abnormally: %s\n", - SvPV(ERRSV, na)); + SvPVutf8_nolen(ERRSV)); } PUTBACK; diff --git a/libpurple/plugins/perl/perl.c b/libpurple/plugins/perl/perl.c index 44e9fc3b62..37c967cb8b 100644 --- a/libpurple/plugins/perl/perl.c +++ b/libpurple/plugins/perl/perl.c @@ -288,24 +288,24 @@ probe_perl_plugin(PurplePlugin *plugin) ret = perl_parse(prober, xs_init, argc, argv, NULL); if (ret != 0) { - STRLEN len; const char * errmsg = "Unknown error"; if (SvTRUE(ERRSV)) - errmsg = SvPV(ERRSV, len); + errmsg = SvPVutf8_nolen(ERRSV); purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n", plugin->path, ret, errmsg); + status = FALSE; goto cleanup; } ret = perl_run(prober); if (ret != 0) { - STRLEN len; const char * errmsg = "Unknown error"; if (SvTRUE(ERRSV)) - errmsg = SvPV(ERRSV, len); + errmsg = SvPVutf8_nolen(ERRSV); purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n", plugin->path, ret, errmsg); + status = FALSE; goto cleanup; } @@ -335,7 +335,6 @@ probe_perl_plugin(PurplePlugin *plugin) PurplePluginInfo *info; PurplePerlScript *gps; char *basename; - STRLEN len; info = g_new0(PurplePluginInfo, 1); gps = g_new0(PurplePerlScript, 1); @@ -358,9 +357,9 @@ probe_perl_plugin(PurplePlugin *plugin) /* We know this one exists. */ key = hv_fetch(plugin_info, "name", strlen("name"), 0); - info->name = g_strdup(SvPV(*key, len)); + info->name = g_strdup(SvPVutf8_nolen(*key)); /* Set id here in case we don't find one later. */ - info->id = g_strdup(SvPV(*key, len)); + info->id = g_strdup(info->name); #ifdef PURPLE_GTKPERL if ((key = hv_fetch(plugin_info, "GTK_UI", @@ -370,40 +369,40 @@ probe_perl_plugin(PurplePlugin *plugin) if ((key = hv_fetch(plugin_info, "url", strlen("url"), 0))) - info->homepage = g_strdup(SvPV(*key, len)); + info->homepage = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "author", strlen("author"), 0))) - info->author = g_strdup(SvPV(*key, len)); + info->author = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "summary", strlen("summary"), 0))) - info->summary = g_strdup(SvPV(*key, len)); + info->summary = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "description", strlen("description"), 0))) - info->description = g_strdup(SvPV(*key, len)); + info->description = g_strdup(SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "version", strlen("version"), 0))) - info->version = g_strdup(SvPV(*key, len)); + info->version = g_strdup(SvPVutf8_nolen(*key)); /* We know this one exists. */ key = hv_fetch(plugin_info, "load", strlen("load"), 0); gps->load_sub = g_strdup_printf("%s::%s", gps->package, - SvPV(*key, len)); + SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "unload", strlen("unload"), 0))) gps->unload_sub = g_strdup_printf("%s::%s", gps->package, - SvPV(*key, len)); + SvPVutf8_nolen(*key)); if ((key = hv_fetch(plugin_info, "id", strlen("id"), 0))) { g_free(info->id); info->id = g_strdup_printf("perl-%s", - SvPV(*key, len)); + SvPVutf8_nolen(*key)); } /********************************************************/ @@ -424,7 +423,7 @@ probe_perl_plugin(PurplePlugin *plugin) * will create a frame for us */ gps->prefs_sub = g_strdup_printf("%s::%s", gps->package, - SvPV(*key, len)); + SvPVutf8_nolen(*key)); info->prefs_info = &ui_info; } @@ -435,7 +434,7 @@ probe_perl_plugin(PurplePlugin *plugin) * will create a frame for us */ gps->gtk_prefs_sub = g_strdup_printf("%s::%s", gps->package, - SvPV(*key, len)); + SvPVutf8_nolen(*key)); info->ui_info = >k_ui_info; } #endif @@ -444,7 +443,7 @@ probe_perl_plugin(PurplePlugin *plugin) strlen("plugin_action_sub"), 0))) { gps->plugin_action_sub = g_strdup_printf("%s::%s", gps->package, - SvPV(*key, len)); + SvPVutf8_nolen(*key)); info->actions = purple_perl_plugin_actions; } @@ -499,11 +498,9 @@ load_perl_plugin(PurplePlugin *plugin) SPAGAIN; if (SvTRUE(ERRSV)) { - STRLEN len; - purple_debug(PURPLE_DEBUG_ERROR, "perl", "Perl function %s exited abnormally: %s\n", - gps->load_sub, SvPV(ERRSV, len)); + gps->load_sub, SvPVutf8_nolen(ERRSV)); } PUTBACK; @@ -525,7 +522,7 @@ destroy_package(const char *package) SAVETMPS; PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVpv(package, strlen(package)))); + XPUSHs(sv_2mortal(newSVpv(package, 0))); PUTBACK; perl_call_pv("Purple::PerlLoader::destroy_package", @@ -563,11 +560,9 @@ unload_perl_plugin(PurplePlugin *plugin) SPAGAIN; if (SvTRUE(ERRSV)) { - STRLEN len; - purple_debug(PURPLE_DEBUG_ERROR, "perl", "Perl function %s exited abnormally: %s\n", - gps->load_sub, SvPV(ERRSV, len)); + gps->unload_sub, SvPVutf8_nolen(ERRSV)); } PUTBACK; @@ -592,21 +587,23 @@ destroy_perl_plugin(PurplePlugin *plugin) PurplePerlScript *gps; g_free(plugin->info->name); - g_free(plugin->info->version); + g_free(plugin->info->id); + g_free(plugin->info->homepage); + g_free(plugin->info->author); g_free(plugin->info->summary); g_free(plugin->info->description); - g_free(plugin->info->author); - g_free(plugin->info->homepage); + g_free(plugin->info->version); gps = (PurplePerlScript *)plugin->info->extra_info; if (gps != NULL) { + g_free(gps->package); g_free(gps->load_sub); g_free(gps->unload_sub); - g_free(gps->package); g_free(gps->prefs_sub); #ifdef PURPLE_GTKPERL g_free(gps->gtk_prefs_sub); #endif + g_free(gps->plugin_action_sub); g_free(gps); plugin->info->extra_info = NULL; } |