summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-12-21 11:29:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-12-21 11:29:38 (GMT)
commit8ecd6aeb5b622ad2cc8c4690880e066c60abec54 (patch)
tree2d0b2dced183cf053e9384ae6314f43b9a69b120
parent4d007159025e0fc8ea75aae346bc7e6588e391c2 (diff)
downloadtcl-8ecd6aeb5b622ad2cc8c4690880e066c60abec54.zip
tcl-8ecd6aeb5b622ad2cc8c4690880e066c60abec54.tar.gz
tcl-8ecd6aeb5b622ad2cc8c4690880e066c60abec54.tar.bz2
Make it compile warning-free with MSVC compiler (VS2013, at least). Other tweaks.
-rw-r--r--generic/tclPkgConfig.c20
-rw-r--r--generic/zipfs.c31
-rw-r--r--unix/Makefile.in3
-rw-r--r--unix/tclLoadDl.c40
-rw-r--r--unix/tclUnixFCmd.c21
-rw-r--r--unix/tclUnixInit.c4
-rw-r--r--win/makefile.vc6
7 files changed, 23 insertions, 102 deletions
diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c
index 3f8178e..466d535 100644
--- a/generic/tclPkgConfig.c
+++ b/generic/tclPkgConfig.c
@@ -100,35 +100,19 @@ static Tcl_Config const cfg[] = {
/* Runtime paths to various stuff */
-#ifdef ANDROID
- {"libdir,runtime", ""},
- {"bindir,runtime", ""},
- {"scriptdir,runtime", ""},
- {"includedir,runtime", ""},
- {"docdir,runtime", ""},
-#else
{"libdir,runtime", CFG_RUNTIME_LIBDIR},
{"bindir,runtime", CFG_RUNTIME_BINDIR},
{"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
{"includedir,runtime", CFG_RUNTIME_INCDIR},
{"docdir,runtime", CFG_RUNTIME_DOCDIR},
-#endif
/* Installation paths to various stuff */
-#ifdef ANDROID
- {"libdir,install", ""},
- {"bindir,install", ""},
- {"scriptdir,install", ""},
- {"includedir,install", ""},
- {"docdir,install", ""},
-#else
{"libdir,install", CFG_INSTALL_LIBDIR},
{"bindir,install", CFG_INSTALL_BINDIR},
{"scriptdir,install", CFG_INSTALL_SCRDIR},
{"includedir,install", CFG_INSTALL_INCDIR},
{"docdir,install", CFG_INSTALL_DOCDIR},
-#endif
/* Last entry, closes the array */
{NULL, NULL}
@@ -139,10 +123,6 @@ TclInitEmbeddedConfigurationInformation(
Tcl_Interp *interp) /* Interpreter the configuration command is
* registered in. */
{
-#if defined(ANDROID) && !defined(TCL_CFGVAL_ENCODING)
-#define TCL_CFGVAL_ENCODING "utf-8"
-#endif
-
Tcl_RegisterConfig(interp, "tcl", cfg, TCL_CFGVAL_ENCODING);
}
diff --git a/generic/zipfs.c b/generic/zipfs.c
index a9f0a39..67390a6 100644
--- a/generic/zipfs.c
+++ b/generic/zipfs.c
@@ -2561,19 +2561,19 @@ ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc)
*errloc = EINVAL;
return -1;
}
+ if (offset < 0) {
+ *errloc = EINVAL;
+ return -1;
+ }
if (info->iswr) {
- if (offset > info->nmax) {
+ if ((unsigned long) offset > info->nmax) {
*errloc = EINVAL;
return -1;
}
- if (offset > info->nbyte) {
+ if ((unsigned long) offset > info->nbyte) {
info->nbyte = offset;
}
- } else if (offset > info->nbyte) {
- *errloc = EINVAL;
- return -1;
- }
- if (offset < 0) {
+ } else if ((unsigned long) offset > info->nbyte) {
*errloc = EINVAL;
return -1;
}
@@ -2772,12 +2772,12 @@ merror0:
info->nbyte = 0;
} else {
if (z->data != NULL) {
- i = z->nbyte;
- if (i > info->nmax) {
- i = info->nmax;
+ unsigned int j = z->nbyte;
+ if (j > info->nmax) {
+ j = info->nmax;
}
- memcpy(info->ubuf, z->data, i);
- info->nbyte = i;
+ memcpy(info->ubuf, z->data, j);
+ info->nbyte = j;
} else {
unsigned char *zbuf = z->zipfile->data + z->offset;
@@ -2809,15 +2809,16 @@ merror0:
stream.opaque = Z_NULL;
stream.avail_in = z->nbytecompr;
if (z->isenc) {
+ unsigned int j;
stream.avail_in -= 12;
cbuf = (unsigned char *)
Tcl_AttemptAlloc(stream.avail_in);
if (cbuf == NULL) {
goto merror0;
}
- for (i = 0; i < stream.avail_in; i++) {
- ch = info->ubuf[i];
- cbuf[i] = zdecode(info->keys, crc32tab, ch);
+ for (j = 0; j < stream.avail_in; j++) {
+ ch = info->ubuf[j];
+ cbuf[j] = zdecode(info->keys, crc32tab, ch);
}
stream.next_in = cbuf;
} else {
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 3e4cfc7..d65dceb 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -383,8 +383,7 @@ GENERIC_HDRS = \
$(GENERIC_DIR)/tclPatch.h \
$(GENERIC_DIR)/tclPlatDecls.h \
$(GENERIC_DIR)/tclPort.h \
- $(GENERIC_DIR)/tclRegexp.h \
- $(GENERIC_DIR)/tclZipfs.h
+ $(GENERIC_DIR)/tclRegexp.h
GENERIC_SRCS = \
$(GENERIC_DIR)/regcomp.c \
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index bb2361c..aec071c 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -97,11 +97,7 @@ TclpDlopen(
} else {
dlopenflags |= RTLD_NOW;
}
- if (native == NULL) {
- handle = NULL;
- } else {
- handle = dlopen(native, dlopenflags);
- }
+ handle = dlopen(native, dlopenflags);
if (handle == NULL) {
/*
* Let the OS loader examine the binary search path for whatever
@@ -119,41 +115,7 @@ TclpDlopen(
handle = dlopen(native, dlopenflags);
Tcl_DStringFree(&ds);
}
-#ifdef ANDROID
- /*
- * If not an absolute or relative path, try to load
- * from $INTERNAL_STORAGE/../lib (the place where the
- * system has installed bundled .so files from the .APK)
- */
- if (handle == NULL) {
- native = Tcl_GetString(pathPtr);
- if ((native != NULL) && (strchr(native, '/') == NULL)) {
- char *storage = getenv("INTERNAL_STORAGE");
- Tcl_DString ds2;
- if ((storage != NULL) && (storage[0] != '\0')) {
- Tcl_DStringInit(&ds2);
- Tcl_DStringAppend(&ds2, storage, -1);
- Tcl_DStringAppend(&ds2, "/../lib/", -1);
- Tcl_DStringAppend(&ds2, native, -1);
- handle = dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL);
- Tcl_DStringFree(&ds2);
- }
- if (handle == NULL) {
- storage = getenv("TK_TCL_WISH_LD_LIBS");
- if ((storage != NULL) && (storage[0] != '\0')) {
- Tcl_DStringInit(&ds2);
- Tcl_DStringAppend(&ds2, storage, -1);
- Tcl_DStringAppend(&ds2, "/", -1);
- Tcl_DStringAppend(&ds2, native, -1);
- handle =
- dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL);
- Tcl_DStringFree(&ds2);
- }
- }
- }
- }
- #endif
if (handle == NULL) {
/*
* Write the string to a variable first to work around a compiler bug
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 0193dae..3b1b6ca 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -465,9 +465,6 @@ DoCopyFile(
/* Used to determine filetype. */
{
Tcl_StatBuf dstStatBuf;
-#ifdef ANDROID
- int ret;
-#endif
if (S_ISDIR(statBufPtr->st_mode)) {
errno = EISDIR;
@@ -523,15 +520,7 @@ DoCopyFile(
if (mkfifo(dst, statBufPtr->st_mode) < 0) { /* INTL: Native. */
return TCL_ERROR;
}
-#ifdef ANDROID
- ret = CopyFileAtts(src, dst, statBufPtr);
- if (ret != TCL_OK && errno == EPERM) {
- ret = TCL_OK;
- }
- return ret;
-#else
return CopyFileAtts(src, dst, statBufPtr);
-#endif
default:
return TclUnixCopyFile(src, dst, statBufPtr, 0);
}
@@ -640,11 +629,6 @@ TclUnixCopyFile(
return TCL_ERROR;
}
if (!dontCopyAtts && CopyFileAtts(src, dst, statBufPtr) == TCL_ERROR) {
-#ifdef ANDROID
- if (errno == EPERM) {
- return TCL_OK;
- }
-#endif
/*
* The copy succeeded, but setting the permissions failed, so be in a
* consistent state, we remove the file that was created by the copy.
@@ -1219,11 +1203,6 @@ TraversalCopy(
Tcl_DStringValue(dstPtr), statBufPtr) == TCL_OK) {
return TCL_OK;
}
-#ifdef ANDROID
- if (errno == EPERM) {
- return TCL_OK;
- }
-#endif
break;
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 5e4ef0a..5fc0035 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -583,14 +583,10 @@ TclpInitLibraryPath(
void
TclpSetInitialEncodings(void)
{
-#ifdef ANDROID
- Tcl_SetSystemEncoding(NULL, "utf-8");
-#else
Tcl_DString encodingName;
Tcl_SetSystemEncoding(NULL,
Tcl_GetEncodingNameFromEnvironment(&encodingName));
Tcl_DStringFree(&encodingName);
-#endif
}
void
diff --git a/win/makefile.vc b/win/makefile.vc
index 82dd655..2e04f15 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -344,7 +344,8 @@ COREOBJS = \
$(TMP_DIR)\tclUtf.obj \
$(TMP_DIR)\tclUtil.obj \
$(TMP_DIR)\tclVar.obj \
- $(TMP_DIR)\tclZlib.obj
+ $(TMP_DIR)\tclZlib.obj \
+ $(TMP_DIR)\zipfs.obj
ZLIBOBJS = \
$(TMP_DIR)\adler32.obj \
@@ -942,6 +943,9 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
$(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c
$(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $?
+$(TMP_DIR)\zipfs.obj: $(GENERICDIR)\zipfs.c
+ $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $?
+
$(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c
$(cc32) -DBUILD_tcl $(TCL_CFLAGS) \
-DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR:\=\\)\"" \