[geany/geany-plugins] e04842: Merging b4n/fixes/geanylua
Frank Lanitz
git-noreply at xxxxx
Sat Jun 16 10:23:26 UTC 2012
Branch: refs/heads/master
Author: Frank Lanitz <frank at frank.uvena.de>
Committer: Frank Lanitz <frank at frank.uvena.de>
Date: Sat, 16 Jun 2012 10:23:26
Commit: e0484277debf5d2c9f110040e1aeb0f81579b12c
https://github.com/geany/geany-plugins/commit/e0484277debf5d2c9f110040e1aeb0f81579b12c
Log Message:
-----------
Merging b4n/fixes/geanylua
A couple of fixes for GeanyLUA
Modified Paths:
--------------
geanylua/glspi.h
geanylua/glspi_app.c
geanylua/glspi_init.c
geanylua/glspi_keycmd.h
geanylua/glspi_run.c
geanylua/glspi_sci.c
geanylua/glspi_sci.h
geanylua/gsdlg_lua.c
Modified: geanylua/glspi.h
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -95,7 +95,7 @@
#ifdef NEED_FAIL_ARG_TYPE
/* Pushes an error message onto Lua stack if script passes a wrong arg type */
-static gint glspi_fail_arg_type(lua_State *L, const gchar *func, gint argnum, gchar *type)
+static gint glspi_fail_arg_type(lua_State *L, const gchar *func, gint argnum, const gchar *type)
{
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
" expected type \"%s\" for argument #%d\n"),
@@ -109,7 +109,7 @@ static gint glspi_fail_arg_type(lua_State *L, const gchar *func, gint argnum, gc
#ifdef NEED_FAIL_ARG_TYPES
/* Same as above, but for two overloaded types, eg "string" OR "number" */
static gint glspi_fail_arg_types(
- lua_State *L, const gchar *func, gint argnum, gchar *type1, gchar *type2)
+ lua_State *L, const gchar *func, gint argnum, const gchar *type1, const gchar *type2)
{
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
" expected type \"%s\" or \"%s\" for argument #%d\n"),
@@ -123,7 +123,7 @@ static gint glspi_fail_arg_types(
#ifdef NEED_FAIL_ELEM_TYPE
/*Pushes an error message onto Lua stack if table contains wrong element type*/
static gint glspi_fail_elem_type(
- lua_State *L, const gchar *func, gint argnum, gint idx, gchar *type)
+ lua_State *L, const gchar *func, gint argnum, gint idx, const gchar *type)
{
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
" invalid table in argument #%d:\n"
Modified: geanylua/glspi_app.c
13 files changed, 7 insertions(+), 6 deletions(-)
===================================================================
@@ -71,7 +71,7 @@ static gint glspi_project(lua_State* L)
}
}
-static gchar *glspi_script_dir = NULL;
+static const gchar *glspi_script_dir = NULL;
static gint glspi_appinfo(lua_State* L)
{
@@ -109,7 +109,7 @@ static gint glspi_xsel(lua_State* L)
{
if (lua_gettop(L)>0) {
if (lua_isstring(L,1)) {
- guint len;
+ gsize len;
const gchar*txt=lua_tolstring(L,1,&len);
gtk_clipboard_set_text(CLIPBOARD,txt,len);
} else {
@@ -192,7 +192,7 @@ static gint glspi_stat(lua_State* L)
if (!lua_isstring(L,1)) { return FAIL_STRING_ARG(1); }
fn=lua_tostring(L,1);
if (sf(fn,&st)==0) {
- gchar *ft=NULL;
+ const gchar *ft=NULL;
switch ( st.st_mode & S_IFMT) {
case S_IFBLK:ft="b"; break;
case S_IFCHR:ft="c"; break;
@@ -347,7 +347,8 @@ static void glspi_init_key_cmd_hash(void)
key_cmd_hash=g_hash_table_new(g_str_hash,g_str_equal);
for (i=0;key_cmd_hash_entries[i].name; i++) {
g_hash_table_insert(
- key_cmd_hash,key_cmd_hash_entries[i].name,&key_cmd_hash_entries[i]);
+ key_cmd_hash,(gpointer) key_cmd_hash_entries[i].name,
+ &key_cmd_hash_entries[i]);
}
}
@@ -579,7 +580,7 @@ static gint glspi_keygrab(lua_State* L)
if (prompt && doc && doc->is_valid ) {
gint fvl=scintilla_send_message(doc->editor->sci,SCI_GETFIRSTVISIBLELINE, 0,0);
gint pos=sci_get_position_from_line(doc->editor->sci, fvl+1);
- scintilla_send_message(doc->editor->sci,SCI_CALLTIPSHOW,pos+3, (gint)prompt);
+ scintilla_send_message(doc->editor->sci,SCI_CALLTIPSHOW,pos+3, (glong)prompt);
}
gdk_window_add_filter(main_widgets->window->window, keygrab_cb, &km);
do {
@@ -620,7 +621,7 @@ static gint glspi_keygrab(lua_State* L)
{NULL,NULL}
};
-void glspi_init_app_funcs(lua_State *L, gchar*script_dir) {
+void glspi_init_app_funcs(lua_State *L, const gchar*script_dir) {
glspi_script_dir = script_dir;
luaL_register(L, NULL,glspi_app_funcs);
}
Modified: geanylua/glspi_init.c
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -63,7 +63,7 @@
-extern void glspi_run_script(gchar *script_file, gint caller, GKeyFile*proj, gchar *script_dir);
+extern void glspi_run_script(const gchar *script_file, gint caller, GKeyFile*proj, const gchar *script_dir);
/* Called by Geany, run a script associated with a keybinding. */
@@ -322,7 +322,7 @@ static void assign_accel(GtkWidget*w, char*fn)
-static GtkWidget* new_menu(GtkWidget *parent, gchar* script_dir, gchar*title);
+static GtkWidget* new_menu(GtkWidget *parent, const gchar* script_dir, const gchar*title);
/* GSList "for each" callback to create a menu item for each found script */
static void init_menu(gpointer data, gpointer user_data)
@@ -363,7 +363,7 @@ static void init_menu(gpointer data, gpointer user_data)
-static GtkWidget* new_menu(GtkWidget *parent, gchar* script_dir, gchar*title)
+static GtkWidget* new_menu(GtkWidget *parent, const gchar* script_dir, const gchar*title)
{
GSList *script_names=utils_get_file_list_full(script_dir, TRUE, TRUE, NULL);
if (script_names) {
Modified: geanylua/glspi_keycmd.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -11,7 +11,7 @@
typedef struct _KeyCmdHashEntry {
- gchar *name;
+ const gchar *name;
guint group;
guint key_id;
} KeyCmdHashEntry;
Modified: geanylua/glspi_run.c
22 files changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -23,7 +23,7 @@
/* basic dialog box functions */
extern void glspi_init_dlg_funcs(lua_State *L, GsDlgRunHook hook);
/* application functions */
-extern void glspi_init_app_funcs(lua_State *L, gchar*script_dir);
+extern void glspi_init_app_funcs(lua_State *L, const gchar*script_dir);
/* menu functions */
void glspi_init_mnu_funcs(lua_State *L);
@@ -53,7 +53,7 @@ static void repaint_scintilla(void)
/* Internal yes-or-no question box (not used by scripts) */
-static gboolean glspi_show_question(gchar*title, gchar*question, gboolean default_result)
+static gboolean glspi_show_question(const gchar*title, const gchar*question, gboolean default_result)
{
GtkWidget *dialog, *yes_btn, *no_btn;
GtkResponseType dv, rv;
@@ -76,7 +76,7 @@ static gboolean glspi_show_question(gchar*title, gchar*question, gboolean defaul
}
-static gboolean glspi_goto_error(gchar *fn, gint line)
+static gboolean glspi_goto_error(const gchar *fn, gint line)
{
GeanyDocument *doc=document_open_file(fn, FALSE, NULL, NULL);
if (doc) {
@@ -103,7 +103,7 @@ static gboolean glspi_goto_error(gchar *fn, gint line)
give the user an option to automatically open the file and scroll to
the offending line.
*/
-static void glspi_script_error(gchar *script_file, const gchar *msg, gboolean need_name, gint line)
+static void glspi_script_error(const gchar *script_file, const gchar *msg, gboolean need_name, gint line)
{
GtkWidget *dialog;
if (need_name) {
@@ -336,7 +336,7 @@ static gint glspi_traceback(lua_State *L)
The set_*_token functions assign default values for module-level variables
*/
-static void set_string_token(lua_State *L, gchar*name, gchar*value)
+static void set_string_token(lua_State *L, const gchar*name, const gchar*value)
{
lua_getglobal(L, LUA_MODULE_NAME);
if (lua_istable(L, -1)) {
@@ -350,7 +350,7 @@ static void set_string_token(lua_State *L, gchar*name, gchar*value)
-static void set_numeric_token(lua_State *L, gchar*name, gint value)
+static void set_numeric_token(lua_State *L, const gchar*name, gint value)
{
lua_getglobal(L, LUA_MODULE_NAME);
if (lua_istable(L, -1)) {
@@ -364,7 +364,7 @@ static void set_numeric_token(lua_State *L, gchar*name, gint value)
-static void set_boolean_token(lua_State *L, gchar*name, gboolean value)
+static void set_boolean_token(lua_State *L, const gchar*name, gboolean value)
{
lua_getglobal(L, LUA_MODULE_NAME);
if (lua_istable(L, -1)) {
@@ -378,7 +378,7 @@ static void set_boolean_token(lua_State *L, gchar*name, gboolean value)
-static void set_keyfile_token(lua_State *L, gchar*name, GKeyFile* value)
+static void set_keyfile_token(lua_State *L, const gchar*name, GKeyFile* value)
{
if (!value) {return;}
lua_getglobal(L, LUA_MODULE_NAME);
@@ -393,7 +393,7 @@ static void set_keyfile_token(lua_State *L, gchar*name, GKeyFile* value)
-static void show_error(lua_State *L, gchar *script_file)
+static void show_error(lua_State *L, const gchar *script_file)
{
gint line=-1;
gchar *fn = glspi_get_error_info(L, &line);
@@ -413,7 +413,7 @@ static void show_error(lua_State *L, gchar *script_file)
-static gint glspi_init_module(lua_State *L, gchar *script_file, gint caller, GKeyFile*proj, gchar*script_dir)
+static gint glspi_init_module(lua_State *L, const gchar *script_file, gint caller, GKeyFile*proj, const gchar*script_dir)
{
luaL_openlib(L, LUA_MODULE_NAME, glspi_timer_funcs, 0);
glspi_init_sci_funcs(L);
@@ -450,7 +450,7 @@ gint luaopen_libgeanylua(lua_State *L)
/* Load and run the script */
-void glspi_run_script(gchar *script_file, gint caller, GKeyFile*proj, gchar *script_dir)
+void glspi_run_script(const gchar *script_file, gint caller, GKeyFile*proj, const gchar *script_dir)
{
gint status;
lua_State *L = glspi_state_new();
Modified: geanylua/glspi_sci.c
9 files changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -467,7 +467,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,(gint)content); }
+ if (len) { scintilla_send_message(doc->editor->sci,SCI_COPYTEXT,len,(glong)content); }
push_number(L, len);
return 1;
default:
@@ -561,7 +561,8 @@ static void glspi_init_sci_cmd_hash(void)
sci_cmd_hash=g_hash_table_new(g_str_hash,g_str_equal);
for (i=0; sci_cmd_hash_entries[i].name; i++) {
g_hash_table_insert(
- sci_cmd_hash,sci_cmd_hash_entries[i].name,&sci_cmd_hash_entries[i]);
+ sci_cmd_hash,
+ (gpointer) sci_cmd_hash_entries[i].name,&sci_cmd_hash_entries[i]);
}
}
@@ -596,7 +597,7 @@ static SciCmdHashEntry* lookup_cmd_id(gint cmd)
-static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, gchar*cmdname)
+static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, const gchar*cmdname)
{
lua_pushfstring(
L, _( "Error in module \"%s\" at function %s():\n"
@@ -607,7 +608,7 @@ static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, gchar
}
-static gint glspi_fail_arg_count(lua_State* L, const gchar*funcname, gchar*cmdname)
+static gint glspi_fail_arg_count(lua_State* L, const gchar*funcname, const gchar*cmdname)
{
lua_pushfstring(
L, _( "Error in module \"%s\" at function %s():\n"
Modified: geanylua/glspi_sci.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -25,7 +25,7 @@
typedef struct _SciCmdHashEntry {
- gchar *name;
+ const gchar *name;
GlspiType result;
gint msgid;
GlspiType wparam;
Modified: geanylua/gsdlg_lua.c
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -90,7 +90,7 @@ static gint adjust_argnum(lua_State *L, gint argnum) {
/* Pushes an error message onto Lua stack if script passes a wrong arg type */
-static gint fail_arg_type(lua_State *L, const gchar *func, gint argnum, gchar *type)
+static gint fail_arg_type(lua_State *L, const gchar *func, gint argnum, const gchar *type)
{
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
" expected type \"%s\" for argument #%d\n"),
@@ -103,7 +103,7 @@ static gint fail_arg_type(lua_State *L, const gchar *func, gint argnum, gchar *t
/*Pushes an error message onto Lua stack if table contains wrong element type*/
static gint gsdl_fail_elem_type(
- lua_State *L, const gchar *func, gint argnum, gint idx, gchar *type)
+ lua_State *L, const gchar *func, gint argnum, gint idx, const gchar *type)
{
lua_pushfstring(L, _("Error in module \"%s\" at function %s():\n"
" invalid table in argument #%d:\n"
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Plugins-Commits
mailing list