From 0b37b81956ff5548aed20c1260af3426ac99b291 Mon Sep 17 00:00:00 2001 From: glx Date: Thu, 8 May 2008 20:05:32 +0000 Subject: (svn r13019) -Fix [FS#1997]: silence some more MSVC x64 warnings (michi_cc) --- src/autoreplace_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 2 +- src/minilzo.cpp | 2 +- src/saveload.cpp | 8 ++++---- src/win32.cpp | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index b7b060024..4a8cfdcfb 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -411,7 +411,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) 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; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index fa397a7ec..d3d6cb02c 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1034,7 +1034,7 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e) 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; diff --git a/src/minilzo.cpp b/src/minilzo.cpp index 702526153..1a3a306d0 100644 --- a/src/minilzo.cpp +++ b/src/minilzo.cpp @@ -1029,7 +1029,7 @@ lzo_uint do_compress ( const lzo_byte *in , lzo_uint in_len, { 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); diff --git a/src/saveload.cpp b/src/saveload.cpp index ff2c4b3fb..abca0db1d 100644 --- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -531,7 +531,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv) 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 @@ void SlAutolength(AutolengthProc *proc, void *arg) static void SlLoadChunk(const ChunkHandler *ch) { byte m = SlReadByte(); - size_t len; + uint32 len; uint32 endoffs; _sl.block_mode = m; @@ -1204,9 +1204,9 @@ static uint ReadZlib() _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 */ diff --git a/src/win32.cpp b/src/win32.cpp index e2f010fff..fd19af539 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -1090,7 +1090,7 @@ bool InsertTextBufferClipboard(Textbuf *tb) const char *ptr; WChar c; - uint16 width, length; + size_t width, length; if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { OpenClipboard(NULL); @@ -1123,7 +1123,7 @@ bool InsertTextBufferClipboard(Textbuf *tb) 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 @@ const TCHAR *OTTD2FS(const char *name) * @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 @@ char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen) * @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'; -- cgit v1.2.3-70-g09d2