aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2015-07-03 19:06:39 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2015-07-03 20:59:24 +0100
commitedcdaaec163ffd928e585e97ec08f9682790bf28 (patch)
treefd72c0048ee5a4654b4462e004b9f49777fb43fb
parentc767b33c3f0bc7e30ac00214e77f0fc572678e6b (diff)
downloadswig-edcdaaec163ffd928e585e97ec08f9682790bf28.tar.gz
Warning fixes for 64bit visual c++ on Windows
-rw-r--r--Source/CParse/parser.y2
-rw-r--r--Source/CParse/templ.c2
-rw-r--r--Source/DOH/base.c6
-rw-r--r--Source/DOH/file.c2
-rw-r--r--Source/DOH/fio.c18
-rw-r--r--Source/DOH/string.c4
-rw-r--r--Source/Modules/go.cxx2
-rw-r--r--Source/Modules/main.cxx4
-rw-r--r--Source/Modules/ocaml.cxx4
-rw-r--r--Source/Modules/php.cxx6
-rw-r--r--Source/Modules/python.cxx8
-rw-r--r--Source/Swig/include.c4
-rw-r--r--Source/Swig/misc.c20
-rw-r--r--Source/Swig/naming.c4
-rw-r--r--Source/Swig/stype.c6
-rw-r--r--Source/Swig/typemap.c8
-rw-r--r--Source/Swig/typeobj.c10
17 files changed, 55 insertions, 55 deletions
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index ab4a0fb30..a3c5e73bf 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -744,7 +744,7 @@ static String *remove_block(Node *kw, const String *inputcode) {
String *name = Getattr(kw,"name");
if (name && (Cmp(name,"noblock") == 0)) {
char *cstr = Char(inputcode);
- size_t len = Len(inputcode);
+ int len = Len(inputcode);
if (len && cstr[0] == '{') {
--len; ++cstr;
if (len && cstr[len - 1] == '}') { --len; }
diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c
index 9768f1b99..e575073a4 100644
--- a/Source/CParse/templ.c
+++ b/Source/CParse/templ.c
@@ -237,7 +237,7 @@ String *partial_arg(String *s, String *p) {
if (!c) {
return Copy(s);
}
- prefix = NewStringWithSize(cp, c - cp);
+ prefix = NewStringWithSize(cp, (int)(c - cp));
newarg = Copy(s);
Replace(newarg, prefix, "", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Delete(prefix);
diff --git a/Source/DOH/base.c b/Source/DOH/base.c
index 4034e5626..12351dd09 100644
--- a/Source/DOH/base.c
+++ b/Source/DOH/base.c
@@ -146,7 +146,7 @@ int DohLen(const DOH *obj) {
}
return 0;
} else {
- return strlen((char *) obj);
+ return (int)strlen((char *) obj);
}
}
@@ -636,7 +636,7 @@ int DohRead(DOH *obj, void *buffer, int length) {
return -1;
}
/* Hmmm. Not a file. Maybe it's a real FILE */
- return fread(buffer, 1, length, (FILE *) b);
+ return (int)fread(buffer, 1, length, (FILE *) b);
}
/* -----------------------------------------------------------------------------
@@ -654,7 +654,7 @@ int DohWrite(DOH *obj, const void *buffer, int length) {
return -1;
}
/* Hmmm. Not a file. Maybe it's a real FILE */
- return fwrite(buffer, 1, length, (FILE *) b);
+ return (int)fwrite(buffer, 1, length, (FILE *) b);
}
/* -----------------------------------------------------------------------------
diff --git a/Source/DOH/file.c b/Source/DOH/file.c
index 7409ebbfb..5c56771d0 100644
--- a/Source/DOH/file.c
+++ b/Source/DOH/file.c
@@ -52,7 +52,7 @@ static int File_read(DOH *fo, void *buffer, int len) {
DohFile *f = (DohFile *) ObjData(fo);
if (f->filep) {
- return fread(buffer, 1, len, f->filep);
+ return (int)fread(buffer, 1, len, f->filep);
} else if (f->fd) {
#ifdef DOH_INTFILE
return read(f->fd, buffer, len);
diff --git a/Source/DOH/fio.c b/Source/DOH/fio.c
index 7055ffc85..77419008c 100644
--- a/Source/DOH/fio.c
+++ b/Source/DOH/fio.c
@@ -304,9 +304,9 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
}
if (strlen(encoder)) {
enc = encode(encoder, Sval);
- maxwidth = maxwidth + strlen(newformat) + Len(enc);
+ maxwidth = maxwidth + (int)strlen(newformat) + Len(enc);
} else {
- maxwidth = maxwidth + strlen(newformat) + Len(Sval);
+ maxwidth = maxwidth + (int)strlen(newformat) + Len(Sval);
}
*(fmt++) = 's';
*fmt = 0;
@@ -320,7 +320,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
} else {
nbytes += sprintf(stemp, newformat, Data(Sval));
}
- if (Writen(so, stemp, strlen(stemp)) < 0)
+ if (Writen(so, stemp, (int)strlen(stemp)) < 0)
return -1;
if ((DOH *) Sval != doh) {
Delete(Sval);
@@ -346,7 +346,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
} else {
enc = 0;
}
- maxwidth = maxwidth + strlen(newformat) + strlen((char *) doh);
+ maxwidth = maxwidth + (int)strlen(newformat) + (int)strlen((char *) doh);
*(fmt++) = 's';
*fmt = 0;
if ((maxwidth + 1) < OBUFLEN) {
@@ -355,7 +355,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
stemp = (char *) DohMalloc(maxwidth + 1);
}
nbytes += sprintf(stemp, newformat, doh);
- if (Writen(so, stemp, strlen(stemp)) < 0)
+ if (Writen(so, stemp, (int)strlen(stemp)) < 0)
return -1;
if (stemp != obuffer) {
DohFree(stemp);
@@ -366,7 +366,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
} else {
*(fmt++) = *p;
*fmt = 0;
- maxwidth = maxwidth + strlen(newformat) + 64;
+ maxwidth = maxwidth + (int)strlen(newformat) + 64;
/* Only allocate a buffer if it is too big to fit. Shouldn't have to do
this very often */
@@ -401,7 +401,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
default:
break;
}
- if (Writen(so, stemp, strlen(stemp)) < 0)
+ if (Writen(so, stemp, (int)strlen(stemp)) < 0)
return -1;
if (stemp != obuffer)
DohFree(stemp);
@@ -414,7 +414,7 @@ int DohvPrintf(DOH *so, const char *format, va_list ap) {
if (state) {
int r;
*fmt = 0;
- r = Writen(so, fmt, strlen(fmt));
+ r = Writen(so, fmt, (int)strlen(fmt));
if (r < 0)
return -1;
nbytes += r;
@@ -455,7 +455,7 @@ int DohPrintv(DOHFile * f, ...) {
if (DohCheck(obj)) {
ret += DohDump(obj, f);
} else {
- ret += DohWrite(f, obj, strlen((char *) obj));
+ ret += DohWrite(f, obj, (int)strlen((char *) obj));
}
}
va_end(ap);
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index cfc6c70f6..490198dfa 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -687,7 +687,7 @@ static int replace_simple(String *str, char *token, char *rep, int flags, int co
return 0;
base = str->str;
- tokenlen = strlen(token);
+ tokenlen = (int)strlen(token);
s = (*match) (base, base, token, tokenlen);
if (!s)
@@ -724,7 +724,7 @@ static int replace_simple(String *str, char *token, char *rep, int flags, int co
}
first = s;
- replen = strlen(rep);
+ replen = (int)strlen(rep);
delta = (replen - tokenlen);
diff --git a/Source/Modules/go.cxx b/Source/Modules/go.cxx
index db4bf5507..6b9ba760d 100644
--- a/Source/Modules/go.cxx
+++ b/Source/Modules/go.cxx
@@ -2629,7 +2629,7 @@ private:
// exponentiation. Treat anything else as too complicated to
// handle as a Go constant.
char *p = Char(value);
- int len = strlen(p);
+ int len = (int)strlen(p);
bool need_copy = false;
while (len > 0) {
char c = p[len - 1];
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index 1850a47cb..632a001ac 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -595,7 +595,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
Swig_filename_correct(outfile_name);
if (!outfile_name_h || !dependencies_file) {
char *ext = strrchr(Char(outfile_name), '.');
- String *basename = ext ? NewStringWithSize(Char(outfile_name), Char(ext) - Char(outfile_name)) : NewString(outfile_name);
+ String *basename = ext ? NewStringWithSize(Char(outfile_name), (int)(Char(ext) - Char(outfile_name))) : NewString(outfile_name);
if (!dependencies_file) {
dependencies_file = NewStringf("%s.%s", basename, depends_extension);
}
@@ -899,7 +899,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
String *vers = NewString("SWIG_VERSION 0x");
int count = 0;
while (token) {
- int len = strlen(token);
+ int len = (int)strlen(token);
assert(len == 1 || len == 2);
Printf(vers, "%s%s", (len == 1) ? "0" : "", token);
token = strtok(NULL, ".");
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index bca6fa2a0..87b430b02 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -990,7 +990,7 @@ public:
find_marker += strlen("(*Stream:");
if (next) {
- int num_chars = next - find_marker;
+ int num_chars = (int)(next - find_marker);
String *stream_name = NewString(find_marker);
Delslice(stream_name, num_chars, Len(stream_name));
File *fout = Swig_filebyname(stream_name);
@@ -1001,7 +1001,7 @@ public:
if (!following)
following = next + strlen(next);
String *chunk = NewString(next);
- Delslice(chunk, following - next, Len(chunk));
+ Delslice(chunk, (int)(following - next), Len(chunk));
Printv(fout, chunk, NIL);
}
}
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
index 35e741949..37a8f9628 100644
--- a/Source/Modules/php.cxx
+++ b/Source/Modules/php.cxx
@@ -190,7 +190,7 @@ class PHP : public Language {
p = strchr(p, '"');
if (p) {
++p;
- Insert(action, p - Char(action), " TSRMLS_CC");
+ Insert(action, (int)(p - Char(action)), " TSRMLS_CC");
}
}
}
@@ -2424,7 +2424,7 @@ done:
String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
const char * p = Char(target);
const char * comma = strchr(p, ',');
- size_t ins = comma ? comma - p : Len(target) - 1;
+ int ins = comma ? (int)(comma - p) : Len(target) - 1;
Insert(target, ins, " TSRMLS_DC");
call = Swig_csuperclass_call(0, basetype, superparms);
@@ -2443,7 +2443,7 @@ done:
String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
const char * p = Char(target);
const char * comma = strchr(p, ',');
- size_t ins = comma ? comma - p : Len(target) - 1;
+ int ins = comma ? (int)(comma - p) : Len(target) - 1;
Insert(target, ins, " TSRMLS_DC");
Printf(f_directors_h, " %s;\n", target);
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index 14e27941f..652df8974 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -1184,7 +1184,7 @@ public:
const char *py3_end1 = Strchr(rpkg, '.');
if (!py3_end1)
py3_end1 = (Char(rpkg)) + Len(rpkg);
- py3_rlen1 = py3_end1 - (Char(rpkg));
+ py3_rlen1 = (int)(py3_end1 - Char(rpkg));
} else {
rpkg = NewString("");
}
@@ -1916,7 +1916,7 @@ public:
// Avoid unnecessary string allocation in the common case when we don't
// need to remove any suffix.
- return *end == '\0' ? v : NewStringWithSize(s, end - s);
+ return *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
}
return NIL;
@@ -1998,7 +1998,7 @@ public:
if (py3) {
if (end - s > 1) {
result = NewString("0o");
- Append(result, NewStringWithSize(s + 1, end - s - 1));
+ Append(result, NewStringWithSize(s + 1, (int)(end - s - 1)));
}
}
}
@@ -2007,7 +2007,7 @@ public:
// Avoid unnecessary string allocation in the common case when we don't
// need to remove any suffix.
if (!result)
- result = *end == '\0' ? v : NewStringWithSize(s, end - s);
+ result = *end == '\0' ? v : NewStringWithSize(s, (int)(end - s));
}
}
}
diff --git a/Source/Swig/include.c b/Source/Swig/include.c
index 7e80172ba..08226a25c 100644
--- a/Source/Swig/include.c
+++ b/Source/Swig/include.c
@@ -194,7 +194,7 @@ static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_
lastpath = filename;
/* Skip the UTF-8 BOM if it's present */
- nbytes = fread(bom, 1, 3, f);
+ nbytes = (int)fread(bom, 1, 3, f);
if (nbytes == 3 && bom[0] == (char)0xEF && bom[1] == (char)0xBB && bom[2] == (char)0xBF) {
/* skip */
} else {
@@ -369,7 +369,7 @@ String *Swig_file_filename(const_String_or_char_ptr filename) {
String *Swig_file_dirname(const_String_or_char_ptr filename) {
const char *delim = SWIG_FILE_DELIMITER;
const char *c = strrchr(Char(filename), *delim);
- return c ? NewStringWithSize(filename, c - Char(filename) + 1) : NewString("");
+ return c ? NewStringWithSize(filename, (int)(c - Char(filename) + 1)) : NewString("");
}
/*
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
index 7a6fb0114..d8034c5eb 100644
--- a/Source/Swig/misc.c
+++ b/Source/Swig/misc.c
@@ -127,7 +127,7 @@ String *Swig_strip_c_comments(const String *s) {
}
if (comment_begin && comment_end) {
- int size = comment_begin - Char(s);
+ int size = (int)(comment_begin - Char(s));
String *stripmore = 0;
stripped = NewStringWithSize(s, size);
Printv(stripped, comment_end + 1, NIL);
@@ -808,7 +808,7 @@ void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
*rlast = Copy(s);
return;
} else {
- *rprefix = NewStringWithSize(cc, co - cc - 2);
+ *rprefix = NewStringWithSize(cc, (int)(co - cc - 2));
*rlast = NewString(co);
return;
}
@@ -835,7 +835,7 @@ void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
}
if (cc != tmp) {
- *rprefix = NewStringWithSize(tmp, cc - tmp);
+ *rprefix = NewStringWithSize(tmp, (int)(cc - tmp));
*rlast = NewString(cc + 2);
return;
} else {
@@ -858,7 +858,7 @@ String *Swig_scopename_prefix(const String *s) {
if (co == cc) {
return 0;
} else {
- String *prefix = NewStringWithSize(cc, co - cc - 2);
+ String *prefix = NewStringWithSize(cc, (int)(co - cc - 2));
return prefix;
}
}
@@ -884,7 +884,7 @@ String *Swig_scopename_prefix(const String *s) {
}
if (cc != tmp) {
- return NewStringWithSize(tmp, cc - tmp);
+ return NewStringWithSize(tmp, (int)(cc - tmp));
} else {
return 0;
}
@@ -977,7 +977,7 @@ String *Swig_scopename_first(const String *s) {
}
}
if (*c && (c != tmp)) {
- return NewStringWithSize(tmp, c - tmp);
+ return NewStringWithSize(tmp, (int)(c - tmp));
} else {
return 0;
}
@@ -1219,8 +1219,8 @@ static int split_regex_pattern_subst(String *s, String **pattern, String **subst
if (!p) goto err_out;
sube = p;
- *pattern = NewStringWithSize(pats, pate - pats);
- *subst = NewStringWithSize(subs, sube - subs);
+ *pattern = NewStringWithSize(pats, (int)(pate - pats));
+ *subst = NewStringWithSize(subs, (int)(sube - subs));
*input = p + 1;
return 1;
@@ -1270,7 +1270,7 @@ String *replace_captures(int num_captures, const char *input, String *subst, int
/* Copy part without substitutions */
const char *q = strchr(p, '\\');
if (!q) {
- copy_with_maybe_case_conversion(result, p, strlen(p), &convertCase, convertNextOnly);
+ copy_with_maybe_case_conversion(result, p, (int)strlen(p), &convertCase, convertNextOnly);
break;
}
copy_with_maybe_case_conversion(result, p, q - p, &convertCase, convertNextOnly);
@@ -1350,7 +1350,7 @@ String *Swig_string_regex(String *s) {
pcre_error, Char(pattern), pcre_errorpos);
exit(1);
}
- rc = pcre_exec(compiled_pat, NULL, input, strlen(input), 0, 0, captures, 30);
+ rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
if (rc >= 0) {
res = replace_captures(rc, input, subst, captures, pattern, s);
} else if (rc != PCRE_ERROR_NOMATCH) {
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
index 272961c25..2d1effa18 100644
--- a/Source/Swig/naming.c
+++ b/Source/Swig/naming.c
@@ -578,7 +578,7 @@ void Swig_name_object_inherit(Hash *namehash, String *base, String *derived) {
bprefix = NewStringf("%s::", base);
dprefix = NewStringf("%s::", derived);
cbprefix = Char(bprefix);
- plen = strlen(cbprefix);
+ plen = (int)strlen(cbprefix);
for (ki = First(namehash); ki.key; ki = Next(ki)) {
char *k = Char(ki.key);
if (strncmp(k, cbprefix, plen) == 0) {
@@ -1074,7 +1074,7 @@ static List *Swig_make_attrlist(const char *ckey) {
String *nattr;
const char *rattr = strchr(++cattr, '$');
while (rattr) {
- nattr = NewStringWithSize(cattr, rattr - cattr);
+ nattr = NewStringWithSize(cattr, (int)(rattr - cattr));
Append(list, nattr);
Delete(nattr);
cattr = rattr + 1;
diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c
index 506878799..a57222745 100644
--- a/Source/Swig/stype.c
+++ b/Source/Swig/stype.c
@@ -195,7 +195,7 @@ int SwigType_ispointer_return(const SwigType *t) {
if (!t)
return 0;
c = Char(t);
- idx = strlen(c) - 4;
+ idx = (int)strlen(c) - 4;
if (idx >= 0) {
return (strcmp(c + idx, ").p.") == 0);
}
@@ -208,7 +208,7 @@ int SwigType_isreference_return(const SwigType *t) {
if (!t)
return 0;
c = Char(t);
- idx = strlen(c) - 4;
+ idx = (int)strlen(c) - 4;
if (idx >= 0) {
return (strcmp(c + idx, ").r.") == 0);
}
@@ -485,7 +485,7 @@ String *SwigType_namestr(const SwigType *t) {
if (!c || !strstr(c + 2, ")>"))
return NewString(t);
- r = NewStringWithSize(d, c - d);
+ r = NewStringWithSize(d, (int)(c - d));
if (*(c - 1) == '<')
Putc(' ', r);
Putc('<', r);
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c
index 0bfbb4bce..23b1e80e9 100644
--- a/Source/Swig/typemap.c
+++ b/Source/Swig/typemap.c
@@ -1844,7 +1844,7 @@ static List *split_embedded_typemap(String *s) {
}
}
if ((level == 0) && angle_level == 0 && ((*c == ',') || (*c == ')'))) {
- String *tmp = NewStringWithSize(start, c - start);
+ String *tmp = NewStringWithSize(start, (int)(c - start));
Append(args, tmp);
Delete(tmp);
start = c + 1;
@@ -1915,10 +1915,10 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper
c++;
}
if (end) {
- dollar_typemap = NewStringWithSize(start, (end - start));
+ dollar_typemap = NewStringWithSize(start, (int)((end - start)));
syntax_error = 0;
} else {
- dollar_typemap = NewStringWithSize(start, (c - start));
+ dollar_typemap = NewStringWithSize(start, (int)((c - start)));
}
if (!syntax_error) {
@@ -1963,7 +1963,7 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper
char *eq = strchr(Char(parm), '=');
char *c = Char(parm);
if (eq && (eq - c > 0)) {
- String *name = NewStringWithSize(c, eq - c);
+ String *name = NewStringWithSize(c, (int)(eq - c));
String *value = NewString(eq + 1);
Insert(name, 0, "$");
Setattr(vars, name, value);
diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c
index 622eac118..b2832b6a9 100644
--- a/Source/Swig/typeobj.c
+++ b/Source/Swig/typeobj.c
@@ -361,7 +361,7 @@ SwigType *SwigType_del_pointer(SwigType *t) {
printf("Fatal error. SwigType_del_pointer applied to non-pointer.\n");
abort();
}
- Delslice(t, 0, (c - s) + 2);
+ Delslice(t, 0, (int)((c - s) + 2));
return t;
}
@@ -915,7 +915,7 @@ SwigType *SwigType_add_template(SwigType *t, ParmList *parms) {
String *SwigType_templateprefix(const SwigType *t) {
const char *s = Char(t);
const char *c = strstr(s, "<(");
- return c ? NewStringWithSize(s, c - s) : NewString(s);
+ return c ? NewStringWithSize(s, (int)(c - s)) : NewString(s);
}
/* -----------------------------------------------------------------------------
@@ -966,7 +966,7 @@ String *SwigType_templatesuffix(const SwigType *t) {
String *SwigType_istemplate_templateprefix(const SwigType *t) {
const char *s = Char(t);
const char *c = strstr(s, "<(");
- return c ? NewStringWithSize(s, c - s) : 0;
+ return c ? NewStringWithSize(s, (int)(c - s)) : 0;
}
/* -----------------------------------------------------------------------------
@@ -989,7 +989,7 @@ String *SwigType_istemplate_only_templateprefix(const SwigType *t) {
const char *s = Char(t);
if (len >= 4 && strcmp(s + len - 2, ")>") == 0) {
const char *c = strstr(s, "<(");
- return c ? NewStringWithSize(s, c - s) : 0;
+ return c ? NewStringWithSize(s, (int)(c - s)) : 0;
} else {
return 0;
}
@@ -1022,7 +1022,7 @@ String *SwigType_templateargs(const SwigType *t) {
nest--;
c++;
}
- return NewStringWithSize(start, c - start);
+ return NewStringWithSize(start, (int)(c - start));
}
c++;
}