Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sat, 12 Aug 2023 22:52:54 UTC Commit: 52f3884823b247288f53fce00f1f0e27ed8a87fb https://github.com/geany/geany-plugins/commit/52f3884823b247288f53fce00f1f0e...
Log Message: ----------- geanypg: Update because of Scintilla 5.1.5 SCI_GETSELTEXT change
The SCI_GETSELTEXT method of Scintilla changed so it returns a smaller number of bytes than before. Instead, use the sci_ wrappers which are independent of Geany version and should behave the same way regardless of Geany version.
Modified Paths: -------------- geanypg/src/helper_functions.c
Modified: geanypg/src/helper_functions.c 17 lines changed, 5 insertions(+), 12 deletions(-) =================================================================== @@ -133,24 +133,17 @@ void geanypg_load_buffer(gpgme_data_t * buffer) { /* gpgme_data_new_from_mem(buffer, text, size, 0); */ GeanyDocument * doc = document_get_current(); - char * data = NULL; - unsigned long size = 0; + char * data; if (sci_has_selection(doc->editor->sci)) { - size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0) - 1; - data = (char *) malloc(size + 1); - scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, (sptr_t)data); - gpgme_data_new_from_mem(buffer, data, size, 1); + data = sci_get_selection_contents(doc->editor->sci); } else { - size = scintilla_send_message(doc->editor->sci, SCI_GETLENGTH, 0, 0); - data = (char *) malloc(size + 1); - scintilla_send_message(doc->editor->sci, SCI_GETTEXT, (uptr_t)(size + 1), (sptr_t)data); - gpgme_data_new_from_mem(buffer, data, size, 1); + data = sci_get_contents(doc->editor->sci, -1); } - if (data) /* if there is no text data may still be NULL */ - free(data); + gpgme_data_new_from_mem(buffer, data, strlen(data), 1); + free(data); gpgme_data_set_encoding(*buffer, GPGME_DATA_ENCODING_BINARY); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org