Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug 3557458 and some compiler warnings #69

Merged
merged 2 commits into from Oct 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions geanypg/ChangeLog
@@ -1,3 +1,9 @@
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.
Fixed some compiler warnings.

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
Expand Down
8 changes: 4 additions & 4 deletions geanypg/src/encrypt_cb.c
Expand Up @@ -73,7 +73,7 @@ void geanypg_encrypt_cb(GtkMenuItem * menuitem, gpointer user_data)
if (geanypg_encrypt_selection_dialog(&ed, &recp, &sign))
{
int flags = 0;
int abort = 0;
int stop = 0;
gpgme_key_t * key = recp;
while (*key)
{
Expand All @@ -87,13 +87,13 @@ void geanypg_encrypt_cb(GtkMenuItem * menuitem, gpointer user_data)
(*key)->uids->uid, geanypg_validity((*key)->owner_trust)))
flags = GPGME_ENCRYPT_ALWAYS_TRUST;
else
abort = 1;
stop = 1;
}
++key;
}
if (*recp && !abort)
if (*recp && !stop)
geanypg_encrypt(&ed, recp, sign, flags);
else if (!abort && dialogs_show_question(_("No recipients were selected,\nuse symetric cipher?")))
else if (!stop && dialogs_show_question(_("No recipients were selected,\nuse symetric cipher?")))
geanypg_encrypt(&ed, NULL, sign, flags);
}
if (recp)
Expand Down
4 changes: 1 addition & 3 deletions geanypg/src/helper_functions.c
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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
}
2 changes: 0 additions & 2 deletions geanypg/src/verify_aux.c
Expand Up @@ -160,13 +160,11 @@ static char * geanypg_result(gpgme_signature_t sig)
void geanypg_check_sig(encrypt_data * ed, gpgme_signature_t sig)
{
GtkWidget * dialog;
gpgme_sigsum_t summary;
char buffer[512] = {0};
char * result;
strncpy(buffer, sig->fpr, 40);
buffer[40] = 0;
geanypg_get_keys_with_fp(ed, buffer);
summary = sig->summary;
result = geanypg_result(sig);

dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(geany->main_widgets->window),
Expand Down