aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-03-10 09:32:50 +0100
committerMartin Kaiser <wireshark@kaiser.cx>2014-03-10 08:47:19 +0000
commit3b47668a913b27fb64ebe729273327db72c4ae20 (patch)
tree5386367e0f5a2e3b2bb05bbab28104da57c891e7 /epan/wslua
parent09af1401527504e2a5c12c0c87e580feb0111a0a (diff)
add explicit casts to fix compilation on Linux
Change-Id: I3b87e156ab35e14e3c6e3800ee2058b1a6be57d6 Reviewed-on: https://code.wireshark.org/review/577 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/lrexlib.c2
-rw-r--r--epan/wslua/lrexlib_algo.h2
-rw-r--r--epan/wslua/lrexlib_glib.c22
3 files changed, 14 insertions, 12 deletions
diff --git a/epan/wslua/lrexlib.c b/epan/wslua/lrexlib.c
index 21038fa1e3..4322bb2b25 100644
--- a/epan/wslua/lrexlib.c
+++ b/epan/wslua/lrexlib.c
@@ -126,7 +126,7 @@ void freelist_free (TFreeList *fl) {
enum { ID_NUMBER, ID_STRING };
void buffer_init (TBuffer *buf, size_t sz, lua_State *L, TFreeList *fl) {
- buf->arr = Lmalloc(L, sz);
+ buf->arr = (char *)Lmalloc(L, sz);
if (!buf->arr) {
freelist_free (fl);
luaL_error (L, "malloc failed");
diff --git a/epan/wslua/lrexlib_algo.h b/epan/wslua/lrexlib_algo.h
index 4e97c2b1b9..4aad145989 100644
--- a/epan/wslua/lrexlib_algo.h
+++ b/epan/wslua/lrexlib_algo.h
@@ -141,7 +141,7 @@ static void check_subject (lua_State *L, int pos, TArgExec *argE)
if (type != LUA_TLIGHTUSERDATA)
luaL_error (L, "subject's topointer method returned %s (expected lightuserdata)",
lua_typename (L, type));
- argE->text = lua_touserdata (L, -1);
+ argE->text = (const char *)lua_touserdata (L, -1);
lua_pop (L, 1);
#if LUA_VERSION_NUM == 501
lua_objlen (L, pos);
diff --git a/epan/wslua/lrexlib_glib.c b/epan/wslua/lrexlib_glib.c
index 01b60de133..726a344dad 100644
--- a/epan/wslua/lrexlib_glib.c
+++ b/epan/wslua/lrexlib_glib.c
@@ -242,7 +242,8 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TGrgx **pud) {
lua_pushvalue (L, ALG_ENVIRONINDEX);
lua_setmetatable (L, -2);
- ud->pr = g_regex_new (argC->pattern, argC->cflags | G_REGEX_RAW, 0, &ud->error);
+ ud->pr = g_regex_new (argC->pattern,
+ (GRegexCompileFlags)(argC->cflags | G_REGEX_RAW), (GRegexMatchFlags)0, &ud->error);
if (!ud->pr)
return luaL_error (L, "%s (code: %d)", ud->error->message, ud->error->code);
@@ -270,7 +271,7 @@ static int Gregex_dfa_exec (lua_State *L)
gerror_free (ud);
res = g_regex_match_all_full (ud->pr, argE.text, (int)argE.textlen,
- argE.startoffset, argE.eflags, &ud->match_info, &ud->error);
+ argE.startoffset, (GRegexMatchFlags)argE.eflags, &ud->match_info, &ud->error);
if (ALG_ISMATCH (res)) {
int i, start_pos, end_pos;
@@ -304,18 +305,19 @@ static int Gregex_dfa_exec (lua_State *L)
#ifdef ALG_USERETRY
static int gmatch_exec (TUserdata *ud, TArgExec *argE, int retry) {
+ int eflags = retry ? (argE->eflags|G_REGEX_MATCH_NOTEMPTY|G_REGEX_MATCH_ANCHORED) : argE->eflags;
+
minfo_free (ud);
gerror_free (ud);
- int eflags = retry ? (argE->eflags|G_REGEX_MATCH_NOTEMPTY|G_REGEX_MATCH_ANCHORED) : argE->eflags;
return g_regex_match_full (ud->pr, argE->text, argE->textlen,
- argE->startoffset, eflags, &ud->match_info, &ud->error);
+ argE->startoffset, (GRegexMatchFlags)eflags, &ud->match_info, &ud->error);
}
#else
static int gmatch_exec (TUserdata *ud, TArgExec *argE) {
minfo_free (ud);
gerror_free (ud);
return g_regex_match_full (ud->pr, argE->text, argE->textlen,
- argE->startoffset, argE->eflags, &ud->match_info, &ud->error);
+ argE->startoffset, (GRegexMatchFlags)argE->eflags, &ud->match_info, &ud->error);
}
#endif
@@ -327,23 +329,23 @@ static int findmatch_exec (TGrgx *ud, TArgExec *argE) {
minfo_free (ud);
gerror_free (ud);
return g_regex_match_full (ud->pr, argE->text, argE->textlen,
- argE->startoffset, argE->eflags, &ud->match_info, &ud->error);
+ argE->startoffset, (GRegexMatchFlags)argE->eflags, &ud->match_info, &ud->error);
}
#ifdef ALG_USERETRY
static int gsub_exec (TGrgx *ud, TArgExec *argE, int st, int retry) {
+ int eflags = retry ? (argE->eflags|G_REGEX_MATCH_NOTEMPTY|G_REGEX_MATCH_ANCHORED) : argE->eflags;
minfo_free (ud);
gerror_free (ud);
- int eflags = retry ? (argE->eflags|G_REGEX_MATCH_NOTEMPTY|G_REGEX_MATCH_ANCHORED) : argE->eflags;
return g_regex_match_full (ud->pr, argE->text, argE->textlen,
- st, eflags, &ud->match_info, &ud->error);
+ st, (GRegexMatchFlags)eflags, &ud->match_info, &ud->error);
}
#else
static int gsub_exec (TGrgx *ud, TArgExec *argE, int st) {
minfo_free (ud);
gerror_free (ud);
return g_regex_match_full (ud->pr, argE->text, argE->textlen,
- st, argE->eflags, &ud->match_info, &ud->error);
+ st, (GRegexMatchFlags)argE->eflags, &ud->match_info, &ud->error);
}
#endif
@@ -351,7 +353,7 @@ static int split_exec (TGrgx *ud, TArgExec *argE, int offset) {
minfo_free (ud);
gerror_free (ud);
return g_regex_match_full (ud->pr, argE->text, argE->textlen, offset,
- argE->eflags, &ud->match_info, &ud->error);
+ (GRegexMatchFlags)argE->eflags, &ud->match_info, &ud->error);
}
static int Gregex_gc (lua_State *L) {