(svn r13019) -Fix [FS#1997]: silence some more MSVC x64 warnings (michi_cc)
authorglx
Thu, 08 May 2008 20:05:32 +0000
changeset 10476 31c6b70ade1c
parent 10475 6b7ca9f978f0
child 10477 84cf8bf8184e
(svn r13019) -Fix [FS#1997]: silence some more MSVC x64 warnings (michi_cc)
src/autoreplace_gui.cpp
src/build_vehicle_gui.cpp
src/minilzo.cpp
src/saveload.cpp
src/win32.cpp
--- a/src/autoreplace_gui.cpp	Thu May 08 19:26:55 2008 +0000
+++ b/src/autoreplace_gui.cpp	Thu May 08 20:05:32 2008 +0000
@@ -411,7 +411,7 @@
 					uint16 click_scroll_pos = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? w->vscroll.pos : w->vscroll2.pos;
 					uint16 click_scroll_cap = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? w->vscroll.cap : w->vscroll2.cap;
 					byte click_side         = e->we.click.widget == RVW_WIDGET_LEFT_MATRIX ? 0 : 1;
-					uint16 engine_count     = WP(w, replaceveh_d).list[click_side].size();
+					size_t engine_count     = WP(w, replaceveh_d).list[click_side].size();
 
 					if (i < click_scroll_cap) {
 						i += click_scroll_pos;
--- a/src/build_vehicle_gui.cpp	Thu May 08 19:26:55 2008 +0000
+++ b/src/build_vehicle_gui.cpp	Thu May 08 20:05:32 2008 +0000
@@ -1034,7 +1034,7 @@
 
 		case BUILD_VEHICLE_WIDGET_LIST: {
 			uint i = (e->we.click.pt.y - w->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
-			uint num_items = bv->eng_list.size();
+			size_t num_items = bv->eng_list.size();
 			bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE;
 			w->SetDirty();
 			break;
--- a/src/minilzo.cpp	Thu May 08 19:26:55 2008 +0000
+++ b/src/minilzo.cpp	Thu May 08 20:05:32 2008 +0000
@@ -1029,7 +1029,7 @@
 		{
 		register const lzo_byte *m_pos;
 		lzo_moff_t m_off;
-		lzo_uint m_len;
+		lzo_ptrdiff_t m_len;
 		lzo_uint dindex;
 
 		DINDEX1(dindex,ip);
--- a/src/saveload.cpp	Thu May 08 19:26:55 2008 +0000
+++ b/src/saveload.cpp	Thu May 08 20:05:32 2008 +0000
@@ -531,7 +531,7 @@
 static inline size_t SlCalcNetStringLen(const char *ptr, size_t length)
 {
 	if (ptr == NULL) return 0;
-	return minu(strlen(ptr), length - 1);
+	return min(strlen(ptr), length - 1);
 }
 
 /** Calculate the gross length of the string that it
@@ -911,7 +911,7 @@
 static void SlLoadChunk(const ChunkHandler *ch)
 {
 	byte m = SlReadByte();
-	size_t len;
+	uint32 len;
 	uint32 endoffs;
 
 	_sl.block_mode = m;
@@ -1204,9 +1204,9 @@
 	_z.avail_out = 4096;
 
 	do {
-		/* read more bytes from the file?*/
+		/* read more bytes from the file? */
 		if (_z.avail_in == 0) {
-			_z.avail_in = fread(_z.next_in = _sl.buf + 4096, 1, 4096, _sl.fh);
+			_z.avail_in = (uint)fread(_z.next_in = _sl.buf + 4096, 1, 4096, _sl.fh);
 		}
 
 		/* inflate the data */
--- a/src/win32.cpp	Thu May 08 19:26:55 2008 +0000
+++ b/src/win32.cpp	Thu May 08 20:05:32 2008 +0000
@@ -1090,7 +1090,7 @@
 	const char *ptr;
 
 	WChar c;
-	uint16 width, length;
+	size_t width, length;
 
 	if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
 		OpenClipboard(NULL);
@@ -1123,7 +1123,7 @@
 		if (!IsPrintable(c)) break;
 
 		size_t len = Utf8CharLen(c);
-		if (tb->length + length >= tb->maxlength - (uint16)len) break;
+		if (tb->length + length >= tb->maxlength - len) break;
 
 		byte charwidth = GetCharacterWidth(FS_NORMAL, c);
 		if (tb->maxwidth != 0 && width + tb->width + charwidth > tb->maxwidth) break;
@@ -1253,7 +1253,7 @@
  * @return pointer to utf8_buf. If conversion fails the string is of zero-length */
 char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen)
 {
-	int len = WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8_buf, buflen, NULL, NULL);
+	int len = WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8_buf, (int)buflen, NULL, NULL);
 	if (len == 0) {
 		DEBUG(misc, 0, "[utf8] W2M error converting wide-string. Errno %d", GetLastError());
 		utf8_buf[0] = '\0';
@@ -1272,7 +1272,7 @@
  * @return pointer to utf16_buf. If conversion fails the string is of zero-length */
 wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen)
 {
-	int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, utf16_buf, buflen);
+	int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, utf16_buf, (int)buflen);
 	if (len == 0) {
 		DEBUG(misc, 0, "[utf8] M2W error converting '%s'. Errno %d", name, GetLastError());
 		utf16_buf[0] = '\0';