Branch: refs/heads/master Author: Belousov Vladimir vlad.belos@gmail.com Committer: GitHub noreply@github.com Date: Sat, 11 Sep 2021 12:55:29 UTC Commit: ddf06e8a1ce945a9d3dbdf482dc9aeb8478f080c https://github.com/geany/geany-plugins/commit/ddf06e8a1ce945a9d3dbdf482dc9ae...
Log Message: ----------- Fix crashes in Git Changebar, Lua, Macro and Numbered Bookmarks plugins
On Windows 64 platform these plugins crashed due to a different size of glong and sptr_t.
Modified Paths: -------------- geanylua/glspi_sci.c geanymacro/src/geanymacro.c geanynumberedbookmarks/src/geanynumberedbookmarks.c git-changebar/src/gcb-plugin.c
Modified: geanylua/glspi_sci.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -452,7 +452,7 @@ static gint glspi_copy(lua_State* L) if (!lua_isstring(L,1)) {return FAIL_STRING_ARG(1);} content=lua_tostring(L,1); len=strlen(content); - if (len) { scintilla_send_message(doc->editor->sci,SCI_COPYTEXT,len,(glong)content); } + if (len) { scintilla_send_message(doc->editor->sci,SCI_COPYTEXT,len,(sptr_t)content); } push_number(L, len); return 1; default:
Modified: geanymacro/src/geanymacro.c 16 lines changed, 8 insertions(+), 8 deletions(-) =================================================================== @@ -30,7 +30,7 @@ typedef struct { gint message; gulong wparam; - glong lparam; + sptr_t lparam; } MacroEvent;
/* structure to hold details of a macro */ @@ -370,7 +370,7 @@ static void ReplayMacro(Macro *m) break; }
- scintilla_send_message(sci,me->message,me->wparam,(glong)clipboardcontents); + scintilla_send_message(sci,me->message,me->wparam,(sptr_t)clipboardcontents); } else scintilla_send_message(sci,me->message,me->wparam,me->lparam); @@ -431,20 +431,20 @@ static MacroEvent * GetMacroEventFromString(gchar **s,gint *k) case SCI_SEARCHNEXT: case SCI_SEARCHPREV: /* get text */ - me->lparam=(glong)(g_strcompress(s[(*k)++])); + me->lparam=(sptr_t)(g_strcompress(s[(*k)++])); /* if text is empty string replace with NULL to signify use clipboard */ if((*((gchar*)(me->lparam)))==0) { g_free((gchar*)me->lparam); - me->lparam=(glong)NULL; + me->lparam=(sptr_t)NULL; }
/* get search flags */ me->wparam=strtoll(s[(*k)++],NULL,10); break; case SCI_REPLACESEL: /* get text */ - me->lparam=(glong)(g_strcompress(s[(*k)++])); + me->lparam=(sptr_t)(g_strcompress(s[(*k)++])); break; /* default handler for messages without extra data */ default: @@ -556,7 +556,7 @@ static gboolean Notification_Handler(GObject *obj,GeanyEditor *ed,SCNotification me->lparam=(me->message==SCI_SEARCHNEXT || me->message==SCI_SEARCHPREV || me->message==SCI_REPLACESEL) - ?((glong) g_strdup((gchar *)(nt->lParam))) : nt->lParam; + ?((sptr_t) g_strdup((gchar *)(nt->lParam))) : nt->lParam;
/* more efficient to create reverse list and reverse it at the end */ RecordingMacro->MacroEvents=g_slist_prepend(RecordingMacro->MacroEvents,me); @@ -1971,15 +1971,15 @@ static void EditMacroElements(Macro *m)
/* Special handling for text inserting, duplicate inserted string */ if(me->message==SCI_REPLACESEL) - me->lparam=(glong)((cTemp!=NULL)?g_strdup(cTemp):g_strdup("")); + me->lparam=(sptr_t)((cTemp!=NULL)?g_strdup(cTemp):g_strdup(""));
/* Special handling for search */ if(me->message==SCI_SEARCHNEXT || me->message==SCI_SEARCHPREV) { cTemp2=strchr(cTemp,','); cTemp2++;
- me->lparam=(glong)(((*cTemp2)==0)?NULL:g_strdup(cTemp2)); + me->lparam=(sptr_t)(((*cTemp2)==0)?NULL:g_strdup(cTemp2)); me->wparam=strtoll(cTemp,NULL,10); }
Modified: geanynumberedbookmarks/src/geanynumberedbookmarks.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -842,7 +842,7 @@ static gint NextFreeMarker(GeanyDocument* doc) break;
/* insert new marker */ - scintilla_send_message(sci,SCI_MARKERDEFINEPIXMAP,m,(glong)(aszMarkerImages[k])); + scintilla_send_message(sci,SCI_MARKERDEFINEPIXMAP,m,(sptr_t)(aszMarkerImages[k])); scintilla_send_message(sci,SCI_MARKERADD,l,m);
/* update markers record */ @@ -880,7 +880,7 @@ static void SetMarker(GeanyDocument* doc,gint bookmarkNumber,gint markerNumber,g
/* insert new marker */ scintilla_send_message(sci,SCI_MARKERDEFINEPIXMAP,markerNumber, - (glong)(aszMarkerImages[bookmarkNumber])); + (sptr_t)(aszMarkerImages[bookmarkNumber])); scintilla_send_message(sci,SCI_MARKERADD,line,markerNumber);
/* update record of which bookmark uses which marker */
Modified: git-changebar/src/gcb-plugin.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -801,7 +801,7 @@ get_widget_for_buf_range (GeanyDocument *doc, "UTF-8", doc->encoding, NULL); }
- scintilla_send_message (sci, SCI_ADDTEXT, buf_len, (glong) buf); + scintilla_send_message (sci, SCI_ADDTEXT, buf_len, (sptr_t) buf);
if (free_buf) { g_free (buf); @@ -1144,7 +1144,7 @@ insert_buf_range (GeanyDocument *doc, "UTF-8", doc->encoding, NULL); }
- scintilla_send_message (old_sci, SCI_ADDTEXT, old_buf_len, (glong) old_buf); + scintilla_send_message (old_sci, SCI_ADDTEXT, old_buf_len, (sptr_t) old_buf);
old_pos_start = sci_get_position_from_line (old_sci, old_start); old_pos_end = sci_get_position_from_line (old_sci, old_start + old_lines);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).