Index: trunk/xcache.c
===================================================================
--- trunk/xcache.c	(revision 916)
+++ trunk/xcache.c	(revision 917)
@@ -38,5 +38,5 @@
 #include "utils.h"
 
-#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (pentry)->ttl)
+#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (time_t) (pentry)->ttl)
 #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0)
 #define LOCK(x) xc_lock((x)->lck)
@@ -464,5 +464,5 @@
 {
 	TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl);
-	if (XG(request_time) > entry->atime + xc_php_ttl) {
+	if (XG(request_time) > entry->atime + (time_t) xc_php_ttl) {
 		return 1;
 	}
@@ -481,7 +481,7 @@
 {
 	TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval);
-	if (XG(request_time) - cache->last_gc_expires >= gc_interval) {
+	if (XG(request_time) >= cache->last_gc_expires + (time_t) gc_interval) {
 		ENTER_LOCK(cache) {
-			if (XG(request_time) - cache->last_gc_expires >= gc_interval) {
+			if (XG(request_time) >= cache->last_gc_expires + (time_t) gc_interval) {
 				cache->last_gc_expires = XG(request_time);
 				xc_entry_apply_unlocked(type, cache, apply_func TSRMLS_CC);
@@ -1192,5 +1192,5 @@
 	ulong           old_rsid = EG(regular_list).nNextFreeElement;
 
-	stream = php_stream_open_wrapper(ZEND_24(NOTHING, (char *)) compiler->filename, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);
+	stream = php_stream_open_wrapper((char *) compiler->filename, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);
 	if (!stream) {
 		return FAILURE;
@@ -1240,5 +1240,6 @@
 {
 	char *class_name;
-	int i, class_len;
+	zend_uint i;
+	int class_len;
 	xc_cest_t cest;
 	xc_entry_data_php_t *php = (xc_entry_data_php_t *) data;
@@ -1285,5 +1286,9 @@
 static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */
 {
-	int i;
+#ifdef ZEND_ENGINE_2_4
+	int literalindex;
+#else
+	zend_uint oplinenum;
+#endif
 	xc_vector_t details;
 
@@ -1315,6 +1320,6 @@
 
 #ifdef ZEND_ENGINE_2_4
-	for (i = 0; i < op_array->last_literal; i++) {
-		zend_literal *literal = &op_array->literals[i];
+	for (literalindex = 0; literalindex < op_array->last_literal; literalindex++) {
+		zend_literal *literal = &op_array->literals[literalindex];
 		zend_uint literalinfo = 0;
 		if (Z_TYPE(literal->constant) == IS_STRING) {
@@ -1330,5 +1335,5 @@
 		if (literalinfo) {
 			xc_op_array_info_detail_t detail;
-			detail.index = i;
+			detail.index = literalindex;
 			detail.info  = literalinfo;
 			xc_vector_add(xc_op_array_info_detail_t, &details, detail);
@@ -1339,6 +1344,6 @@
 	op_array_info->literalinfos    = xc_vector_detach(xc_op_array_info_detail_t, &details);
 #else /* ZEND_ENGINE_2_4 */
-	for (i = 0; i < op_array->last; i++) {
-		zend_op *opline = &op_array->opcodes[i];
+	for (oplinenum = 0; oplinenum < op_array->last; oplinenum++) {
+		zend_op *opline = &op_array->opcodes[oplinenum];
 		zend_uint oplineinfo = 0;
 		if (Z_OP_TYPE(opline->op1) == IS_CONST) {
@@ -1370,5 +1375,5 @@
 		if (oplineinfo) {
 			xc_op_array_info_detail_t detail;
-			detail.index = i;
+			detail.index = oplinenum;
 			detail.info  = oplineinfo;
 			xc_vector_add(xc_op_array_info_detail_t, &details, detail);
@@ -1384,10 +1389,10 @@
 void xc_fix_op_array_info(const xc_entry_php_t *entry_php, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */
 {
-	int i;
-
 #ifdef ZEND_ENGINE_2_4
-	for (i = 0; i < op_array_info->literalinfo_cnt; ++i) {
-		int index = op_array_info->literalinfos[i].index;
-		int literalinfo = op_array_info->literalinfos[i].info;
+	int linteralindex;
+
+	for (linteralindex = 0; linteralindex < op_array_info->literalinfo_cnt; ++linteralindex) {
+		int index = op_array_info->literalinfos[linteralindex].index;
+		int literalinfo = op_array_info->literalinfos[linteralindex].info;
 		zend_literal *literal = &op_array->literals[index];
 		if ((literalinfo & xcache_literal_is_file)) {
@@ -1430,8 +1435,10 @@
 		}
 	}
-#else
-	for (i = 0; i < op_array_info->oplineinfo_cnt; ++i) {
-		int oplineno = op_array_info->oplineinfos[i].index;
-		int oplineinfo = op_array_info->oplineinfos[i].info;
+#else /* ZEND_ENGINE_2_4 */
+	zend_uint oplinenum;
+
+	for (oplinenum = 0; oplinenum < op_array_info->oplineinfo_cnt; ++oplinenum) {
+		int oplineno = op_array_info->oplineinfos[oplinenum].index;
+		int oplineinfo = op_array_info->oplineinfos[oplinenum].info;
 		zend_op *opline = &op_array->opcodes[oplineno];
 		if ((oplineinfo & xcache_op1_is_file)) {
@@ -1517,5 +1524,5 @@
 		}
 	}
-#endif
+#endif /* ZEND_ENGINE_2_4 */
 }
 /* }}} */
@@ -1535,9 +1542,10 @@
 static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
 {
-	int i;
+	zend_uint i;
 	if (php->classinfos) {
 		for (i = 0; i < php->classinfo_cnt; i ++) {
 			xc_classinfo_t *classinfo = &php->classinfos[i];
-			int j;
+			zend_uint j;
+
 			for (j = 0; j < classinfo->methodinfo_cnt; j ++) {
 				xc_free_op_array_info(&classinfo->methodinfos[j] TSRMLS_CC);
@@ -1576,5 +1584,5 @@
 {
 	zend_op_array *op_array;
-	int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
+	zend_uint old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
 	zend_bool catched = 0;
 
@@ -1657,6 +1665,6 @@
 	/* {{{ shallow copy, pointers only */ {
 		Bucket *b;
-		unsigned int i;
-		unsigned int j;
+		zend_uint i;
+		zend_uint j;
 
 #define COPY_H(vartype, var, cnt, name, datatype) do {        \
@@ -1779,5 +1787,5 @@
 	compiler->new_php.have_early_binding = 0;
 	{
-		int i;
+		zend_uint i;
 		for (i = 0; i < compiler->new_php.classinfo_cnt; i ++) {
 			compiler->new_php.classinfos[i].oplineno = -1;
@@ -2125,5 +2133,5 @@
 {
 	xc_shm_t *shm;
-	int i;
+	size_t i;
 
 	if (xc_php_caches) {
@@ -2150,5 +2158,5 @@
 {
 	xc_shm_t *shm;
-	int i;
+	size_t i;
 
 	if (xc_php_caches) {
@@ -2249,5 +2257,5 @@
 static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */
 {
-	int i;
+	size_t i;
 	xc_cache_t *cache;
 	xc_shm_t *shm;
@@ -2282,5 +2290,5 @@
 	xc_mem_t *mem;
 	time_t now = time(NULL);
-	int i;
+	size_t i;
 	xc_memsize_t memsize;
 
@@ -2405,5 +2413,5 @@
 static void xc_request_init(TSRMLS_D) /* {{{ */
 {
-	int i;
+	size_t i;
 
 	if (!XG(internal_table_copied)) {
@@ -2499,5 +2507,5 @@
 #endif
 {
-	int i;
+	size_t i;
 
 	if (xcache_globals->php_holds != NULL) {
@@ -3715,5 +3723,5 @@
 static int xc_config_hash(xc_hash_t *p, char *name, char *default_value) /* {{{ */
 {
-	int bits, size;
+	size_t bits, size;
 	char *value;
 
