1. 17 Jun, 2022 2 commits
  2. 01 Jun, 2022 1 commit
  3. 10 May, 2022 1 commit
  4. 05 May, 2022 1 commit
  5. 30 Mar, 2022 3 commits
  6. 19 Jan, 2022 1 commit
  7. 13 Dec, 2021 1 commit
    • StefanBruens's avatar
      Fix segfaults due to strict ISO C99 mode enforcement · 50a624bd
      StefanBruens authored
      Commit 7cc63be3 ("Makefile: Add support for POSIX make) changed
      the compilation mode to strict ISO C99 (-std=c99), which removed the
      declarations of strdup and strcasecmp. As the implicit return value is
      int instead of char*, the upper address bytes are discarded on e.g.
      x86_64 (sizeof(int) == 4), the resulting code crashes.
      
      Add the declarations back by using Posix 2008 mode, and also include
      strings.h where required for strcasecmp.
      
      Compilation may still fail when the compiler binary is not available as
      c99, .POSIX mode sets CC=c99. Use e.g. "CC=cc make all" to circumvent.
      50a624bd
  8. 26 Oct, 2021 1 commit
  9. 11 Oct, 2021 1 commit
    • Igor Kushnir's avatar
      test-mime-data: fail when an error occurs · d64963b0
      Igor Kushnir authored
      This change should prevent test file omissions like the one fixed in
      shared-mime-info@66c73d06
      
      Always print summary. The condition (error > 0 || failed > 0) was
      incomplete: xmatch > 0 should have been checked as well.
      shared-mime-info's test_mime.sh passes a list with many expected
      failures to test-mime-data, so the condition failed > 0 is always true.
      Therefore printing the summary unconditionally makes no difference,
      unless there are other users of test-mime-data that don't have expected
      failures in their test case lists.
      d64963b0
  10. 07 Oct, 2021 1 commit
  11. 28 Sep, 2021 1 commit
  12. 27 Sep, 2021 1 commit
  13. 13 Apr, 2021 1 commit
  14. 18 Mar, 2021 1 commit
    • Kamil Dudka's avatar
      Fix fd leak in error path · 722325fb
      Kamil Dudka authored and Bastien Nocera's avatar Bastien Nocera committed
      shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: alloc_fn: Storage is returned from allocation function "fopen".
      shared-mime-info-2.1/xdgmime/src/print-mime-data.c:66: var_assign: Assigning: "file" = storage returned from "fopen(filename, "r")".
      shared-mime-info-2.1/xdgmime/src/print-mime-data.c:80: leaked_storage: Variable "file" going out of scope leaks the storage it points to.
         78|       {
         79|         printf ("Failed to allocate memory for file %s\n", filename);
         80|->       return;
         81|       }
         82|
      
      shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: alloc_fn: Storage is returned from allocation function "fopen".
      shared-mime-info-2.1/xdgmime/src/test-mime-data.c:113: var_assign: Assigning: "file" = storage returned from "fopen(path, "r")".
      shared-mime-info-2.1/xdgmime/src/test-mime-data.c:131: leaked_storage: Variable "file" going out of scope leaks the storage it points to.
        129|         error++;
        130|
        131|->       return;
        132|       }
        133|
      722325fb
  15. 06 Jan, 2021 1 commit
  16. 04 Jan, 2021 11 commits
    • Emmanuel Fleury's avatar
      Fix signedness warnings in src/xdgmimecache.c · 8400caea
      Emmanuel Fleury authored
      xdgmimecache.c: In function ‘dump_glob_node’:
      xdgmimecache.c:1064:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
       1064 |     for (i = 0; i < n_children; i++)
            |                   ^
      xdgmimecache.c: In function ‘_xdg_test_cache_glob_dump’:
      xdgmimecache.c:1082:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
       1082 |     for (j = 0; j < n_entries; j++)
            |                   ^
      8400caea
    • Emmanuel Fleury's avatar
      Fix signedness warnings in src/xdgmimecache.c:__gio_xdg_cache_list_mime_parents() · c3c72e75
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘__gio_xdg_cache_list_mime_parents’:
      src/xdgmimecache.c:1021:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
       1021 |       for (j = 0; j < n_entries; j++)
            |                     ^
      src/xdgmimecache.c:1031:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
       1031 |        for (k = 0; k < n_parents && p < 127; k++)
            |                      ^
      c3c72e75
    • Emmanuel Fleury's avatar
      Fix signedness warning in src/xdgmimecache.c:__gio_xdg_cache_mime_type_subclass() · 28374bc9
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘__gio_xdg_cache_mime_type_subclass’:
      src/xdgmimecache.c:968:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        968 |        for (j = 0; j < n_parents; j++)
            |                      ^
      28374bc9
    • Emmanuel Fleury's avatar
      Fix signedness warning in src/xdgmimecache.c:cache_glob_node_lookup_suffix() · f0ea85c3
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘cache_glob_node_lookup_suffix’:
      src/xdgmimecache.c:532:37: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        532 |        while (n < n_mime_types && i < n_children)
            |                                     ^
      f0ea85c3
    • Emmanuel Fleury's avatar
      Fix signedness warning in rc/xdgmimecache.c:cache_glob_lookup_fnmatch() · 4a235aee
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘cache_glob_lookup_fnmatch’:
      src/xdgmimecache.c:453:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        453 |       for (j = 0; j < n_entries && n < n_mime_types; j++)
            |                     ^
      4a235aee
    • Emmanuel Fleury's avatar
      Fix signedness warning in src/xdgmimecache.c:cache_magic_compare_to_data() · 5db369e5
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘cache_magic_compare_to_data’:
      src/xdgmimecache.c:260:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        260 |   for (i = 0; i < n_matchlets; i++)
            |                 ^
      5db369e5
    • Emmanuel Fleury's avatar
      Fix signedness warning in src/xdgmimecache.c:cache_magic_matchlet_compare() · 6b797c24
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘cache_magic_matchlet_compare’:
      src/xdgmimecache.c:235:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        235 |       for (i = 0; i < n_children; i++)
            |                     ^
      6b797c24
    • Emmanuel Fleury's avatar
      Fix signedness warnings in src/xdgmimecache.c:cache_magic_matchlet_compare_to_data() · 32c3930f
      Emmanuel Fleury authored
      src/xdgmimecache.c: In function ‘cache_magic_matchlet_compare_to_data’:
      src/xdgmimecache.c:181:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        181 |   for (i = range_start; i < range_start + range_length; i++)
            |                           ^
      src/xdgmimecache.c:190:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        190 |    for (j = 0; j < data_length; j++)
            |                  ^
      src/xdgmimecache.c:202:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘xdg_uint32_t’ {aka ‘unsigned int’}
        202 |    for (j = 0; j < data_length; j++)
            |                  ^
      32c3930f
    • Emmanuel Fleury's avatar
      Fix signedness warnings in src/xdgmimemagic.c:_xdg_mime_magic_matchlet_compare_to_data() · 0a4456a2
      Emmanuel Fleury authored
      src/xdgmimemagic.c: In function ‘_xdg_mime_magic_matchlet_compare_to_data’:
      src/xdgmimemagic.c:527:32: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        527 |   for (i = matchlet->offset; i < matchlet->offset + matchlet->range_length; i++)
            |                                ^
      src/xdgmimemagic.c:536:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        536 |    for (j = 0; j < matchlet->value_length; j++)
            |                  ^
      src/xdgmimemagic.c:548:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        548 |    for (j = 0; j <  matchlet->value_length; j++)
            |                  ^
      0a4456a2
    • Emmanuel Fleury's avatar
      Fix signedness warnings in src/xdgmimemagic.c:_xdg_mime_magic_parse_magic_line() · cc224922
      Emmanuel Fleury authored
      src/xdgmimemagic.c: In function ‘_xdg_mime_magic_parse_magic_line’:
      src/xdgmimemagic.c:406:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        406 |   if (bytes_read != matchlet->value_length)
            |                  ^~
      src/xdgmimemagic.c:426:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        426 |       if (bytes_read != matchlet->value_length)
            |                      ^~
      src/xdgmimemagic.c:464:34: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’
        464 |       if (matchlet->range_length == -1)
            |                                  ^~
      src/xdgmimemagic.c:488:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’
        488 |    for (i = 0; i < matchlet->value_length; i = i + matchlet->word_size)
            |                  ^
      cc224922
    • Emmanuel Fleury's avatar
      Fix signedness warning in src/xdgmimeint.c · 56235559
      Emmanuel Fleury authored
      src/xdgmimeint.c: In function ‘_xdg_binary_or_text_fallback’:
      src/xdgmimeint.c:195:28: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
        195 |   for (i = 0; i < 128 && i < len; ++i)
            |                            ^
      56235559
  17. 30 Dec, 2020 1 commit
    • David Faure's avatar
      Fix fallback after multiple matching globs · de283fc4
      David Faure authored
      If the result from magic sniffing doesn't correspond to
      any of the matching globs (even via inheritance), and
      there *were* matching globs, then don't return the result
      from magic sniffing. This is too unreliable, and contradicts
      the fact that if there was just one glob, the glob would win
      (not the magic). So in that case, fallback to one of the glob
      matches.
      
      This required removing the code in cache_magic_lookup_data
      which "cleans up" the mimetypes list (from glob matches)
      of any glob that doesn't have matching magic. This behaviour
      isn't in the spec [1], and prevents having anything to fall
      back to in the end, after noticing that the magic should
      be ignored after all.
      
      [1] https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.21.html#idm45992893989040
      
      Context: shared-mime-info#138
      de283fc4
  18. 27 Dec, 2020 1 commit
  19. 03 Jun, 2019 1 commit
  20. 19 Nov, 2018 1 commit
  21. 17 Jul, 2018 7 commits