[geany/geany-plugins] fe607c: Fix bug 3557458 -- when encrypting selected text a 0 byte gets added to the text that's being encrypted

Hans Alves git-noreply at xxxxx
Wed Oct 3 08:06:33 UTC 2012


Branch:      refs/heads/master
Author:      Hans Alves <alves.h88 at gmail.com>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 26 Aug 2012 13:30:51
Commit:      fe607cfa75950b2c9706b5585c60f8370d51a089
             https://github.com/geany/geany-plugins/commit/fe607cfa75950b2c9706b5585c60f8370d51a089

Log Message:
-----------
Fix bug 3557458 -- when encrypting selected text a 0 byte gets added to the text that's being encrypted


Modified Paths:
--------------
    geanypg/ChangeLog
    geanypg/src/helper_functions.c

Modified: geanypg/ChangeLog
5 files changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,8 @@
+2012-08-24 Hans Alves  <alves(dot)h88(at)gmail(dot)com>
+
+* Fixed bug 3557458 which caused a 0 byte to be added to the text
+  when encrypting a selection.
+
 2012-06-04 Hans Alves  <alves(dot)h88(at)gmail(dot)com>
 
 * Fixed a bug that caused an error message to appear if one of the


Modified: geanypg/src/helper_functions.c
4 files changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -137,7 +137,7 @@ void geanypg_load_buffer(gpgme_data_t * buffer)
     unsigned long size = 0;
     if (sci_has_selection(doc->editor->sci))
     {
-        size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0);
+        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);
@@ -157,7 +157,6 @@ void geanypg_load_buffer(gpgme_data_t * buffer)
 void geanypg_write_file(FILE * file)
 {
 #define BUFSIZE 2048
-
     unsigned long size;
     char buffer[BUFSIZE] = {0};
     GeanyDocument * doc = document_get_current();
@@ -177,6 +176,5 @@ void geanypg_write_file(FILE * file)
             scintilla_send_message(doc->editor->sci, SCI_APPENDTEXT, (uptr_t) size, (sptr_t) buffer);
     }
     sci_end_undo_action(doc->editor->sci);
-
 #undef BUFSIZE
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Plugins-Commits mailing list