Menu

#80 [PATCH] Fix improper conversion of pointer to integer in bookmark.c

2.2.15
closed
nobody
PATCH (2)
2023-12-16
2023-12-13
No

In bookmark.c there are a couple of calls to bmark_margin_get_initial_bookmark() in which the (integer) 'offset' parameter is supplied as a pointer to a text iterator instead. I'm not sure if that even works but with upcoming changes to gcc (scheduled for gcc 14), this will result in a compile error regarding unsupported conversion between pointer and integer.

See:
https://fedoraproject.org/wiki/Changes/PortingToModernC#Rejecting_implicit_conversions_between_integers_and_pointers_as_errors

I am currently trying to fix some such issues ahead of the release of gcc 14, so the attached patch, which calls gtk_text_iter_get_offset() on the text iterator to provide the integer offset associated with that text iterator (which appears to be the intent of the code), fixes the compilation problem. This seems right but I haven't tested the resulting editor as I'm unfamiliar with its use of bookmarks.

1 Attachments

Discussion

  • Paul Howarth

    Paul Howarth - 2023-12-13

    I tried the modified code and it seemed to work. I added a couple of bookmarks and was able to go to first/last/next/previous successfully, then delete the bookmarks, without issues.

     
  • Olivier Sessink

    Olivier Sessink - 2023-12-16

    thanks, committed revision 9014.

    I wonder if the old code actually worked, if I look at it the old code probably failed in many situations.

     
  • Olivier Sessink

    Olivier Sessink - 2023-12-16
    • status: open --> closed
     

Log in to post a comment.