Skip to content

Bad use of strcasecmp() on UTF-8 encoded strings #13

Closed

Description

@mowgli

For example, in dupe.c line 1139:

if (strcasecmp(a->fd->name, b->fd->name) != 0) return FALSE;

Use of the non-portable strcasecmp() on UTF-8 encoded names, which is wrong.

See http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html\#g-strncasecmp

Reported by: zas_

Activity

  1. mowgli commented on May 8, 2008

    @mowgli
    ContributorAuthor

    make use of g_utf8_collate() and g_utf8_casefold() for filenames sorting

    Original comment by: zas_

  2. mowgli commented on May 8, 2008

    @mowgli
    ContributorAuthor

    Logged In: YES
    user_id=2049043
    Originator: YES

    Here is a patch that make use of g_utf8_collate() and g_utf8_casefold() for filenames sorting.
    Collate keys are cached in FileData struct to speedup the sort.
    Please test and comment.
    File Added: geeqie_filename_collate.patch

    Original comment by: zas_

  3. mowgli commented on May 8, 2008

    @mowgli
    ContributorAuthor

    Logged In: YES
    user_id=2049043
    Originator: YES

    Situation slighly improved in revisions 697, 698, 699:
    g_strcasecmp() -> g_ascii_strcasecmp()
    g_strncasecmp() -> g_ascii_strncasecmp()

    Original comment by: zas_

  4. mowgli commented on Jun 5, 2008

    @mowgli
    ContributorAuthor

    Logged In: YES
    user_id=2049043
    Originator: YES

    An updated version of proposed patch was committed as revision 879.

    Original comment by: zas_

  5. mowgli commented on Jun 5, 2008

    @mowgli
    ContributorAuthor
    • status: open --> closed-fixed

    Original comment by: zas_

  6. mowgli commented on Jun 5, 2008

    @mowgli
    ContributorAuthor

    Logged In: YES
    user_id=2049043
    Originator: YES

    Another part of the fix was committed as revision 880.

    Original comment by: zas_

  7. self-assigned this
    on Apr 6, 2016
  8. removed their assignment
    on Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions