Changeset b6a3fbf


Ignore:
Timestamp:
2015-08-27T07:25:07Z (5 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
aa3b61e
Parents:
3c23681
Message:

irc_channel_name_gen: handle g_convert_with_fallback failures

First fallback to ASCII without TRANSLIT, and if that fails too, just
give up by returning NULL.

Basically the same thing as 3a27896 (a netbsd specific fix), but for
channel names. This wasn't needed before because the older version of
this code caught the NULL from the ASCIITRANSLIT attempt and gave up
immediately, while the refactored version lacked null checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    r3c23681 rb6a3fbf  
    593593
    594594        translit_name = g_convert_with_fallback(hint, -1, "ASCII//TRANSLIT", "UTF-8", "", NULL, &bytes_written, NULL);
     595
     596        if (!translit_name) {
     597                /* Same thing as in nick_gen() in nick.c, try again without //TRANSLIT */
     598                translit_name = g_convert_with_fallback(hint, -1, "ASCII", "UTF-8", "", NULL, &bytes_written, NULL);
     599        }
     600
     601        if (!translit_name) {
     602                return NULL;
     603        }
     604
    595605        if (bytes_written > MAX_NICK_LENGTH) {
    596606                translit_name[MAX_NICK_LENGTH] = '\0';
Note: See TracChangeset for help on using the changeset viewer.