From a59d2a8e2eaae026d2de518644e4d93be8f29d3b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 8 Jul 2010 04:50:46 +0000 Subject: [PATCH] Fix 64-bit compilation errors Originally committed to SVN as r4663. --- aegisub/libaegisub/common/charset_conv.cpp | 4 ++-- aegisub/libaegisub/common/vfr.cpp | 6 +++--- aegisub/libaegisub/include/libaegisub/line_iterator.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aegisub/libaegisub/common/charset_conv.cpp b/aegisub/libaegisub/common/charset_conv.cpp index f5b61c3a0..bd9cc1e57 100644 --- a/aegisub/libaegisub/common/charset_conv.cpp +++ b/aegisub/libaegisub/common/charset_conv.cpp @@ -84,7 +84,7 @@ struct iconv_fallbacks { class Converter : public iconv_fallbacks { bool subst; - int bomSize; + size_t bomSize; char invalidRep[8]; size_t invalidRepSize; static void fallback( @@ -163,7 +163,7 @@ public: // convert at least one extra character char bom[8]; char *dst = bom; - size_t dstSize = min(8U, bomSize + *outbytesleft); + size_t dstSize = min((size_t)8, bomSize + *outbytesleft); const char *src = *inbuf; size_t srcSize = *inbytesleft; iconv(cd, ICONV_CONST_CAST(&src), &srcSize, &dst, &dstSize); diff --git a/aegisub/libaegisub/common/vfr.cpp b/aegisub/libaegisub/common/vfr.cpp index 667154842..9bd7aa4ed 100644 --- a/aegisub/libaegisub/common/vfr.cpp +++ b/aegisub/libaegisub/common/vfr.cpp @@ -231,7 +231,7 @@ void Framerate::Save(std::string const& filename, int length) const { out << "# timecode format v2\n"; std::copy(timecodes.begin(), timecodes.end(), std::ostream_iterator(out, "\n")); - for (int written = timecodes.size(); written < length; ++written) { + for (int written = (int)timecodes.size(); written < length; ++written) { out << TimeAtFrame(written) << std::endl; } } @@ -268,10 +268,10 @@ int Framerate::FrameAtTime(int ms, Time type) const { return (int)floor((ms - timecodes.front()) * fps / 1000.); } if (ms > timecodes.back()) { - return round((ms - timecodes.back()) * fps / 1000.) + timecodes.size() - 1; + return round((ms - timecodes.back()) * fps / 1000.) + (int)timecodes.size() - 1; } - return std::distance(std::lower_bound(timecodes.rbegin(), timecodes.rend(), ms, std::greater()), timecodes.rend()) - 1; + return (int)std::distance(std::lower_bound(timecodes.rbegin(), timecodes.rend(), ms, std::greater()), timecodes.rend()) - 1; } int Framerate::TimeAtFrame(int frame, Time type) const { diff --git a/aegisub/libaegisub/include/libaegisub/line_iterator.h b/aegisub/libaegisub/include/libaegisub/line_iterator.h index 0761b7bf6..5a8f6570c 100644 --- a/aegisub/libaegisub/include/libaegisub/line_iterator.h +++ b/aegisub/libaegisub/include/libaegisub/line_iterator.h @@ -47,7 +47,7 @@ class line_iterator : public std::iterator std::tr1::shared_ptr conv; int cr; ///< CR character in the source encoding int lf; ///< LF character in the source encoding - int width; ///< width of LF character in the source encoding + size_t width; ///< width of LF character in the source encoding /// @brief Convert a string to the output type /// @param str Line read from the file @@ -161,11 +161,11 @@ void line_iterator::getline(std::string &str) { for (;;) { chr = 0; #ifdef _WIN32 - int read = stream->rdbuf()->_Sgetn_s(buf, 4, width); + std::streamsize read = stream->rdbuf()->_Sgetn_s(buf, 4, width); #else - int read = stream->rdbuf()->sgetn(buf, width); + std::streamsize read = stream->rdbuf()->sgetn(buf, width); #endif - if (read < width) { + if (read < (std::streamsize)width) { for (int i = 0; i < read; i++) { str += buf[i]; }