From 403cbaf0f0b7acbe469edaf6df35c591f8fecb17 Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Fri, 9 Jun 2017 14:57:58 +0300
Subject: [PATCH 28/28] Fix different warnings.

---
 src/common/classes/fb_string.cpp |  6 +++---
 src/common/classes/fb_string.h   |  2 +-
 src/common/cvt.cpp               |  6 +++---
 src/gpre/sqe.cpp                 |  4 +++-
 src/gpre/sql.cpp                 | 12 ++++++------
 src/include/fb_blk.h             | 11 ++++++-----
 src/jrd/Database.h               |  4 ++--
 src/jrd/RuntimeStatistics.h      |  8 ++++----
 src/jrd/common.h                 |  4 ++++
 src/jrd/gds.cpp                  |  2 +-
 10 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/src/common/classes/fb_string.cpp b/src/common/classes/fb_string.cpp
index 439bcfdbaa..9173634fca 100644
--- a/src/common/classes/fb_string.cpp
+++ b/src/common/classes/fb_string.cpp
@@ -460,13 +460,13 @@ extern "C" {
 		return STRNCASECMP(s1, s2, n);
 	}
 
-	bool AbstractString::equalsNoCase(AbstractString::const_pointer string) const
+	bool AbstractString::equalsNoCase(AbstractString::const_pointer stringval) const
 	{
-		size_t l = strlen(string);
+		size_t l = strlen(stringval);
 		if (l > length())
 		{
 			l = length();
 		}
-		return (STRNCASECMP(c_str(), string, ++l) == 0);
+		return (STRNCASECMP(c_str(), stringval, ++l) == 0);
 	}
 }	// namespace Firebird
diff --git a/src/common/classes/fb_string.h b/src/common/classes/fb_string.h
index b1fea2703c..962176cad3 100644
--- a/src/common/classes/fb_string.h
+++ b/src/common/classes/fb_string.h
@@ -425,7 +425,7 @@ namespace Firebird
 			return hash(c_str(), tableSize);
 		}
 
-		bool equalsNoCase(const_pointer string) const;
+		bool equalsNoCase(const_pointer stringval) const;
 
 		inline AbstractString& append(const AbstractString& str)
 		{
diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp
index 4389a0ae68..c5dc8d5307 100644
--- a/src/common/cvt.cpp
+++ b/src/common/cvt.cpp
@@ -1671,11 +1671,11 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
 		{
 			USHORT strtype_unused;
 			UCHAR* ptr;
-			USHORT l = CVT_get_string_ptr_common(from, &strtype_unused, &ptr, NULL, 0, cb);
+			USHORT sval = CVT_get_string_ptr_common(from, &strtype_unused, &ptr, NULL, 0, cb);
 
-			if (l == to->dsc_length)
+			if (sval == to->dsc_length)
 			{
-				memcpy(to->dsc_address, ptr, l);
+				memcpy(to->dsc_address, ptr, sval);
 				return;
 			}
 		}
diff --git a/src/gpre/sqe.cpp b/src/gpre/sqe.cpp
index 61e989c3fa..bcd8b11065 100644
--- a/src/gpre/sqe.cpp
+++ b/src/gpre/sqe.cpp
@@ -1721,6 +1721,7 @@ static gpre_ctx* par_alias_list( gpre_req* request, gpre_nod* alias_list)
 	// a base table having a matching table name or alias
 
 	if (!context)
+	{
 		for (context = request->req_contexts; context; context = context->ctx_next)
 		{
 			if (context->ctx_scope_level != request->req_scope_level)
@@ -1738,7 +1739,8 @@ static gpre_ctx* par_alias_list( gpre_req* request, gpre_nod* alias_list)
 			fb_utils::snprintf(error_string, sizeof(error_string),
 				"there is no alias or table named %s at this scope level",
 				(TEXT*) *arg);
-		PAR_error(error_string);
+			PAR_error(error_string);
+		}
 	}
 
 	// find the base table using the specified alias list, skipping the first one
diff --git a/src/gpre/sql.cpp b/src/gpre/sql.cpp
index 1f42573e41..32df2a2b03 100644
--- a/src/gpre/sql.cpp
+++ b/src/gpre/sql.cpp
@@ -5159,7 +5159,7 @@ static act* act_upsert(void)
 
 	if (MSC_match(KW_RETURNING))
 	{
-		gpre_nod* value_list = SQE_list(SQE_value_or_null, NULL, false);
+		gpre_nod* value_list2 = SQE_list(SQE_value_or_null, NULL, false);
 
 		if (!MSC_match(KW_INTO))
 			CPR_s_error("INTO");
@@ -5177,7 +5177,7 @@ static act* act_upsert(void)
 		gpre_sym* new_ctx_sym = MSC_symbol(SYM_context, NEW_CONTEXT, strlen(NEW_CONTEXT), update_context);
 		HSH_insert(new_ctx_sym);
 
-		upd_ret_list = return_values(request, value_list, var_list);
+		upd_ret_list = return_values(request, value_list2, var_list);
 
 		// restore the insertion context back
 
@@ -5186,12 +5186,12 @@ static act* act_upsert(void)
 
 		new_ctx_sym->sym_object = insert_context;
 
-		ins_ret_list = return_values(request, value_list, var_list);
+		ins_ret_list = return_values(request, value_list2, var_list);
 
-		for (int i = 0; i < value_list->nod_count; i++)
-			SQE_resolve(&value_list->nod_arg[i], request, NULL);
+		for (int i = 0; i < value_list2->nod_count; i++)
+			SQE_resolve(&value_list2->nod_arg[i], request, NULL);
 
-		into(request, value_list, var_list);
+		into(request, value_list2, var_list);
 		ref_list = (ref*) var_list;
 
 		HSH_remove(new_ctx_sym);
diff --git a/src/jrd/Database.h b/src/jrd/Database.h
index 4f81b88c90..62a5526638 100644
--- a/src/jrd/Database.h
+++ b/src/jrd/Database.h
@@ -81,8 +81,8 @@ namespace Jrd
 	class TrigVector : public Firebird::ObjectsArray<Trigger>
 	{
 	public:
-		TrigVector(Firebird::MemoryPool& pool)
-			: Firebird::ObjectsArray<Trigger>(pool),
+		TrigVector(Firebird::MemoryPool& mempool)
+			: Firebird::ObjectsArray<Trigger>(mempool),
 			  useCount(0)
 		{ }
 
diff --git a/src/jrd/RuntimeStatistics.h b/src/jrd/RuntimeStatistics.h
index d00b3fb61c..3543d89a2a 100644
--- a/src/jrd/RuntimeStatistics.h
+++ b/src/jrd/RuntimeStatistics.h
@@ -101,8 +101,8 @@ public:
 		reset();
 	}
 
-	explicit RuntimeStatistics(MemoryPool& pool)
-		: Firebird::AutoStorage(pool), rel_counts(getPool())
+	explicit RuntimeStatistics(MemoryPool& mempool)
+		: Firebird::AutoStorage(mempool), rel_counts(getPool())
 	{
 		reset();
 	}
@@ -117,8 +117,8 @@ public:
 		relChgNumber = other.relChgNumber;
 	}
 
-	RuntimeStatistics(MemoryPool& pool, const RuntimeStatistics& other)
-		: Firebird::AutoStorage(pool), rel_counts(getPool())
+	RuntimeStatistics(MemoryPool& mempool, const RuntimeStatistics& other)
+		: Firebird::AutoStorage(mempool), rel_counts(getPool())
 	{
 		memcpy(values, other.values, sizeof(values));
 		rel_counts = other.rel_counts;
diff --git a/src/jrd/common.h b/src/jrd/common.h
index 49e8b607d8..37fb209480 100644
--- a/src/jrd/common.h
+++ b/src/jrd/common.h
@@ -494,7 +494,11 @@ extern "C" int remove(const char* path);
 /* The following define is the prefix to go in front of a "d" or "u"
    format item in a printf() format string, to indicate that the argument
    is an SINT64 or FB_UINT64. */
+#if !defined(__USE_MINGW_ANSI_STDIO)
 #define QUADFORMAT "I64"
+#else
+#define QUADFORMAT "ll"
+#endif
 /* The following macro creates a quad-sized constant, possibly one
    which is too large to fit in a long int.  The Microsoft compiler does
    not permit the LL suffix which some other platforms require, but it
diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp
index a802e8ce90..b603a8dde1 100644
--- a/src/jrd/gds.cpp
+++ b/src/jrd/gds.cpp
@@ -122,7 +122,7 @@ static const TEXT gdslogid[] = "";
 
 #ifdef WIN_NT
 #include <shlobj.h>
-#if _MSC_VER <= 1500
+#if defined(_MSC_VER) && (_MSC_VER<=1500)
 #include <shfolder.h>
 #endif
 #define _WINSOCKAPI_
-- 
2.13.0

