# HG changeset patch # User glx # Date 2008-05-08 20:05:32 # Node ID cf660ff00dd09e841c7220ba600be3824b23f60f # Parent 115b507aef7b6ec1842e0201b361a05cbb4a690e (svn r13019) -Fix [FS#1997]: silence some more MSVC x64 warnings (michi_cc) diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -411,7 +411,7 @@ static void ReplaceVehicleWndProc(Window 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 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1034,7 +1034,7 @@ static void BuildVehicleClickEvent(Windo 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 --- a/src/minilzo.cpp +++ b/src/minilzo.cpp @@ -1029,7 +1029,7 @@ lzo_uint do_compress ( const lzo_byte * { 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 --- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -531,7 +531,7 @@ static void SlSaveLoadConv(void *ptr, Va 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, 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 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -1090,7 +1090,7 @@ bool InsertTextBufferClipboard(Textbuf * 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 * 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 *nam * @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';