Sfoglia il codice sorgente

fixed win64 warnings

Alexey N. Vinogradov 5 anni fa
parent
commit
84750208e7

+ 2 - 2
src/attribute.cpp

@@ -824,7 +824,7 @@ bool sphCheckBlobRow ( int64_t iOff, DebugCheckReader_i & tBlobs, const CSphSche
 		sError = "Blob row too long";
 
 	CSphFixedVector<BYTE> dLengths ( uAttrLengths );
-	tBlobs.GetBytes ( dLengths.Begin(), dLengths.GetLengthBytes() );
+	tBlobs.GetBytes ( dLengths.Begin(), (int) dLengths.GetLengthBytes() );
 	const BYTE * pLen = dLengths.Begin();
 
 	CSphVector<int> dAttrLengths ( nBlobAttrs );
@@ -859,7 +859,7 @@ bool sphCheckBlobRow ( int64_t iOff, DebugCheckReader_i & tBlobs, const CSphSche
 	}
 
 	CSphFixedVector<BYTE> dAttrs ( uTotalLength );
-	tBlobs.GetBytes ( dAttrs.Begin(), dAttrs.GetLengthBytes() );
+	tBlobs.GetBytes ( dAttrs.Begin(), (int) dAttrs.GetLengthBytes() );
 	const BYTE * pAttr = dAttrs.Begin();
 	for ( int i = 0; i < nBlobAttrs; i++ )
 	{

+ 3 - 3
src/fileutils.cpp

@@ -171,7 +171,7 @@ bool sphCalcFileCRC32 ( const char * szFilename, DWORD & uCRC32 )
 		pBuffer = new BYTE [ BUFFER_SIZE ];
 
 	int iBytesRead;
-	while ( ( iBytesRead = fread ( pBuffer, 1, BUFFER_SIZE, pFile ) )!=0 )
+	while ( ( iBytesRead = (int) fread ( pBuffer, 1, BUFFER_SIZE, pFile ) )!=0 )
 	{
 		for ( int i=0; i<iBytesRead; i++ )
 			crc = (crc >> 8) ^ g_dSphinxCRC32 [ (crc ^ pBuffer[i]) & 0xff ];
@@ -397,7 +397,7 @@ int64_t sphRead ( int iFD, void * pBuf, size_t iCount )
 	if ( pIOStats )
 		tmStart = sphMicroTimer();
 
-	int64_t iRead = ::read ( iFD, pBuf, iCount );
+	int64_t iRead = ::read ( iFD, pBuf, (int) iCount );
 
 	if ( pIOStats )
 	{
@@ -412,7 +412,7 @@ int64_t sphRead ( int iFD, void * pBuf, size_t iCount )
 
 bool sphWrite ( int iFD, const void * pBuf, size_t iSize )
 {
-	return ( iSize==(size_t)::write ( iFD, pBuf, iSize ) );
+	return ( iSize==(size_t)::write ( iFD, pBuf, (int) iSize ) );
 }
 
 

+ 3 - 3
src/gtests/gtests_json.cpp

@@ -128,7 +128,7 @@ namespace {
 void te (const char* src, const char* target)
 {
 	char buf[100];
-	int iRes = JsonUnescape ( buf, src, strlen(src) );
+	int iRes = JsonUnescape ( buf, src, (int)strlen(src) );
 	buf[iRes]='\0';
 	assert ( iRes<=(int)strlen(src));
 	ASSERT_STREQ (target,buf);
@@ -207,7 +207,7 @@ TEST ( bench, DISABLED_json_unescape )
 	cJSON * pJson = cJSON_CreateObject ();
 
 	const char sLiteral[] = R"("In `docs/searching/expressions,_functions,_and_operators.rst` which reflected into\\nhttps://manticoresearch.gitlab.io/dev/searching/expressions,_functions,_and_operators.html\\n\\n1. At the top there is a kind of TOC with shortcuts to the functions described in the section.\\nHowever this TOC is not consistent. I.e., it doesn't refer to all function actually described there.\\n\\nMost prominent example is 'PACKEDFACTORS()' - it absent in the TOC.\\n\\n2. Also consider whether it is better or not to sort function descriptions in the section alphabetically ('REMAP' at the end looks strange, as 'WEIGHT' is before it).")";
-	auto iLen = strlen ( sLiteral );
+	auto iLen = (int) strlen ( sLiteral );
 	char buf[sizeof(sLiteral)];
 
 	auto iTimeSpan = -sphMicroTimer ();
@@ -1188,7 +1188,7 @@ TEST ( bench, DISABLED_bson_vs_cjson )
 	auto uLoops = 1000000;
 
 	const char sLiteral[] = R"({"query":{"percolate":{"document":{"title":"A new tree test in the office office"}}}})";
-	auto iLen = strlen ( sLiteral );
+	auto iLen = (int) strlen ( sLiteral );
 
 	const volatile void * pRes = nullptr;
 	CSphString sBuf;

+ 2 - 2
src/gtests/gtests_rtstuff.cpp

@@ -76,7 +76,7 @@ public:
 		for ( int i = 0; i<m_iFields; i++ )
 		{
 			char * szField = ( char * ) ( m_ppDocs + iDoc * m_iFields )[i];
-			m_dFieldLengths[i] = strlen ( szField );
+			m_dFieldLengths[i] = (int) strlen ( szField );
 		}
 
 		const CSphColumnInfo * pId = m_tSchema.GetAttr ( sphGetDocidName() );
@@ -161,7 +161,7 @@ public:
 			, sphRand(), sphRand(), sphRand(), sphRand(), sphRand() );
 
 		for ( int i=0; i < m_iMaxFields; ++i )
-			m_dFieldLengths[i] = strlen ( m_ppFields[i] );
+			m_dFieldLengths[i] = (int) strlen ( m_ppFields[i] );
 
 		return (BYTE**) &m_ppFields[0];
 	}

+ 2 - 2
src/gtests/gtests_text.cpp

@@ -89,8 +89,8 @@ TEST( Text, HTMLStriper )
 
 static int ProxyLevenshtein ( const char * sA, const char * sB )
 {
-	int iLenA = strlen ( sA );
-	int iLenB = strlen ( sB );
+	auto iLenA = (int) strlen ( sA );
+	auto iLenB = (int) strlen ( sB );
 	return sphLevenshtein ( sA, iLenA, sB, iLenB );
 }
 

+ 19 - 19
src/gtests/gtests_tokenizer.cpp

@@ -106,7 +106,7 @@ TEST_F( Tokenizer, exceptions_more )
 
 	for ( int iCur = 0; dTests[iCur]; )
 	{
-		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests[iCur], strlen ( dTests[iCur] ) );
+		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests[iCur], (int) strlen ( dTests[iCur] ) );
 		++iCur;
 
 		for ( BYTE * pToken = m_pTokenizer->GetToken (); pToken; pToken = m_pTokenizer->GetToken () )
@@ -140,7 +140,7 @@ TEST_F ( Tokenizer, special_blended )
 	ASSERT_TRUE ( pTokenizer->SetBlendMode ( "trim_none, skip_pure", sError ) );
 
 	char sTest10[] = "hello =- =world";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest10, strlen ( sTest10 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest10, (int) strlen ( sTest10 ) );
 
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "hello" );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "=world" );
@@ -152,7 +152,7 @@ TEST_F ( Tokenizer, noascii_case )
 	ASSERT_TRUE (
 		pTokenizer->SetCaseFolding ( "U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+451, U+451", sError ) );
 	char sTest20[] = "abc \xD0\xBE\xD0\xBF\xD0\xB0\x58\xD1\x87\xD0\xB0 def";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest20, strlen ( sTest20 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest20, (int) strlen ( sTest20 ) );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "\xD0\xBE\xD0\xBF\xD0\xB0" );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "\xD1\x87\xD0\xB0" );
 	ASSERT_FALSE ( pTokenizer->GetToken () );
@@ -239,7 +239,7 @@ TEST_F ( Tokenizer, Sentence )
 	int i = 0;
 	while ( sTest[i] )
 	{
-		pTokenizer->SetBuffer ( ( BYTE * ) sTest[i], strlen ( sTest[i] ) );
+		pTokenizer->SetBuffer ( ( BYTE * ) sTest[i], (int) strlen ( sTest[i] ) );
 		i++;
 
 		BYTE * sTok;
@@ -271,7 +271,7 @@ protected:
 TEST_F ( TokenizerBlended, texas )
 {
 	char sTest1[] = "(texas.\\\")";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest1, strlen ( sTest1 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest1, (int) strlen ( sTest1 ) );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "(" );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "texas." );
 	ASSERT_TRUE ( pTokenizer->TokenIsBlended () );
@@ -283,7 +283,7 @@ TEST_F ( TokenizerBlended, texas )
 TEST_F ( TokenizerBlended, series2003 )
 {
 	char sTest2[] = "\"series 2003\\-\\\"\"";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest2, strlen ( sTest2 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest2, (int) strlen ( sTest2 ) );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "\"" );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "series" );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "2003-" );
@@ -294,7 +294,7 @@ TEST_F ( TokenizerBlended, series2003 )
 TEST_F ( TokenizerBlended, aa_lock_up_bb )
 {
 	char sTest3[] = "aa lock.up bb";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest3, strlen ( sTest3 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest3, (int) strlen ( sTest3 ) );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "aa" );
 	ASSERT_FALSE ( pTokenizer->TokenIsBlended () );
 	ASSERT_FALSE ( pTokenizer->TokenIsBlendedPart () );
@@ -314,7 +314,7 @@ TEST_F ( TokenizerBlended, aa_lock_up_bb )
 TEST_F ( TokenizerBlended, text_3rd )
 {
 	char sTest4[] = "3.rd text";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest4, strlen ( sTest4 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest4, (int) strlen ( sTest4 ) );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "3.rd" );
 	ASSERT_TRUE ( pTokenizer->TokenIsBlended () );
 	ASSERT_TRUE ( pTokenizer->SkipBlended ()==1 );
@@ -326,7 +326,7 @@ TEST_F ( TokenizerBlended, text_3rd )
 TEST_F ( TokenizerBlended, text_123rd )
 {
 	char sTest5[] = "123\\@rd text";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest5, strlen ( sTest5 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest5, (int) strlen ( sTest5 ) );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "123@rd" );
 	ASSERT_TRUE ( pTokenizer->TokenIsBlended () );
 	ASSERT_TRUE ( pTokenizer->SkipBlended ()==2 );
@@ -338,7 +338,7 @@ TEST_F ( TokenizerBlended, text_123rd )
 TEST_F ( TokenizerBlended, at_ta_c_da_bl_ok_yo_pest )
 {
 	char sTest6[] = "at.ta\\.c.da\\.bl.ok yo pest";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest6, strlen ( sTest6 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest6, (int) strlen ( sTest6 ) );
 	ASSERT_STREQ (  ( const char * ) pTokenizer->GetToken (), "at.ta.c.da.bl.ok" );
 	ASSERT_TRUE ( pTokenizer->TokenIsBlended () );
 	ASSERT_TRUE ( pTokenizer->SkipBlended ()==5 );
@@ -350,7 +350,7 @@ TEST_F ( TokenizerBlended, at_ta_c_da_bl_ok_yo_pest )
 TEST_F ( TokenizerBlended, text_3_at_rd )
 {
 	char sTest7[] = "3\\@rd text";
-	pTokenizer->SetBuffer ( ( BYTE * ) sTest7, strlen ( sTest7 ) );
+	pTokenizer->SetBuffer ( ( BYTE * ) sTest7, (int) strlen ( sTest7 ) );
 	ASSERT_STREQ ( ( const char * ) pTokenizer->GetToken (), "3@rd" );
 	ASSERT_TRUE ( pTokenizer->TokenIsBlended () );
 	ASSERT_TRUE ( pTokenizer->SkipBlended ()==1 ); // because 3 is overshort!
@@ -441,7 +441,7 @@ TEST_P( TokenizerP, OneLineTests )
 
 	for ( int iCur = 0; dTests[iCur] && ( dTests[iCur++][0]-'0' )<=iRun; )
 	{
-		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests[iCur], strlen ( dTests[iCur] ) );
+		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests[iCur], (int) strlen ( dTests[iCur] ) );
 		iCur++;
 
 		for ( BYTE * pToken = m_pTokenizer->GetToken (); pToken; pToken = m_pTokenizer->GetToken () )
@@ -462,7 +462,7 @@ TEST_P( TokenizerP, MiscOneLineTests )
 	const char * dTests2[] = { "\xC2\x80\xC2\x81\xC2\x82", "\xC2\x80\xC2\x81\xC2\x82", NULL, NULL };
 	for ( int iCur = 0; dTests2[iCur]; )
 	{
-		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests2[iCur], strlen ( dTests2[iCur] ) );
+		m_pTokenizer->SetBuffer ( ( BYTE * ) dTests2[iCur], (int) strlen ( dTests2[iCur] ) );
 		iCur++;
 
 		for ( BYTE * pToken = m_pTokenizer->GetToken (); pToken; pToken = m_pTokenizer->GetToken () )
@@ -497,7 +497,7 @@ TEST_P( TokenizerP, uberlong )
 	memset ( sTok4, 'a', SPH_MAX_WORD_LEN );
 	sTok4[SPH_MAX_WORD_LEN] = '\0';
 
-	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, strlen ( sLine4 ) );
+	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, (int) strlen ( sLine4 ) );
 	ASSERT_STREQ ( ( char * ) m_pTokenizer->GetToken (), sTok4 );
 	ASSERT_FALSE ( m_pTokenizer->GetToken () );
 	SafeDeleteArray ( sLine4 );
@@ -512,7 +512,7 @@ TEST_P( TokenizerP, uberlong_synonim_only )
 		memset ( sLine4, '/', UBERLONG );
 		sLine4[UBERLONG] = '\0';
 
-		m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, strlen ( sLine4 ) );
+		m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, (int) strlen ( sLine4 ) );
 		ASSERT_FALSE( m_pTokenizer->GetToken () );
 
 		for ( int i = 0; i<UBERLONG - 3; i += 3 )
@@ -523,7 +523,7 @@ TEST_P( TokenizerP, uberlong_synonim_only )
 			sLine4[i + 3] = '\0';
 		}
 
-		m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, strlen ( sLine4 ) );
+		m_pTokenizer->SetBuffer ( ( BYTE * ) sLine4, (int) strlen ( sLine4 ) );
 		for ( int i = 0; i<UBERLONG - 3; i += 3 )
 			ASSERT_STREQ ( ( char * ) m_pTokenizer->GetToken (), "aa" );
 		ASSERT_FALSE ( m_pTokenizer->GetToken () );
@@ -552,7 +552,7 @@ TEST_P ( TokenizerP, short_token_handling )
 
 	for ( int iCur = 0; dTestsShort[iCur]; )
 	{
-		pShortTokenizer->SetBuffer ( ( BYTE * ) ( dTestsShort[iCur] ), strlen ( ( const char * ) dTestsShort[iCur] ) );
+		pShortTokenizer->SetBuffer ( ( BYTE * ) ( dTestsShort[iCur] ), (int) strlen ( ( const char * ) dTestsShort[iCur] ) );
 		iCur++;
 		for ( BYTE * pToken = pShortTokenizer->GetToken (); pToken; pToken = pShortTokenizer->GetToken () )
 		{
@@ -572,7 +572,7 @@ TEST_P( TokenizerP, boundaries )
 	ASSERT_TRUE ( m_pTokenizer->SetBoundary ( "?", sError ) );
 
 	char sLine5[] = "hello world? testing boundaries?";
-	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine5, strlen ( sLine5 ) );
+	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine5, (int) strlen ( sLine5 ) );
 
 	ASSERT_STREQ ( ( const char * ) m_pTokenizer->GetToken (), "hello" );
 	ASSERT_FALSE ( m_pTokenizer->GetBoundary () );
@@ -587,7 +587,7 @@ TEST_P( TokenizerP, boundaries )
 TEST_P( TokenizerP, specials_vs_tokens_start_end_ptrs )
 {
 	char sLine6[] = "abc!def";
-	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine6, strlen ( sLine6 ) );
+	m_pTokenizer->SetBuffer ( ( BYTE * ) sLine6, (int) strlen ( sLine6 ) );
 
 	ASSERT_STREQ ( ( const char * ) m_pTokenizer->GetToken (), "abc" );
 	ASSERT_EQ( *m_pTokenizer->GetTokenStart (), 'a' );

+ 2 - 2
src/index_converter.cpp

@@ -2167,12 +2167,12 @@ static void GetKilledDocs ( const CSphFixedVector<int> & dRtChunkNames, int iCur
 			continue;
 		}
 
-		int iCount = tKill.GetFilesize() / sizeof(SphDocID_t);
+		auto iCount = (int) (tKill.GetFilesize() / sizeof(SphDocID_t));
 		if ( !iCount )
 			continue;
 
 		int iOff = dKilled.GetLength();
-		dKilled.Resize ( iOff + iCount );
+		dKilled.Resize ( iOff + (int) iCount );
 		for ( int iElem=0; iElem<iCount; iElem++ )
 			dKilled[iOff+iElem] = tKill.GetOffset();
 	}

+ 14 - 14
src/indexcheck.cpp

@@ -209,11 +209,11 @@ void DebugCheckHelper_c::DebugCheck_Attributes ( DebugCheckReader_i & tAttrs, De
 
 	CSphFixedVector<CSphRowitem> dRow ( tSchema.GetRowSize() );
 	const CSphRowitem * pRow = dRow.Begin();
-	tAttrs.SeekTo ( 0, dRow.GetLengthBytes() );
+	tAttrs.SeekTo ( 0, (int) dRow.GetLengthBytes() );
 
 	for ( int64_t iRow=0; iRow<nRows; iRow++ )
 	{
-		tAttrs.GetBytes ( dRow.Begin(), dRow.GetLengthBytes() );
+		tAttrs.GetBytes ( dRow.Begin(), (int) dRow.GetLengthBytes() );
 		DocID_t tDocID = sphGetDocID(pRow);
 
 		///////////////////////////
@@ -536,7 +536,7 @@ void DiskIndexChecker_c::CheckDictionary()
 				iDelta = uPack & 127;
 				iMatch = tDictReader.GetByte();
 			}
-			const int iLastWordLen = strlen(sLastWord);
+			auto iLastWordLen = (const int) strlen(sLastWord);
 			if ( iMatch+iDelta>=(int)sizeof(sLastWord)-1 || iMatch>iLastWordLen )
 			{
 				m_tReporter.Fail ( "wrong word-delta (pos=" INT64_FMT ", word=%s, len=%d, begin=%d, delta=%d)", iDictPos, sLastWord, iLastWordLen, iMatch, iDelta );
@@ -562,7 +562,7 @@ void DiskIndexChecker_c::CheckDictionary()
 				bHitless = true;
 			}
 
-			const int iNewWordLen = strlen(sWord);
+			auto iNewWordLen = (const int) strlen(sWord);
 
 			if ( iNewWordLen==0 )
 				m_tReporter.Fail ( "empty word in dictionary (pos=" INT64_FMT ")", iDictPos );
@@ -620,7 +620,7 @@ void DiskIndexChecker_c::CheckDictionary()
 
 			if ( bWordDict )
 			{
-				const int iLen = strlen ( sWord );
+				auto iLen = (const int) strlen ( sWord );
 				char * sArenaWord = dCheckpointWords.AddN ( iLen + 1 );
 				memcpy ( sArenaWord, sWord, iLen );
 				sArenaWord[iLen] = '\0';
@@ -645,7 +645,7 @@ void DiskIndexChecker_c::CheckDictionary()
 	{
 		CSphWordlistCheckpoint tRefCP = dCheckpoints[i];
 		const CSphWordlistCheckpoint & tCP = m_tWordlist.m_dCheckpoints[i];
-		const int iLen = bWordDict ? strlen ( tCP.m_sWord ) : 0;
+		const int iLen = bWordDict ? (int) strlen ( tCP.m_sWord ) : 0;
 		if ( bWordDict )
 			tRefCP.m_sWord = dCheckpointWords.Begin() + tRefCP.m_uWordID;
 		if ( bWordDict && ( tRefCP.m_sWord[0]=='\0' || tCP.m_sWord[0]=='\0' ) )
@@ -742,7 +742,7 @@ void DiskIndexChecker_c::CheckDocs()
 				iDelta = uPack & 127;
 				iMatch = m_tDictReader.GetByte();
 			}
-			const int iLastWordLen = strlen(sWord);
+			auto iLastWordLen = (const int) strlen(sWord);
 			if ( iMatch+iDelta>=(int)sizeof(sWord)-1 || iMatch>iLastWordLen )
 				m_tDictReader.SkipBytes ( iDelta );
 			else
@@ -1074,7 +1074,7 @@ void DiskIndexChecker_c::CheckBlockIndex()
 
 	CSphFixedVector<CSphRowitem> dRow ( m_tSchema.GetRowSize() );
 	const CSphRowitem * pRow = dRow.Begin();
-	m_tAttrReader.SeekTo ( 0, dRow.GetLengthBytes() );
+	m_tAttrReader.SeekTo ( 0, (int) dRow.GetLengthBytes() );
 
 	const int64_t iMinMaxEnd = sizeof(DWORD) * m_iMinMaxIndex + sizeof(DWORD) * ( m_iDocinfoIndex+1 ) * uStride * 2;
 	CSphFixedVector<DWORD> dMinMax ( uStride*2 );
@@ -1098,15 +1098,15 @@ void DiskIndexChecker_c::CheckBlockIndex()
 			if ( int64_t( iBlockPos + sizeof(DWORD) * uStride) > iMinMaxEnd )
 				m_tReporter.Fail ( "unexpected block index end (row=" INT64_FMT ", block=" INT64_FMT ")", iIndexEntry, iBlock );
 
-			m_tAttrReader.SeekTo ( iBlockPos, dMinMax.GetLengthBytes() );
-			m_tAttrReader.GetBytes ( dMinMax.Begin(), dMinMax.GetLengthBytes() );
+			m_tAttrReader.SeekTo ( iBlockPos, (int) dMinMax.GetLengthBytes() );
+			m_tAttrReader.GetBytes ( dMinMax.Begin(), (int) dMinMax.GetLengthBytes() );
 			if ( m_tAttrReader.GetErrorFlag() )
 				m_tReporter.Fail ( "unexpected block index (row=" INT64_FMT ", block=" INT64_FMT ")", iIndexEntry, iBlock );
 
-			m_tAttrReader.SeekTo ( iPos, dRow.GetLengthBytes() );
+			m_tAttrReader.SeekTo ( iPos, (int) dRow.GetLengthBytes() );
 		}
 
-		m_tAttrReader.GetBytes ( dRow.Begin(), dRow.GetLengthBytes() );
+		m_tAttrReader.GetBytes ( dRow.Begin(), (int) dRow.GetLengthBytes() );
 		const DocID_t tDocID = sphGetDocID(pRow);
 
 		// check values vs blocks range
@@ -1181,7 +1181,7 @@ void DiskIndexChecker_c::CheckDocidLookup()
 	int64_t iLookupEnd = tLookup.GetFilesize();
 
 	CSphFixedVector<CSphRowitem> dRow ( m_tSchema.GetRowSize() );
-	m_tAttrReader.SeekTo ( 0, dRow.GetLengthBytes() );
+	m_tAttrReader.SeekTo ( 0, (int) dRow.GetLengthBytes() );
 	CSphBitvec dRowids ( m_iNumRows );
 
 	int iDocs = tLookup.GetDword();
@@ -1295,7 +1295,7 @@ void DiskIndexChecker_c::CheckDocids()
 	m_tReporter.Msg ( "checking docid douplicates ..." );
 
 	CSphFixedVector<CSphRowitem> dRow ( m_tSchema.GetRowSize() );
-	m_tAttrReader.SeekTo ( 0, dRow.GetLengthBytes() );
+	m_tAttrReader.SeekTo ( 0, (int) dRow.GetLengthBytes() );
 
 	CSphFixedVector<DocidRowidPair_t> dRows ( m_iNumRows );
 	for ( int i=0; i<m_iNumRows; i++ )

+ 4 - 4
src/indexer.cpp

@@ -1504,10 +1504,10 @@ LONG WINAPI sigsegv ( EXCEPTION_POINTERS * pExc )
 	const char * sFailVer = szMANTICORE_NAME;
 
 	sphBacktrace ( pExc, g_sMinidump );
-	::write ( STDERR_FILENO, sFail1, strlen(sFail1) );
-	::write ( STDERR_FILENO, g_sMinidump, strlen(g_sMinidump) );
-	::write ( STDERR_FILENO, sFail2, strlen(sFail2) );
-	::write ( STDERR_FILENO, sFailVer, strlen(sFailVer) );
+	::write ( STDERR_FILENO, sFail1, (unsigned int) strlen ( sFail1 ) );
+	::write ( STDERR_FILENO, g_sMinidump, (unsigned int) strlen(g_sMinidump) );
+	::write ( STDERR_FILENO, sFail2, (unsigned int) strlen ( sFail2 ) );
+	::write ( STDERR_FILENO, sFailVer, (unsigned int) strlen ( sFailVer ) );
 	::write ( STDERR_FILENO, "\n", 1);
 
 	CRASH_EXIT;

+ 1 - 1
src/indexformat.cpp

@@ -535,7 +535,7 @@ void CWordlist::GetPrefixedWords ( const char * sSubstring, int iSubLen, const c
 		if ( pCheckpoint > &m_dCheckpoints.Last() )
 			break;
 
-		if ( sphDictCmp ( sSubstring, iSubLen, pCheckpoint->m_sWord, strlen ( pCheckpoint->m_sWord ) )<0 )
+		if ( sphDictCmp ( sSubstring, iSubLen, pCheckpoint->m_sWord, (int) strlen ( pCheckpoint->m_sWord ) )<0 )
 			break;
 	}
 

+ 4 - 4
src/indextool.cpp

@@ -34,7 +34,7 @@ void StripStdin ( const char * sIndexAttrs, const char * sRemoveElements )
 	while ( !feof(stdin) )
 	{
 		char sBuffer[1024];
-		int iLen = fread ( sBuffer, 1, sizeof(sBuffer), stdin );
+		auto iLen = (int) fread ( sBuffer, 1, sizeof(sBuffer), stdin );
 		if ( !iLen )
 			break;
 
@@ -55,7 +55,7 @@ void ApplyMorphology ( CSphIndex * pIndex )
 	char sBuffer[READ_BUFFER_SIZE];
 	while ( !feof(stdin) )
 	{
-		int iLen = fread ( sBuffer, 1, sizeof(sBuffer), stdin );
+		auto iLen = (int) fread ( sBuffer, 1, sizeof(sBuffer), stdin );
 		if ( !iLen )
 			break;
 		dInBuffer.Append ( sBuffer, iLen );
@@ -75,7 +75,7 @@ void ApplyMorphology ( CSphIndex * pIndex )
 			if ( pDict )
 				pDict->ApplyStemmers ( sToken );
 
-			int iLen = strlen ( (char *)sToken );
+			auto iLen = (int) strlen ( (char *)sToken );
 			sToken[iLen] = ' ';
 			dOutBuffer.Append ( sToken, iLen+1 );
 		}
@@ -106,7 +106,7 @@ void CharsetFold ( CSphIndex * pIndex, FILE * fp )
 	int iBuf1 = 0; // how many leftover bytes from previous iteration
 	while ( !feof(fp) )
 	{
-		int iGot = fread ( sBuf1.Begin()+iBuf1, 1, sBuf1.GetLength()-iBuf1, fp );
+		auto iGot = (int) fread ( sBuf1.Begin()+iBuf1, 1, sBuf1.GetLength()-iBuf1, fp );
 		if ( iGot<0 )
 			sphDie ( "read error: %s", strerrorm(errno) );
 

+ 25 - 20
src/searchd.cpp

@@ -423,7 +423,7 @@ void sphLog ( ESphLogLevel eLevel, const char * sFmt, va_list ap )
 	char * sTtyBuf = sBuf + strlen(sBuf);
 	strncpy ( sTtyBuf, sBanner, 32 ); // 32 is arbitrary; just something that is enough and keeps lint happy
 
-	int iLen = strlen(sBuf);
+	auto iLen = (int) strlen(sBuf);
 
 	// format the message
 	if ( sFmt )
@@ -1461,7 +1461,7 @@ void ISphOutputBuffer::SendBytes ( const char * pBuf )
 {
 	if ( !pBuf )
 		return;
-	SendBytes ( pBuf, strlen ( pBuf ) );
+	SendBytes ( pBuf, (int) strlen ( pBuf ) );
 }
 
 void ISphOutputBuffer::SendBytes ( const CSphString& sStr )
@@ -2245,7 +2245,7 @@ void PrepareQueryEmulation ( CSphQuery * pQuery )
 		return;
 
 	const char * szQuery = pQuery->m_sRawQuery.cstr ();
-	int iQueryLen = ( szQuery ? strlen(szQuery) : 0 );
+	int iQueryLen = szQuery ? (int) strlen(szQuery) : 0;
 
 	pQuery->m_sQuery.Reserve ( iQueryLen*2+8 );
 	char * szRes = (char*) pQuery->m_sQuery.cstr ();
@@ -2818,7 +2818,7 @@ public:
 	explicit UnBackquote_fn ( const char * pSrc )
 	{
 		m_pDst = pSrc;
-		int iLen = 0;
+		size_t iLen = 0;
 		if ( pSrc && *pSrc )
 			iLen = strlen ( pSrc );
 
@@ -3912,7 +3912,7 @@ static void RecoverAggregateFunctions ( const CSphQuery & tQuery, const AggrResu
 
 		for ( int j=0; j<tRes.m_tSchema.GetAttrsCount(); j++ )
 		{
-			CSphColumnInfo & tCol = const_cast<CSphColumnInfo&> ( tRes.m_tSchema.GetAttr(j) );
+			auto & tCol = const_cast<CSphColumnInfo&> ( tRes.m_tSchema.GetAttr(j) );
 			if ( tCol.m_sName==tItem.m_sAlias )
 			{
 				assert ( tCol.m_eAggrFunc==SPH_AGGR_NONE );
@@ -5051,7 +5051,7 @@ void SearchHandler_c::RunActionQuery ( const CSphQuery & tQuery, const CSphStrin
 
 	OnRunFinished();
 
-	CSphQueryResult & tRes = m_dResults[0];
+	auto & tRes = m_dResults[0];
 
 	tRes.m_iOffset = tQuery.m_iOffset;
 	tRes.m_iCount = Max ( Min ( tQuery.m_iLimit, tRes.m_dMatches.GetLength()-tQuery.m_iOffset ), 0 );
@@ -5328,7 +5328,8 @@ void SearchHandler_c::RunLocalSearchesParallel()
 		t.m_pCurSearch = &iaCursor;
 		t.m_iSearches = dWorks.GetLength();
 		t.m_pSearches = dWorks.Begin();
-		SphCrashLogger_c::ThreadCreate ( &t.m_tThd, LocalSearchThreadFunc, (void*)&t, false, "LocalSearch" ); // FIXME! check result
+		SphCrashLogger_c::ThreadCreate ( &t.m_tThd, LocalSearchThreadFunc, (void*)&t, false, "LocalSearch" );
+		// FIXME! check result
 	}
 
 	// wait for them to complete
@@ -6512,7 +6513,7 @@ void SearchHandler_c::RunSubset ( int iStart, int iEnd )
 					if ( !pResult )
 						continue;
 
-					const CSphQueryResult &tRemoteResult = pResult->m_dResults[iRes - iStart];
+					const auto &tRemoteResult = pResult->m_dResults[iRes - iStart];
 
 					// copy errors or warnings
 					if ( !tRemoteResult.m_sError.IsEmpty() )
@@ -8873,7 +8874,7 @@ void SendMysqlErrorPacket ( ISphOutputBuffer & tOut, BYTE uPacketID, const char
 
 	LogSphinxqlError ( sStmt, sError, iCID );
 
-	int iErrorLen = strlen(sError);
+	auto iErrorLen = (int) strlen(sError);
 
 	// cut the error message to fix isseue with long message for popular clients
 	if ( iErrorLen>SPH_MYSQL_ERROR_MAX_LENGTH )
@@ -8939,7 +8940,7 @@ void SendMysqlOkPacket ( ISphOutputBuffer & tOut, BYTE uPacketID, int iAffectedR
 
 	int iMsgLen = 0;
 	if ( sMessage )
-		iMsgLen = strlen(sMessage);
+		iMsgLen = (int) strlen(sMessage);
 
 	tOut.SendLSBDword ( DWORD (uPacketID<<24) + iLen + iMsgLen + 5);
 	tOut.SendByte ( 0 );				// ok packet
@@ -9006,7 +9007,7 @@ class SqlRowBuffer_c : public RowBuffer_i, private LazyVector_T<BYTE>
 
 	void SendSqlString ( const char * sStr )
 	{
-		int iLen = strlen ( sStr );
+		auto iLen = (int) strlen ( sStr );
 		SendSqlInt ( iLen );
 		m_tOut.SendBytes ( sStr, iLen );
 	}
@@ -15235,7 +15236,8 @@ public:
 				StatCountCommand ( eStmt==STMT_INSERT ? SEARCHD_COMMAND_INSERT : SEARCHD_COMMAND_REPLACE );
 				StmtErrorReporter_c tErrorReporter ( tOut );
 				sphHandleMysqlInsert ( tErrorReporter, *pStmt, eStmt==STMT_REPLACE,
-					m_tVars.m_bAutoCommit && !m_tVars.m_bInTransaction, m_tLastMeta.m_sWarning, m_tAcc, m_tVars.m_eCollation, m_tVars.m_dLastIds );
+					m_tVars.m_bAutoCommit && !m_tVars.m_bInTransaction, m_tLastMeta.m_sWarning, m_tAcc,
+					m_tVars.m_eCollation, m_tVars.m_dLastIds );
 				return true;
 			}
 
@@ -15879,7 +15881,8 @@ static void HandleClientMySQL ( int iSock, ThdDesc_t & tThd ) REQUIRES ( Handler
 		ThdState ( ThdState_e::NET_READ, tThd );
 		if ( !tIn.ReadFrom ( iPacketLen, g_iClientQlTimeout, true ) )
 		{
-			sphWarning ( "failed to receive MySQL request body (client=%s(%d), exp=%d, error='%s')", sClientIP, iCID, iPacketLen, sphSockError() );
+			sphWarning ( "failed to receive MySQL request body (client=%s(%d), exp=%d, error='%s')", sClientIP, iCID,
+					iPacketLen, sphSockError() );
 			break;
 		}
 
@@ -15894,13 +15897,15 @@ static void HandleClientMySQL ( int iSock, ThdDesc_t & tThd ) REQUIRES ( Handler
 			{
 				if ( !ReadMySQLPacketHeader ( iSock, iAddonLen, uPacketID ) )
 				{
-					sphLogDebugv ( "conn %s(%d): bailing on failed MySQL header2 (sockerr=%s)", sClientIP, iCID, sphSockError() );
+					sphLogDebugv ( "conn %s(%d): bailing on failed MySQL header2 (sockerr=%s)", sClientIP, iCID,
+							sphSockError() );
 					break;
 				}
 
 				if ( !tIn.ReadFrom ( iAddonLen, g_iClientQlTimeout, true, true ) )
 				{
-					sphWarning ( "failed to receive MySQL request body2 (client=%s(%d), exp=%d, error='%s')", sClientIP, iCID, iAddonLen, sphSockError() );
+					sphWarning ( "failed to receive MySQL request body2 (client=%s(%d), exp=%d, error='%s')", sClientIP,
+							iCID, iAddonLen, sphSockError() );
 					iAddonLen = -1;
 					break;
 				}
@@ -17288,7 +17293,7 @@ bool CheckConfigChanges ( CSphVector<char>& dContent )
 	} else
 	{
 		while ( bGotLine ) {
-			auto iLen = strlen ( sBuf );
+			auto iLen = (int) strlen ( sBuf );
 			dContent.Append ( sBuf, iLen );
 			bGotLine = !!fgets ( sBuf, sizeof ( sBuf ), fp );
 		}
@@ -17861,7 +17866,7 @@ const char * WinErrorInfo ()
 	DWORD uErr = ::GetLastError ();
 	snprintf ( sBuf, sizeof(sBuf), "code=%d, error=", uErr );
 
-	int iLen = strlen(sBuf);
+	auto iLen = (int) strlen(sBuf);
 	if ( !FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, uErr, 0, sBuf+iLen, sizeof(sBuf)-iLen, NULL ) ) // FIXME? force US-english langid?
 		snprintf ( sBuf+iLen, sizeof(sBuf)-iLen, "(no message)" );
 
@@ -17891,7 +17896,7 @@ void AppendArg ( char * sBuf, int iBufLimit, const char * sArg )
 	if ( sBuf>=sBufMax )
 		return;
 
-	int iArgLen = strlen(sArg);
+	auto iArgLen = (int) strlen(sArg);
 	bool bQuote = false;
 	for ( int i=0; i<iArgLen && !bQuote; i++ )
 		if ( sArg[i]==' ' || sArg[i]=='"' )
@@ -19006,7 +19011,7 @@ void ConfigureSearchd ( const CSphConfig & hConf, bool bOptPIDFile )
 	if ( g_iMysqlHandshake>=(int)sizeof(g_sMysqlHandshake) )
 	{
 		sphWarning ( "mysql_version_string too long; using default (version=%s)", szMANTICORE_VERSION );
-		g_iMysqlHandshake = sizeof(sHandshake1) + strlen(szMANTICORE_VERSION) + sizeof(sHandshake2) - 1;
+		g_iMysqlHandshake = sizeof(sHandshake1) + (int) strlen(szMANTICORE_VERSION) + sizeof(sHandshake2) - 1;
 		assert ( g_iMysqlHandshake < (int)sizeof(g_sMysqlHandshake) );
 	}
 
@@ -19915,7 +19920,7 @@ int WINAPI ServiceMain ( int argc, char **argv ) REQUIRES (!MainThread)
 
 		char sPid[16];
 		snprintf ( sPid, sizeof(sPid), "%d\n", (int)getpid() );
-		int iPidLen = strlen(sPid);
+		auto iPidLen = (int) strlen(sPid);
 
 		sphSeek ( g_iPidFD, 0, SEEK_SET );
 		if ( !sphWrite ( g_iPidFD, sPid, iPidLen ) )

+ 9 - 9
src/searchdaemon.cpp

@@ -52,7 +52,7 @@ CheckLike::CheckLike( const char* sPattern )
 	if ( !sPattern )
 		return;
 
-	m_sPattern.Reserve( 2 * strlen( sPattern ));
+	m_sPattern.Reserve( 2 * (int) strlen( sPattern ));
 	char* d = const_cast<char*> ( m_sPattern.cstr());
 
 	// remap from SQL LIKE syntax to Sphinx wildcards syntax
@@ -239,7 +239,7 @@ ListenerDesc_t ParseListener( const char* sSpec )
 
 	// check if it all starts with a valid port number
 	auto sPart = dParts[0].cstr();
-	int iLen = strlen( sPart );
+	auto iLen = (int) strlen( sPart );
 
 	bool bAllDigits = true;
 	for ( int i = 0; i<iLen && bAllDigits; ++i )
@@ -650,7 +650,7 @@ ISphOutputBuffer::ISphOutputBuffer( CSphVector<BYTE>& dChunk )
 
 void ISphOutputBuffer::SendString( const char* sStr )
 {
-	int iLen = sStr ? strlen( sStr ) : 0;
+	int iLen = sStr ? (int) strlen( sStr ) : 0;
 	SendInt( iLen );
 	SendBytes( sStr, iLen );
 }
@@ -677,8 +677,8 @@ void CachedOutputBuffer_c::CommitMeasuredLength( intptr_t iStoredPos )
 		return;
 	auto iPos = m_dBlobs.Pop();
 	assert ( iStoredPos==-1 || iStoredPos==iPos );
-	int iBlobLen = m_dBuf.GetLength() - iPos - sizeof( int );
-	WriteInt( iPos, iBlobLen );
+	auto iBlobLen = m_dBuf.GetLength() - iPos - sizeof( int );
+	WriteInt( iPos, (int) iBlobLen );
 }
 
 void CachedOutputBuffer_c::CommitAllMeasuredLengths()
@@ -686,8 +686,8 @@ void CachedOutputBuffer_c::CommitAllMeasuredLengths()
 	while ( !m_dBlobs.IsEmpty())
 	{
 		auto uPos = m_dBlobs.Pop();
-		int iBlobLen = m_dBuf.GetLength() - uPos - sizeof( int );
-		WriteInt( uPos, iBlobLen );
+		auto iBlobLen = m_dBuf.GetLength() - uPos - sizeof( int );
+		WriteInt( uPos, (int) iBlobLen );
 	}
 }
 
@@ -764,7 +764,7 @@ size_t SmartOutputBuffer_t::GetIOVec( CSphVector<sphIovec>& dOut ) const
 	{
 		auto& dIovec = dOut.Add();
 		IOPTR ( dIovec ) = IOBUFTYPE ( GetBufPtr());
-		IOLEN ( dIovec ) = m_dBuf.GetLengthBytes();
+		IOLEN ( dIovec ) = (int) m_dBuf.GetLengthBytes();
 		iOutSize += IOLEN ( dIovec );
 	}
 	assert ( dOut.GetLength()<UIO_MAXIOV );
@@ -1591,7 +1591,7 @@ CSphString GetMacAddress()
 #if USE_WINDOWS
 	CSphFixedVector<IP_ADAPTER_ADDRESSES> dAdapters ( 128 );
 	PIP_ADAPTER_ADDRESSES pAdapter = dAdapters.Begin();
-	DWORD uSize = dAdapters.GetLengthBytes();
+	auto uSize = (DWORD) dAdapters.GetLengthBytes();
 	if ( GetAdaptersAddresses ( 0, 0, nullptr, pAdapter, &uSize )==NO_ERROR )
 	{
 		while ( pAdapter )

+ 3 - 3
src/searchdaemon.h

@@ -1260,7 +1260,7 @@ void GetArray ( CSphFixedVector<T> & dBuf, InputBuffer_c & tIn )
 		return;
 
 	dBuf.Reset ( iCount );
-	tIn.GetBytes ( dBuf.Begin(), dBuf.GetLengthBytes() );
+	tIn.GetBytes ( dBuf.Begin(), (int) dBuf.GetLengthBytes() );
 }
 
 template<typename T>
@@ -1271,7 +1271,7 @@ void GetArray ( CSphVector<T> & dBuf, MemoryReader_c & tIn )
 		return;
 
 	dBuf.Resize ( iCount );
-	tIn.GetBytes ( dBuf.Begin(), dBuf.GetLengthBytes() );
+	tIn.GetBytes ( dBuf.Begin(), (int) dBuf.GetLengthBytes() );
 }
 
 template <typename T>
@@ -1416,7 +1416,7 @@ public:
 	// Fire he header for table with iSize string columns
 	void HeadOfStrings ( const char ** ppNames, size_t iSize )
 	{
-		HeadBegin ( iSize );
+		HeadBegin ( (int) iSize );
 		for ( ; iSize>0 ; --iSize )
 			HeadColumn ( *ppNames++ );
 		HeadEnd();

+ 1 - 1
src/searchdfields.cpp

@@ -270,7 +270,7 @@ static bool GetFieldFromLocal ( const CSphString & sIndexName, const GetFieldArg
 			
 			FieldTrait_t & tFieldDesc = tRes.m_dOff.Add();
 			tFieldDesc.m_iOff = tRes.m_dFields.GetLength();
-			tFieldDesc.m_iSize = tFieldData.GetLengthBytes();
+			tFieldDesc.m_iSize = (int) tFieldData.GetLengthBytes();
 
 			BYTE * pField = tRes.m_dFields.AddN ( tFieldDesc.m_iSize );
 			memcpy ( pField, tFieldData.Begin(), tFieldDesc.m_iSize );

+ 11 - 8
src/searchdha.cpp

@@ -20,6 +20,7 @@
 #include "searchdtask.h"
 
 #include <utility>
+#include <atomic>
 #include <errno.h>
 
 #if !USE_WINDOWS
@@ -525,7 +526,8 @@ CSphString MultiAgentDesc_c::GetKey ( const CSphVector<AgentDesc_t *> &dTemplate
 	return sKey.cstr();
 }
 
-MultiAgentDesc_c * MultiAgentDesc_c::GetAgent ( const CSphVector<AgentDesc_t*> & dHosts, const AgentOptions_t & tOpt, const WarnInfo_c & tWarn ) NO_THREAD_SAFETY_ANALYSIS
+MultiAgentDesc_c * MultiAgentDesc_c::GetAgent ( const CSphVector<AgentDesc_t*> & dHosts, const AgentOptions_t & tOpt,
+		const WarnInfo_c & tWarn ) NO_THREAD_SAFETY_ANALYSIS
 {
 	auto sKey = GetKey ( dHosts, tOpt );
 	auto &gHash = g_MultiAgents ();
@@ -543,7 +545,8 @@ MultiAgentDesc_c * MultiAgentDesc_c::GetAgent ( const CSphVector<AgentDesc_t*> &
 	return ( MultiAgentDesc_c * ) gHash.TryAddThenGet ( pAgent, sKey );
 }
 
-bool MultiAgentDesc_c::Init ( const CSphVector<AgentDesc_t *> & dHosts, const AgentOptions_t & tOpt, const WarnInfo_c & tWarn ) NO_THREAD_SAFETY_ANALYSIS
+bool MultiAgentDesc_c::Init ( const CSphVector<AgentDesc_t *> &dHosts,
+			const AgentOptions_t &tOpt, const WarnInfo_c &tWarn ) NO_THREAD_SAFETY_ANALYSIS
 {
 	// initialize options
 	m_eStrategy = tOpt.m_eStrategy;
@@ -1876,7 +1879,7 @@ inline SSIZE_T AgentConn_t::RecvChunk ()
 		ScheduleCallbacks ();
 	WSABUF dBuf;
 	dBuf.buf = (CHAR*) m_pReplyCur;
-	dBuf.len = ReplyBufPlace ();
+	dBuf.len = (ULONG) ReplyBufPlace ();
 	DWORD uFlags = 0;
 	m_pPollerTask->m_dRead.Zero ();
 	sphLogDebugA ( "%d Scheduling overlapped WSARecv for %d bytes", m_iStoreTag, ReplyBufPlace () );
@@ -1894,7 +1897,7 @@ inline SSIZE_T AgentConn_t::SendChunk ()
 	m_pPollerTask->m_dWrite.Zero ();
 	sphLogDebugA ( "%d overlaped WSASend called for %d chunks", m_iStoreTag, m_dIOVec.IOSize () );
 	m_pPollerTask->m_dWrite.m_bInUse = true;
-	WSASend ( m_iSock, m_dIOVec.IOPtr (), m_dIOVec.IOSize (), nullptr, 0, &m_pPollerTask->m_dWrite, nullptr );
+	WSASend ( m_iSock, m_dIOVec.IOPtr (), (DWORD) m_dIOVec.IOSize (), nullptr, 0, &m_pPollerTask->m_dWrite, nullptr );
 	return -1;
 }
 
@@ -1999,7 +2002,7 @@ int AgentConn_t::DoTFO ( struct sockaddr * pSs, int iLen )
 	if ( iRes>=0 ) // lucky; we already sent something!
 	{
 		track_processing_time ( *this );
-		sphLogDebugA ( "%d sendmsg/connectx returned %zu", m_iStoreTag, ( size_t ) iRes );
+		sphLogDebugA ( "%d sendmsg/connectx returned %d", m_iStoreTag, ( size_t ) iRes );
 		sphLogDebugv ( "TFO send succeeded, %zu bytes sent", ( size_t ) iRes );
 		// now 'connect' and 'query' merged, so timeout became common.
 		m_iPoolerTimeout += 1000*m_iMyQueryTimeout;
@@ -2437,7 +2440,7 @@ bool AgentConn_t::ReceiveAnswer ( DWORD uRecv )
 
 		m_pReplyCur += iRes;
 		auto iRest = ReplyBufPlace ();
-		sphLogDebugA ( "%d RecvChunk returned %d (%zu bytes rest in input buffer)", m_iStoreTag, ( int ) iRes, iRest );
+		sphLogDebugA ( "%d RecvChunk returned %d (%d bytes rest in input buffer)", m_iStoreTag, ( int ) iRes, iRest );
 
 		// We're in state of receiving the header (m_iReplySize==-1 is the indicator)
 		if ( IsReplyHeader () && iRest<=( REPLY_HEADER_SIZE - 4 ))
@@ -3135,11 +3138,11 @@ private:
 			{
 				iOp = EPOLL_CTL_ADD;
 				++iEvents;
-				sphLogDebugL ( "L EPOLL_CTL_ADD(%d) -> %d, %d+%d events", pTask->m_ifd, tEv.events, m_iEvents, iEvents );
+				sphLogDebugL ( "L EPOLL_CTL_ADD(%d) -> %x, %d+%d events", pTask->m_ifd, tEv.events, m_iEvents, iEvents );
 			} else
 			{
 				iOp = EPOLL_CTL_MOD;
-				sphLogDebugL ( "L EPOLL_CTL_MOD(%d) -> %d, %d+%d events", pTask->m_ifd, tEv.events, m_iEvents, iEvents );
+				sphLogDebugL ( "L EPOLL_CTL_MOD(%d) -> %x, %d+%d events", pTask->m_ifd, tEv.events, m_iEvents, iEvents );
 			}
 		}
 

+ 6 - 6
src/searchdhttp.cpp

@@ -98,7 +98,7 @@ bool HttpRequestParser_c::Parse ( const BYTE * pData, int iDataLen )
 	http_parser tParser;
 	tParser.data = this;
 	http_parser_init ( &tParser, HTTP_REQUEST );
-	int iParsed = http_parser_execute ( &tParser, &tParserSettings, (const char *)pData, iDataLen );
+	auto iParsed = (int) http_parser_execute ( &tParser, &tParserSettings, (const char *)pData, iDataLen );
 	if ( iParsed!=iDataLen )
 	{
 		m_szError = http_errno_description ( (http_errno)tParser.http_errno );
@@ -247,7 +247,7 @@ int HttpRequestParser_c::ParserUrl ( http_parser * pParser, const char * sAt, si
 int HttpRequestParser_c::ParserHeaderField ( http_parser * pParser, const char * sAt, size_t iLen )
 {
 	assert ( pParser->data );
-	( (HttpRequestParser_c *)pParser->data )->m_sCurField.SetBinary ( sAt, iLen );
+	( (HttpRequestParser_c *)pParser->data )->m_sCurField.SetBinary ( sAt, (int) iLen );
 	return 0;
 }
 
@@ -255,7 +255,7 @@ int HttpRequestParser_c::ParserHeaderValue ( http_parser * pParser, const char *
 {
 	assert ( pParser->data );
 	CSphString sVal;
-	sVal.SetBinary ( sAt, iLen );
+	sVal.SetBinary ( sAt, (int) iLen );
 	auto * pHttpParser = (HttpRequestParser_c *)pParser->data;
 	pHttpParser->m_hOptions.Add ( sVal, pHttpParser->m_sCurField );
 	pHttpParser->m_sCurField = "";
@@ -266,8 +266,8 @@ int HttpRequestParser_c::ParserBody ( http_parser * pParser, const char * sAt, s
 {
 	assert ( pParser->data );
 	auto * pHttpParser = (HttpRequestParser_c *)pParser->data;
-	pHttpParser->ParseList ( sAt, iLen );
-	pHttpParser->m_sRawBody.SetBinary ( sAt, iLen );
+	pHttpParser->ParseList ( sAt, (int) iLen );
+	pHttpParser->m_sRawBody.SetBinary ( sAt, (int) iLen );
 	return 0;
 }
 
@@ -464,7 +464,7 @@ protected:
 			HttpErrorReply ( m_dData, eStatus, szError );
 		else
 		{
-			m_dData.Resize ( strlen(szError) );
+			m_dData.Resize ( (int) strlen ( szError ) );
 			memcpy ( m_dData.Begin(), szError, m_dData.GetLength() );
 		}
 	}

+ 9 - 9
src/searchdreplication.cpp

@@ -569,7 +569,7 @@ static wsrep_cb_status_t SstDonate_fn ( void * pAppCtx, void * pRecvCtx, const v
 	ReceiverCtx_t * pLocalCtx = (ReceiverCtx_t *)pRecvCtx;
 	
 	CSphString sNode;
-	sNode.SetBinary ( (const char *)sMsg, iMsgLen );
+	sNode.SetBinary ( (const char *)sMsg, (int) iMsgLen );
 
 	wsrep_gtid_t tGtid = *pStateID;
 	char sGtid[WSREP_GTID_STR_LEN];
@@ -640,7 +640,7 @@ static wsrep_cb_status_t Apply_fn ( void * pCtx, const void * pData, size_t uSiz
 	bool bIsolated = ( ( uFlags & WSREP_FLAG_ISOLATION )!=0 );
 	sphLogDebugRpl ( "writeset at apply, seq " INT64_FMT ", size %d, flags %u, on %s", (int64_t)pMeta->gtid.seqno, (int)uSize, uFlags, ( bCommit ? "commit" : "rollback" ) );
 
-	if ( !ParseCmdReplicated ( (const BYTE *)pData, uSize, bIsolated, pLocalCtx->m_pCluster->m_sName, pLocalCtx->m_tAcc, pLocalCtx->m_tUpdAPI, pLocalCtx->m_tQuery ) )
+	if ( !ParseCmdReplicated ( (const BYTE *)pData, (int) uSize, bIsolated, pLocalCtx->m_pCluster->m_sName, pLocalCtx->m_tAcc, pLocalCtx->m_tUpdAPI, pLocalCtx->m_tQuery ) )
 		return WSREP_CB_FAILURE;
 
 	return WSREP_CB_SUCCESS;
@@ -1732,8 +1732,8 @@ static bool HandleCmdReplicate ( RtAccum_t & tAcc, CSphString & sError, int * pD
 			bTOI = true;
 			bUpdate = true;
 
-			uQueryHash = sphFNV64 ( pUpd->m_dDocids.Begin(), pUpd->m_dDocids.GetLengthBytes(), uQueryHash );
-			uQueryHash = sphFNV64 ( pUpd->m_dPool.Begin(), pUpd->m_dPool.GetLengthBytes(), uQueryHash );
+			uQueryHash = sphFNV64 ( pUpd->m_dDocids.Begin(), (int) pUpd->m_dDocids.GetLengthBytes(), uQueryHash );
+			uQueryHash = sphFNV64 ( pUpd->m_dPool.Begin(), (int) pUpd->m_dPool.GetLengthBytes(), uQueryHash );
 
 			SaveUpdate ( *pUpd, dBufQueries );
 		}
@@ -1748,8 +1748,8 @@ static bool HandleCmdReplicate ( RtAccum_t & tAcc, CSphString & sError, int * pD
 			bTOI = true;
 			bUpdate = true;
 
-			uQueryHash = sphFNV64 ( pUpd->m_dDocids.Begin(), pUpd->m_dDocids.GetLengthBytes(), uQueryHash );
-			uQueryHash = sphFNV64 ( pUpd->m_dPool.Begin(), pUpd->m_dPool.GetLengthBytes(), uQueryHash );
+			uQueryHash = sphFNV64 ( pUpd->m_dDocids.Begin(), (int) pUpd->m_dDocids.GetLengthBytes(), uQueryHash );
+			uQueryHash = sphFNV64 ( pUpd->m_dPool.Begin(), (int) pUpd->m_dPool.GetLengthBytes(), uQueryHash );
 
 			SaveUpdate ( *pUpd, dBufQueries );
 			SaveUpdate ( *tCmd.m_pUpdateCond, dBufQueries );
@@ -2235,7 +2235,7 @@ static bool NewClusterForce ( const CSphString & sPath, CSphString & sError )
 	SphOffset_t iStateSize = tReader.GetFilesize();
 	while ( tReader.GetPos()<iStateSize )
 	{
-		int iLineLen = tReader.GetLine ( dBuf.Begin(), dBuf.GetLengthBytes() );
+		int iLineLen = tReader.GetLine ( dBuf.Begin(), (int) dBuf.GetLengthBytes() );
 		// replace value of safe_to_bootstrap to 1
 		if ( iLineLen>iPatternLen && strncmp ( sPattern, dBuf.Begin(), iPatternLen )==0 )
 			iLineLen = snprintf ( dBuf.Begin(), dBuf.GetLengthBytes(), "%s: 1", sPattern );
@@ -3112,7 +3112,7 @@ public:
 		assert ( tCmd.m_pChunks );
 		GetArray ( tCmd.m_pChunks->m_dBaseNames, tBuf );
 		tCmd.m_pChunks->m_dHashes.Reset ( tCmd.m_pChunks->m_dBaseNames.GetLength() * HASH20_SIZE );
-		tBuf.GetBytes ( tCmd.m_pChunks->m_dHashes.Begin(), tCmd.m_pChunks->m_dHashes.GetLengthBytes() );
+		tBuf.GetBytes ( tCmd.m_pChunks->m_dHashes.Begin(), (int) tCmd.m_pChunks->m_dHashes.GetLengthBytes() );
 	}
 
 	static void BuildReply ( const PQRemoteReply_t & tRes, CachedOutputBuffer_c & tOut )
@@ -4826,7 +4826,7 @@ static void LoadFilter ( CSphFilterSettings & tItem, MemoryReader_c & tReader )
 	if ( iValues )
 	{
 		CSphFixedVector<SphAttr_t> dValues ( iValues );
-		tReader.GetBytes ( dValues.Begin(), dValues.GetLengthBytes() );
+		tReader.GetBytes ( dValues.Begin(), (int) dValues.GetLengthBytes() );
 
 		tItem.SetExternalValues ( dValues.LeakData(), iValues );
 	}

+ 1 - 1
src/searchnode.cpp

@@ -3316,7 +3316,7 @@ uint64_t ExtMultiAnd_T<USE_BM25,TEST_FIELDS>::GetWordID() const
 			m_dWordIds[i] = sphFNV64 ( tNode.m_pQword->m_sDictWord.cstr() );
 	}
 
-	return sphFNV64 ( m_dWordIds.Begin(), m_dWordIds.GetLengthBytes() );
+	return sphFNV64 ( m_dWordIds.Begin(), (int) m_dWordIds.GetLengthBytes() );
 }
 
 

+ 5 - 5
src/snippetindex.cpp

@@ -105,7 +105,7 @@ int SnippetsDocIndex_c::FindStarred ( const char * sWord ) const
 		return -1;
 
 	const BYTE * pBuf = m_dStarBuffer.Begin();
-	int iLen = strlen ( sWord );
+	auto iLen = (int) strlen ( sWord );
 	ARRAY_FOREACH ( i, m_dStars )
 	{
 		const Keyword_t & tTok = m_dStars[i];
@@ -211,13 +211,13 @@ void SnippetsDocIndex_c::ParseQuery ( ISphTokenizer * pTokenizer, CSphDict * pDi
 	if ( eExtQuerySPZ & SPH_SPZ_SENTENCE )
 	{
 		strncpy ( (char *)m_sTmpWord, MAGIC_WORD_SENTENCE, sizeof(m_sTmpWord)-1 );
-		AddWord ( pDict->GetWordID ( m_sTmpWord ), strlen ( (char*)m_sTmpWord ), iQPos );
+		AddWord ( pDict->GetWordID ( m_sTmpWord ), (int) strlen ( (char*)m_sTmpWord ), iQPos );
 		iQPos++;
 	}
 	if ( eExtQuerySPZ & SPH_SPZ_PARAGRAPH )
 	{
 		strncpy ( (char *)m_sTmpWord, MAGIC_WORD_PARAGRAPH, sizeof(m_sTmpWord)-1 );
-		AddWord ( pDict->GetWordID ( m_sTmpWord ), strlen ( (char*)m_sTmpWord ), iQPos );
+		AddWord ( pDict->GetWordID ( m_sTmpWord ), (int) strlen ( (char*)m_sTmpWord ), iQPos );
 		iQPos++;
 	}
 
@@ -225,7 +225,7 @@ void SnippetsDocIndex_c::ParseQuery ( ISphTokenizer * pTokenizer, CSphDict * pDi
 	ARRAY_FOREACH ( i, m_tQuery.m_dZones )
 	{
 		snprintf ( (char *)m_sTmpWord, sizeof(m_sTmpWord)-1, "%c%s", MAGIC_CODE_ZONE, m_tQuery.m_dZones[i].cstr() );
-		AddWord ( pDict->GetWordID ( m_sTmpWord ), strlen ( (char*)m_sTmpWord ), iQPos );
+		AddWord ( pDict->GetWordID ( m_sTmpWord ), (int) strlen ( (char*)m_sTmpWord ), iQPos );
 		iQPos++;
 	}
 
@@ -330,7 +330,7 @@ void SnippetsDocIndex_c::AddWord ( SphWordID_t iWordID, int iLengthCP, int iQpos
 
 void SnippetsDocIndex_c::AddWordStar ( const char * sWord, int iLengthCP, int iQpos )
 {
-	int iLen = strlen ( sWord );
+	auto iLen = (int) strlen ( sWord );
 	int iOff = m_dStarBuffer.GetLength();
 
 	m_dStarBuffer.Append ( sWord, iLen+1);

+ 1 - 1
src/snippetstream.cpp

@@ -892,7 +892,7 @@ void TokenizeDocument ( HitCollector_i & tFunctor, const CSphHTMLStripper * pStr
 
 		// might differ when sbsc got replaced by utf codepoint
 		int iTokenLen = pLastTokenEnd - pTokenStart;
-		int iWordLen = strlen ( ( const char *)sWord );
+		auto iWordLen = (int) strlen ( ( const char *)sWord );
 
 		bool bPopExactMulti = false;
 		if ( tIndexSettings.m_bIndexExactWords )

+ 9 - 9
src/spelldump.cpp

@@ -146,7 +146,7 @@ bool CISpellDict::Load ( const char * szFilename )
 		if ( !szResult )
 			break;
 
-		int iPos = strlen ( szWordBuffer ) - 1;
+		auto iPos = (int) strlen ( szWordBuffer ) - 1;
 		while ( iPos>=0 && isspace ( (unsigned char)szWordBuffer[iPos] ) )
 			szWordBuffer [iPos--] = '\0';
 
@@ -248,9 +248,9 @@ CISpellAffixRule::CISpellAffixRule ( RuleType_e eRule, char cFlag, bool bCrossPr
 	, m_sAppend			( szAppend )
 	, m_iWordLen		( 0 )
 {
-	m_iCondLen = szCondition ? strlen ( szCondition ) : 0;
-	m_iStripLen = szStrip ? strlen ( szStrip ) : 0;
-	m_iAppendLen = szAppend ? strlen ( szAppend ) : 0;
+	m_iCondLen = szCondition ? (int) strlen ( szCondition ) : 0;
+	m_iStripLen = szStrip ? (int) strlen ( szStrip ) : 0;
+	m_iAppendLen = szAppend ? (int) strlen ( szAppend ) : 0;
 }
 
 
@@ -262,7 +262,7 @@ bool CISpellAffixRule::Apply ( CSphString & sWord )
 	if ( sWord.IsEmpty () )
 		return false;
 
-	m_iWordLen = strlen ( sWord.cstr () );
+	m_iWordLen = (int) strlen ( sWord.cstr () );
 
 	bool bDotCond = ( m_sCondition=="." );
 	if ( m_eRule==RULE_SUFFIXES )
@@ -765,8 +765,8 @@ bool CISpellAffix::AddToCharset ( char * szRangeL, char * szRangeU )
 	if ( !szRangeL || !szRangeU )
 		return false;
 
-	int iLengthL = strlen ( szRangeL );
-	int iLengthU = strlen ( szRangeU );
+	auto iLengthL = (int) strlen ( szRangeL );
+	auto iLengthU = (int)strlen ( szRangeU );
 
 	bool bSetL = ( iLengthL>0 && szRangeL[0]=='[' && szRangeL[iLengthL-1]==']' );
 	bool bSetR = ( iLengthU>0 && szRangeU[0]=='[' && szRangeU[iLengthU-1]==']' );
@@ -1081,7 +1081,7 @@ int main ( int iArgs, char ** dArgs )
 			continue;
 
 		CSphString sWord, sWordForCross;
-		int iFlagLen = strlen ( pWord->m_sFlags.cstr () );
+		auto iFlagLen = (int) strlen ( pWord->m_sFlags.cstr () );
 		for ( int iFlag1 = 0; iFlag1 < iFlagLen; ++iFlag1 )
 			for ( int iRule1 = 0; iRule1 < Affix.GetNumRules (); ++iRule1 )
 			{
@@ -1151,7 +1151,7 @@ int main ( int iArgs, char ** dArgs )
 						break;
 					}
 
-					int iWordLength = strlen ( dWords[iWord].m_sWord.cstr() );
+					auto iWordLength = (int)strlen ( dWords[iWord].m_sWord.cstr() );
 					if ( iWordLength>iLength )
 					{
 						iLength = iWordLength;

+ 69 - 69
src/sphinx.cpp

@@ -1161,7 +1161,7 @@ bool CSphTokenizerIndex::GetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords,
 			sModifiedQuery = dFiltered.Begin();
 	}
 
-	pTokenizer->SetBuffer ( sModifiedQuery, strlen ( (const char*)sModifiedQuery) );
+	pTokenizer->SetBuffer ( sModifiedQuery, (int) strlen ( (const char*)sModifiedQuery) );
 
 	CSphTemplateQueryFilter tAotFilter;
 	tAotFilter.m_pTokenizer = pTokenizer;
@@ -2212,12 +2212,12 @@ static char * sphStrMacro ( const char * sTemplate, const char * sMacro, int64_t
 	snprintf ( sExp, sizeof(sExp), INT64_FMT, iValue );
 
 	// calc lengths
-	int iExp = strlen ( sExp );
-	int iMacro = strlen ( sMacro );
+	auto iExp = (int) strlen ( sExp );
+	auto iMacro = (int) strlen ( sMacro );
 	int iDelta = iExp-iMacro;
 
 	// calc result length
-	int iRes = strlen ( sTemplate );
+	auto iRes = (int) strlen ( sTemplate );
 	const char * sCur = sTemplate;
 	while ( ( sCur = strstr ( sCur, sMacro ) )!=NULL )
 	{
@@ -3164,7 +3164,7 @@ public:
 
 			// check pair
 			// in first_freq and both_freq modes, 1st token must be listed
-			m_iFirst = strlen ( (const char*)pFirst );
+			m_iFirst = (int) strlen ( (const char*)pFirst );
 			if ( m_eMode!=SPH_BIGRAM_ALL && !IsFreq ( m_iFirst, pFirst ) )
 				return pFirst;
 
@@ -3183,7 +3183,7 @@ public:
 			// got a pair!
 			// check combined length
 			m_pSecond = pSecond;
-			int iSecond = strlen ( (const char*)pSecond );
+			auto iSecond = (int) strlen ( (const char*)pSecond );
 			if ( m_iFirst+iSecond+1 > SPH_MAX_WORD_LEN )
 			{
 				// too long pair
@@ -3397,7 +3397,7 @@ void CSphLowercaser::AddRemaps ( const CSphVector<CSphRemapRange> & dRemaps, DWO
 void CSphLowercaser::AddSpecials ( const char * sSpecials )
 {
 	assert ( sSpecials );
-	int iSpecials = strlen(sSpecials);
+	auto iSpecials = (int) strlen(sSpecials);
 
 	CSphVector<CSphRemapRange> dRemaps;
 	dRemaps.Resize ( iSpecials );
@@ -3580,7 +3580,7 @@ bool sphInitCharsetAliasTable ( CSphString & sError ) // FIXME!!! move alias gen
 		dConcat.Resize(0);
 		while ( iCurAliasChunk<iTotalChunks && globalaliases[iCurAliasChunk] )
 		{
-			int iChunkLen = strlen(globalaliases[iCurAliasChunk]);
+			auto iChunkLen = (int) strlen(globalaliases[iCurAliasChunk]);
 			char * szChunk = dConcat.AddN(iChunkLen);
 			memcpy ( szChunk, globalaliases[iCurAliasChunk], iChunkLen );
 			iCurAliasChunk++;
@@ -5109,7 +5109,7 @@ bool CSphTokenizerBase2::CheckException ( const BYTE * pStart, const BYTE * pCur
 	m_pCur = pMapEnd;
 	m_pTokenStart = pStart;
 	m_pTokenEnd = pMapEnd;
-	m_iLastTokenLen = strlen ( (char*)m_sAccum );
+	m_iLastTokenLen = (int) strlen ( (char*)m_sAccum );
 
 	m_bWasSynonym = true;
 	return true;
@@ -5996,7 +5996,7 @@ void SelectParser_t::AliasLastItem ( YYSTYPE * pAlias )
 
 bool SelectParser_t::IsTokenEqual ( YYSTYPE * pTok, const char * sRef )
 {
-	int iLen = strlen(sRef);
+	auto iLen = (int) strlen(sRef);
 	if ( iLen!=( pTok->m_iEnd - pTok->m_iStart ) )
 		return false;
 	return strncasecmp ( m_pStart + pTok->m_iStart, sRef, iLen )==0;
@@ -7163,7 +7163,7 @@ void CSphWriter::Flush ()
 
 void CSphWriter::PutString ( const char * szString )
 {
-	int iLen = szString ? strlen ( szString ) : 0;
+	int iLen = szString ? (int) strlen ( szString ) : 0;
 	PutDword ( iLen );
 	if ( iLen )
 		PutBytes ( szString, iLen );
@@ -7679,7 +7679,7 @@ bool CSphReader::Tag ( const char * sTag )
 	assert ( sTag && *sTag ); // empty tags are nonsense
 	assert ( strlen(sTag)<64 ); // huge tags are nonsense
 
-	int iLen = strlen(sTag);
+	auto iLen = (int) strlen(sTag);
 	char sBuf[64];
 	GetBytes ( sBuf, iLen );
 	if ( !memcmp ( sBuf, sTag, iLen ) )
@@ -9877,7 +9877,7 @@ inline int encodeVLB ( BYTE * buf, DWORD v )
 
 inline int encodeKeyword ( BYTE * pBuf, const char * pKeyword )
 {
-	int iLen = strlen ( pKeyword ); // OPTIMIZE! remove this and memcpy and check if thats faster
+	auto iLen = (int) strlen ( pKeyword ); // OPTIMIZE! remove this and memcpy and check if thats faster
 	assert ( iLen>0 && iLen<128 ); // so that ReadVLB()
 
 	*pBuf = (BYTE) iLen;
@@ -12519,7 +12519,7 @@ SphWordID_t CSphDictStar::GetWordID ( BYTE * pWord )
 
 	m_pDict->ApplyStemmers ( pWord );
 
-	int iLen = strlen ( (const char*)pWord );
+	auto iLen = (int) strlen ( (const char*)pWord );
 	assert ( iLen < 16+3*SPH_MAX_WORD_LEN - 1 );
 	// stemmer might squeeze out the word
 	if ( iLen && !pWord[0] )
@@ -12557,7 +12557,7 @@ SphWordID_t	CSphDictStarV8::GetWordID ( BYTE * pWord )
 {
 	char sBuf [ 16+3*SPH_MAX_WORD_LEN ];
 
-	int iLen = strlen ( (const char*)pWord );
+	auto iLen = (int) strlen ( (const char*)pWord );
 	iLen = Min ( iLen, 16+3*SPH_MAX_WORD_LEN - 1 );
 
 	if ( !iLen )
@@ -12582,7 +12582,7 @@ SphWordID_t	CSphDictStarV8::GetWordID ( BYTE * pWord )
 			return 0;
 	}
 
-	iLen = strlen ( (const char*)pWord );
+	iLen = (int) strlen ( (const char*)pWord );
 	assert ( iLen < 16+3*SPH_MAX_WORD_LEN - 2 );
 
 	if ( !iLen || ( bHeadStar && iLen==1 ) )
@@ -12658,7 +12658,7 @@ SphWordID_t	CSphDictStarV8::GetWordID ( BYTE * pWord )
 
 SphWordID_t CSphDictExact::GetWordID ( BYTE * pWord )
 {
-	int iLen = strlen ( (const char*)pWord );
+	auto iLen = (int) strlen ( (const char*)pWord );
 	iLen = Min ( iLen, 16+3*SPH_MAX_WORD_LEN - 1 );
 
 	if ( !iLen )
@@ -13572,7 +13572,7 @@ bool DiskIndexQwordSetup_c::Setup ( ISphQword * pWord ) const
 
 	const char * sWord = tWord.m_sDictWord.cstr();
 	const bool bWordDict = pIndex->m_pDict->GetSettings().m_bWordDict;
-	int iWordLen = sWord ? strlen ( sWord ) : 0;
+	int iWordLen = sWord ? (int) strlen ( sWord ) : 0;
 	if ( bWordDict && tWord.m_sWord.Ends("*") )
 	{
 		iWordLen = Max ( iWordLen-1, 0 );
@@ -14072,7 +14072,7 @@ void CSphIndex_VLN::DumpHitlist ( FILE * fp, const char * sKeyword, bool bID )
 	{
 		CSphString sBuf ( sKeyword );
 
-		m_pTokenizer->SetBuffer ( (BYTE*)sBuf.cstr(), strlen ( sBuf.cstr() ) );
+		m_pTokenizer->SetBuffer ( (BYTE*)sBuf.cstr(), (int) strlen ( sBuf.cstr() ) );
 		sTok = m_pTokenizer->GetToken();
 
 		if ( !sTok )
@@ -14965,7 +14965,7 @@ bool CSphIndex_VLN::DoGetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords,
 	tExpCtx.m_bMergeSingles = false;
 	tExpCtx.m_eHitless = m_tSettings.m_eHitless;
 
-	pTokenizer->SetBuffer ( sModifiedQuery, strlen ( (const char *)sModifiedQuery) );
+	pTokenizer->SetBuffer ( sModifiedQuery, (int) strlen ( (const char *)sModifiedQuery) );
 
 	tAotFilter.GetKeywords ( dKeywords, tExpCtx );
 	return true;
@@ -16685,7 +16685,7 @@ int TaggedHash20_t::FromFIPS ( const char * sFIPS )
 	}
 
 	sFIPS += 2 + HASH20_SIZE * 2;
-	auto len = strlen ( sFIPS );
+	auto len = (int) strlen ( sFIPS );
 
 	if ( sFIPS[len - 1]!='\n' )
 		return -1;
@@ -16808,7 +16808,7 @@ static void AddFields ( const char * sQuery, CSphSchema & tSchema )
 	}
 
 	const char * OPTION_RELAXED = "@@relaxed";
-	const int OPTION_RELAXED_LEN = strlen ( OPTION_RELAXED );
+	const auto OPTION_RELAXED_LEN = (int) strlen ( OPTION_RELAXED );
 	if ( strncmp ( sToken, OPTION_RELAXED, OPTION_RELAXED_LEN )==0 && !sphIsAlpha ( sToken[OPTION_RELAXED_LEN] ) )
 		sToken += OPTION_RELAXED_LEN;
 
@@ -17743,7 +17743,7 @@ SphWordID_t CSphDictCRC<CRC32DICT>::GetWordIDWithMarkers ( BYTE * pWord )
 {
 	ApplyStemmers ( pWord + 1 );
 	SphWordID_t uWordId = tHASH::DoCrc ( pWord + 1 );
-	int iLength = strlen ( (const char *)(pWord + 1) );
+	auto iLength = strlen ( (const char *)(pWord + 1) );
 	pWord [iLength + 1] = MAGIC_WORD_TAIL;
 	pWord [iLength + 2] = '\0';
 	return FilterStopword ( uWordId ) ? tHASH::DoCrc ( pWord ) : 0;
@@ -17802,7 +17802,7 @@ SphWordID_t CSphDictTemplate::GetWordIDWithMarkers ( BYTE * pWord )
 	if ( !pWord[1] )
 		return 0;
 	SphWordID_t uWordId = DoCrc ( pWord + 1 );
-	int iLength = strlen ( (const char *)(pWord + 1) );
+	auto iLength = (int) strlen ( (const char *)(pWord + 1) );
 	pWord [iLength + 1] = MAGIC_WORD_TAIL;
 	pWord [iLength + 2] = '\0';
 	return FilterStopword ( uWordId ) ? DoCrc ( pWord ) : 0;
@@ -17837,7 +17837,7 @@ void CSphTemplateDictTraits::LoadStopwords ( const char * sFiles, const ISphToke
 	m_dSWFileInfos.Resize ( 0 );
 
 	TokenizerRefPtr_c tTokenizer ( pTokenizer->Clone ( SPH_CLONE_INDEX ) );
-	CSphFixedVector<char> dList ( 1+strlen(sFiles) );
+	CSphFixedVector<char> dList ( 1+(int)strlen(sFiles) );
 	strcpy ( dList.Begin(), sFiles ); // NOLINT
 
 	char * pCur = dList.Begin();
@@ -18106,7 +18106,7 @@ void CSphTemplateDictTraits::AddWordform ( CSphWordforms * pContainer, char * sB
 			break;
 		}
 
-		if ( GetWordID ( pFrom, strlen ( (const char*)pFrom ), true ) )
+		if ( GetWordID ( pFrom, (int)strlen ( (const char*)pFrom ), true ) )
 			dTokens.Add ( (const char*)pFrom );
 		else
 			bStopwordsPresent = true;
@@ -18139,7 +18139,7 @@ void CSphTemplateDictTraits::AddWordform ( CSphWordforms * pContainer, char * sB
 	}
 
 	CSphVector<CSphNormalForm> dDestTokens;
-	bool bFirstDestIsStop = !GetWordID ( pTo, strlen ( (const char*)pTo ), true );
+	bool bFirstDestIsStop = !GetWordID ( pTo, (int) strlen ( (const char*)pTo ), true );
 	CSphNormalForm & tForm = dDestTokens.Add();
 	tForm.m_sForm = (const char *)pTo;
 	tForm.m_iLengthCP = pTokenizer->GetLastTokenLen();
@@ -18148,7 +18148,7 @@ void CSphTemplateDictTraits::AddWordform ( CSphWordforms * pContainer, char * sB
 	const BYTE * pDestToken;
 	while ( ( pDestToken = pTokenizer->GetToken() )!=NULL )
 	{
-		bool bStop = ( !GetWordID ( pDestToken, strlen ( (const char*)pDestToken ), true ) );
+		bool bStop = ( !GetWordID ( pDestToken, (int) strlen ( (const char*)pDestToken ), true ) );
 		if ( !bStop )
 		{
 			CSphNormalForm & tNewForm = dDestTokens.Add();
@@ -18612,7 +18612,7 @@ bool CSphTemplateDictTraits::StemById ( BYTE * pWord, int iStemmer ) const
 			sb_stemmer * pStemmer = m_dStemmers [iStemmer - SPH_MORPH_LIBSTEMMER_FIRST];
 			assert ( pStemmer );
 
-			const sb_symbol * sStemmed = sb_stemmer_stem ( pStemmer, (sb_symbol*)pWord, strlen ( (const char*)pWord ) );
+			const sb_symbol * sStemmed = sb_stemmer_stem ( pStemmer, (sb_symbol*)pWord, (int) strlen ( (const char*)pWord ) );
 			int iLen = sb_stemmer_length ( pStemmer );
 
 			memcpy ( pWord, sStemmed, iLen );
@@ -19191,12 +19191,12 @@ void InfixBuilder_c<SIZE>::SaveEntries ( CSphWriter & wrDict )
 		InfixIntvec_t & dData = m_dArena[dIndex[iIndex]].m_tValue;
 		const BYTE * sKey = (const BYTE*) m_dArena[dIndex[iIndex]].m_tKey.m_Data;
 		int iChars = ( SIZE==2 )
-			? strnlen ( (const char*)sKey, sizeof(DWORD)*SIZE )
-			: sphUTF8Len ( (const char*)sKey, sizeof(DWORD)*SIZE );
+			? (int) strnlen ( (const char*)sKey, sizeof(DWORD)*SIZE )
+			: sphUTF8Len ( (const char*)sKey, (int) sizeof(DWORD)*SIZE );
 		assert ( iChars>=2 && iChars<int(1 + sizeof ( Infix_t<SIZE> ) ) );
 
 		// keep track of N-infix blocks
-		int iAppendBytes = strnlen ( (const char*)sKey, sizeof(DWORD)*SIZE );
+		auto iAppendBytes = (int) strnlen ( (const char*)sKey, sizeof(DWORD)*SIZE );
 		if ( !iBlock )
 		{
 			int iOff = m_dBlocksWords.GetLength();
@@ -19321,8 +19321,8 @@ int64_t InfixBuilder_c<SIZE>::SaveEntryBlocks ( CSphWriter & wrDict )
 	wrDict.ZipInt ( m_dBlocks.GetLength() );
 	ARRAY_FOREACH ( i, m_dBlocks )
 	{
-		int iBytes = strlen ( m_dBlocks[i].m_sInfix );
-		wrDict.PutByte ( iBytes );
+		auto iBytes = strlen ( m_dBlocks[i].m_sInfix );
+		wrDict.PutByte ( BYTE(iBytes) );
 		wrDict.PutBytes ( m_dBlocks[i].m_sInfix, iBytes );
 		wrDict.ZipInt ( m_dBlocks[i].m_iOffset ); // maybe delta these on top?
 	}
@@ -19839,7 +19839,7 @@ bool CSphDictKeywords::DictEnd ( DictHeader_t * pHeader, int iMemLimit, CSphStri
 	while ( qWords.GetLength() )
 	{
 		const DictKeywordTagged_t & tWord = qWords.Root();
-		const int iLen = strlen ( tWord.m_sKeyword ); // OPTIMIZE?
+		auto iLen = (const int) strlen ( tWord.m_sKeyword ); // OPTIMIZE?
 
 		// store checkpoints as needed
 		if ( ( iWords % SPH_WORDLIST_CHECKPOINT )==0 )
@@ -19915,7 +19915,7 @@ bool CSphDictKeywords::DictEnd ( DictHeader_t * pHeader, int iMemLimit, CSphStri
 
 	ARRAY_FOREACH ( i, m_dCheckpoints )
 	{
-		const int iLen = strlen ( m_dCheckpoints[i].m_sWord );
+		auto iLen = (const int) strlen ( m_dCheckpoints[i].m_sWord );
 
 		assert ( m_dCheckpoints[i].m_iWordlistOffset>0 );
 		assert ( iLen>0 && iLen<MAX_KEYWORD_BYTES );
@@ -19996,7 +19996,7 @@ void CSphDictKeywords::DictFlush ()
 	ARRAY_FOREACH ( i, dWords )
 	{
 		const DictKeyword_t * pWord = dWords[i];
-		int iLen = strlen ( pWord->m_sKeyword );
+		auto iLen = (int) strlen ( pWord->m_sKeyword );
 		m_wrTmpDict.PutByte ( iLen );
 		m_wrTmpDict.PutBytes ( pWord->m_sKeyword, iLen );
 		m_wrTmpDict.ZipOffset ( pWord->m_uOff );
@@ -20038,7 +20038,7 @@ void CSphDictKeywords::DictEntry ( const CSphDictEntry & tEntry )
 	assert ( m_iSkiplistBlockSize>0 );
 
 	DictKeyword_t * pWord = NULL;
-	int iLen = strlen ( (char*)tEntry.m_sKeyword ) + 1;
+	auto iLen = (int) strlen ( (char*)tEntry.m_sKeyword ) + 1;
 
 	while (true)
 	{
@@ -20095,7 +20095,7 @@ SphWordID_t CSphDictKeywords::GetWordID ( BYTE * pWord )
 	if ( !uCRC || !m_bHitblock )
 		return uCRC;
 
-	int iLen = strlen ( (const char *)pWord );
+	auto iLen = (int) strlen ( (const char *)pWord );
 	return HitblockGetID ( (const char *)pWord, iLen, uCRC );
 }
 
@@ -20105,7 +20105,7 @@ SphWordID_t CSphDictKeywords::GetWordIDWithMarkers ( BYTE * pWord )
 	if ( !uCRC || !m_bHitblock )
 		return uCRC;
 
-	int iLen = strlen ( (const char *)pWord );
+	auto iLen = (int) strlen ( (const char *)pWord );
 	return HitblockGetID ( (const char *)pWord, iLen, uCRC );
 }
 
@@ -20115,7 +20115,7 @@ SphWordID_t CSphDictKeywords::GetWordIDNonStemmed ( BYTE * pWord )
 	if ( !uCRC || !m_bHitblock )
 		return uCRC;
 
-	int iLen = strlen ( (const char *)pWord );
+	auto iLen = (int) strlen ( (const char *)pWord );
 	return HitblockGetID ( (const char *)pWord, iLen, uCRC );
 }
 
@@ -20384,7 +20384,7 @@ public:
 private:
 	SphWordID_t AddKeyword ( const BYTE * pWord )
 	{
-		int iLen = strlen ( ( const char * ) pWord );
+		auto iLen = (int) strlen ( ( const char * ) pWord );
 		// stemmer might squeeze out the word
 		if ( !iLen )
 			return 0;
@@ -20555,7 +20555,7 @@ CSphHTMLStripper::CSphHTMLStripper ( bool bDefaultTags )
 		ARRAY_FOREACH ( i, m_dTags )
 		{
 			m_dTags[i].m_sTag = dKnown[i];
-			m_dTags[i].m_iTagLen = strlen ( dKnown[i] );
+			m_dTags[i].m_iTagLen = (int) strlen ( dKnown[i] );
 			m_dTags[i].m_bInline = true;
 		}
 	}
@@ -20639,7 +20639,7 @@ bool CSphHTMLStripper::SetIndexedAttrs ( const char * sConfig, CSphString & sErr
 		{
 			m_dTags.Add();
 			m_dTags.Last().m_sTag = sTag;
-			m_dTags.Last().m_iTagLen = strlen ( sTag );
+			m_dTags.Last().m_iTagLen = (int) strlen ( sTag );
 			iIndexTag = m_dTags.GetLength()-1;
 		}
 
@@ -20722,7 +20722,7 @@ bool CSphHTMLStripper::SetRemovedElements ( const char * sConfig, CSphString & )
 		{
 			m_dTags.Add();
 			m_dTags.Last().m_sTag = sTag;
-			m_dTags.Last().m_iTagLen = strlen ( sTag.cstr() );
+			m_dTags.Last().m_iTagLen = (int) strlen ( sTag.cstr() );
 			m_dTags.Last().m_bRemove = true;
 		}
 	}
@@ -20758,7 +20758,7 @@ void CSphHTMLStripper::EnableParagraphs ()
 		{
 			StripperTag_t& dTag = m_dTags.Add();
 			dTag.m_sTag = sTag;
-			dTag.m_iTagLen = strlen(sTag);
+			dTag.m_iTagLen = (int) strlen(sTag);
 			dTag.m_bPara = true;
 		}
 	}
@@ -21534,7 +21534,7 @@ void CSphHTMLStripper::Strip ( BYTE * sData ) const
 					{
 						for ( iAttr=0; iAttr<pTag->m_dAttrs.GetLength(); iAttr++ )
 						{
-							int iLen = strlen ( pTag->m_dAttrs[iAttr].cstr() );
+							auto iLen = (int) strlen ( pTag->m_dAttrs[iAttr].cstr() );
 							if ( iLen==iAttrLen && !strncasecmp ( pTag->m_dAttrs[iAttr].cstr(), (const char*)sAttr, iLen ) )
 								break;
 						}
@@ -21875,7 +21875,7 @@ int CSphFieldRegExps::Apply ( const BYTE * sField, int iLength, CSphVector<BYTE>
 	if ( !bReplaced )
 		return 0;
 
-	int iDstLen = sRe2.length();
+	auto iDstLen = (int) sRe2.length();
 	dStorage.Resize ( iDstLen+4 ); // string SAFETY_GAP
 	strncpy ( (char *)dStorage.Begin(), sRe2.c_str(), dStorage.GetLength() );
 	return iDstLen;
@@ -22137,7 +22137,7 @@ static void FormatEscaped ( FILE * fp, const char * sLine )
 	}
 
 	// pass one, count the needed buffer size
-	int iLen = strlen(sLine);
+	auto iLen = (int) strlen(sLine);
 	int iOut = 0;
 	for ( int i=0; i<iLen; i++ )
 		switch ( sLine[i] )
@@ -22614,7 +22614,7 @@ void CSphSource_Document::BuildSubstringHits ( RowID_t tRowID, bool bPayload, ES
 		int iLen = m_pTokenizer->GetLastTokenLen ();
 
 		// always index full word (with magic head/tail marker(s))
-		int iBytes = strlen ( (const char*)sWord );
+		auto iBytes = (int) strlen ( (const char*)sWord );
 		memcpy ( sBuf + 1, sWord, iBytes );
 		sBuf[iBytes+1] = '\0';
 
@@ -22642,7 +22642,7 @@ void CSphSource_Document::BuildSubstringHits ( RowID_t tRowID, bool bPayload, ES
 		m_tState.m_iBuildLastStep = m_pTokenizer->TokenIsBlended() ? 0 : 1;
 
 		// restore stemmed word
-		int iStemmedLen = strlen ( ( const char *)sBuf );
+		auto iStemmedLen = (int) strlen ( ( const char *)sBuf );
 		sBuf [iStemmedLen - 1] = '\0';
 
 		// stemmed word w/o markers
@@ -22761,7 +22761,7 @@ void CSphSource_Document::BuildRegularHits ( RowID_t tRowID, bool bPayload, bool
 
 		if ( bGlobalPartialMatch )
 		{
-			int iBytes = strlen ( (const char*)sWord );
+			auto iBytes = strlen ( (const char*)sWord );
 			memcpy ( sBuf + 1, sWord, iBytes );
 			sBuf[0] = MAGIC_WORD_HEAD;
 			sBuf[iBytes+1] = '\0';
@@ -22771,7 +22771,7 @@ void CSphSource_Document::BuildRegularHits ( RowID_t tRowID, bool bPayload, bool
 		ESphTokenMorph eMorph = m_pTokenizer->GetTokenMorph();
 		if ( m_bIndexExactWords && eMorph!=SPH_TOKEN_MORPH_GUESS )
 		{
-			int iBytes = strlen ( (const char*)sWord );
+			auto iBytes = strlen ( (const char*)sWord );
 			memcpy ( sBuf + 1, sWord, iBytes );
 			sBuf[0] = MAGIC_WORD_HEAD_NONSTEMMED;
 			sBuf[iBytes+1] = '\0';
@@ -23035,7 +23035,7 @@ const char * SubstituteParams ( const char * sQuery, const char * const * dMacro
 {
 	// OPTIMIZE? things can be precalculated
 	const char * sCur = sQuery;
-	int iLen = 0;
+	size_t iLen = 0;
 	while ( *sCur )
 	{
 		if ( *sCur=='$' )
@@ -23081,7 +23081,7 @@ const char * SubstituteParams ( const char * sQuery, const char * const * dMacro
 		*sDst++ = *sCur++;
 	}
 	*sDst++ = '\0';
-	assert ( sDst-sRes==iLen );
+	assert ( sDst-sRes==(int) iLen );
 	return sRes;
 }
 
@@ -25192,8 +25192,8 @@ const char * CSphSource_XMLPipe2::DecorateMessageVA ( const char * sTemplate, va
 	static char sBuf[1024];
 
 	snprintf ( sBuf, sizeof(sBuf), "source '%s': ", m_tSchema.GetName() );
-	int iBufLen = strlen ( sBuf );
-	int iLeft = sizeof(sBuf) - iBufLen;
+	auto iBufLen = strlen ( sBuf );
+	auto iLeft = sizeof(sBuf) - iBufLen;
 	char * szBufStart = sBuf + iBufLen;
 
 	vsnprintf ( szBufStart, iLeft, sTemplate, ap );
@@ -25318,7 +25318,7 @@ bool CSphSource_XMLPipe2::Connect ( CSphString & sError )
 
 	m_sError = "";
 
-	int iBytesRead = fread ( m_pBuffer, 1, m_iBufferSize, m_pPipe );
+	auto iBytesRead = (int) fread ( m_pBuffer, 1, m_iBufferSize, m_pPipe );
 
 	if ( !ParseNextChunk ( iBytesRead, sError ) )
 		return false;
@@ -25470,7 +25470,7 @@ BYTE **	CSphSource_XMLPipe2::NextDocument ( bool & bEOF, CSphString & sError )
 			memmove ( m_pBuffer, m_pBuffer+m_iReparseStart, m_iReparseLen );
 
 		// read more data
-		iReadResult = fread ( m_pBuffer+m_iReparseLen, 1, m_iBufferSize-m_iReparseLen, m_pPipe );
+		iReadResult = (int) fread ( m_pBuffer+m_iReparseLen, 1, m_iBufferSize-m_iReparseLen, m_pPipe );
 		if ( iReadResult==0 )
 			break;
 
@@ -25604,7 +25604,7 @@ static EXMLElem LookupElement ( const char * szName )
 	if ( szName[0]!='s' )
 		return ELEM_NONE;
 
-	int iLen = strlen(szName);
+	auto iLen = strlen(szName);
 	if ( iLen>=11 && iLen<=15 )
 	{
 		char iHash = (char)( ( iLen + szName[7] ) & 15 );
@@ -26171,7 +26171,7 @@ bool CSphSource_ODBC::SqlQuery ( const char * sQuery )
 		if ( m_hColBuffers ( tCol.m_sName ) )
 			iBuffLen = m_hColBuffers [ tCol.m_sName ]; // got explicit user override
 		else if ( uColSize )
-			iBuffLen = Min ( uColSize+1, (SQLULEN) MAX_COL_SIZE ); // got data from driver
+			iBuffLen = (int) Min ( uColSize+1, (SQLULEN) MAX_COL_SIZE ); // got data from driver
 
 		tCol.m_dContents.Resize ( iBuffLen + MS_SQL_BUFFER_GAP );
 		tCol.m_dRaw.Resize ( iBuffLen + MS_SQL_BUFFER_GAP );
@@ -26309,7 +26309,7 @@ bool CSphSource_ODBC::SqlFetchRow ()
 					// WideCharToMultiByte should get NULL terminated string
 					memset ( tCol.m_dRaw.Begin()+tCol.m_iBufferSize, 0, MS_SQL_BUFFER_GAP );
 
-					int iConv = WideCharToMultiByte ( CP_UTF8, 0, LPCWSTR ( tCol.m_dRaw.Begin() ), tCol.m_iInd/sizeof(WCHAR),
+					int iConv = WideCharToMultiByte ( CP_UTF8, 0, LPCWSTR ( tCol.m_dRaw.Begin() ), (int) tCol.m_iInd/sizeof(WCHAR),
 						LPSTR ( tCol.m_dContents.Begin() ), tCol.m_iBufferSize-1, NULL, NULL );
 
 					if ( iConv==0 )
@@ -26808,7 +26808,7 @@ bool CSphSource_BaseSV::IterateStart ( CSphString & sError )
 	m_iDataStart = 0;
 
 	// initial buffer update
-	m_iBufUsed = fread ( m_dBuf.Begin(), 1, m_dBuf.GetLength(), m_pFP );
+	m_iBufUsed = (int) fread ( m_dBuf.Begin(), 1, m_dBuf.GetLength(), m_pFP );
 	if ( !m_iBufUsed )
 	{
 		sError.SetSprintf ( "source '%s': read error '%s'", m_tSchema.GetName(), strerrorm(errno) );
@@ -26860,7 +26860,7 @@ BYTE **	CSphSource_BaseSV::NextDocument ( bool & bEOF, CSphString & sError )
 		if ( tRemap.m_iField!=-1 )
 		{
 			m_dFields[tRemap.m_iField] = m_dBuf.Begin() + iOff;
-			m_dFieldLengths[tRemap.m_iField] = strlen ( (char *)m_dFields[tRemap.m_iField] );
+			m_dFieldLengths[tRemap.m_iField] = (int) strlen ( (char *)m_dFields[tRemap.m_iField] );
 		}
 
 		// attribute column
@@ -26978,7 +26978,7 @@ CSphSource_BaseSV::ESphParseResult CSphSource_TSV::SplitColumns ( CSphString & s
 		}
 
 		// do read
-		int iGot = fread ( m_dBuf.Begin() + m_iBufUsed, 1, m_dBuf.GetLength() - m_iBufUsed, m_pFP );
+		auto iGot = (int) fread ( m_dBuf.Begin() + m_iBufUsed, 1, m_dBuf.GetLength() - m_iBufUsed, m_pFP );
 		if ( !iGot )
 		{
 			if ( !iCol )
@@ -27193,7 +27193,7 @@ CSphSource_BaseSV::ESphParseResult CSphSource_CSV::SplitColumns ( CSphString & s
 		}
 
 		// do read
-		int iGot = fread ( m_dBuf.Begin() + m_iBufUsed, 1, m_dBuf.GetLength() - m_iBufUsed, m_pFP );
+		auto iGot = (int) fread ( m_dBuf.Begin() + m_iBufUsed, 1, m_dBuf.GetLength() - m_iBufUsed, m_pFP );
 		if ( !iGot )
 		{
 			if ( !iCol )
@@ -27341,7 +27341,7 @@ uint64_t sphCalcLocatorHash ( const CSphAttrLocator & tLoc, uint64_t uPrevHash )
 
 uint64_t sphCalcExprDepHash ( const char * szTag, ISphExpr * pExpr, const ISphSchema & tSorterSchema, uint64_t uPrevHash, bool & bDisable )
 {
-	uint64_t uHash = sphFNV64 ( szTag, strlen(szTag), uPrevHash );
+	uint64_t uHash = sphFNV64 ( szTag, (int) strlen(szTag), uPrevHash );
 	return sphCalcExprDepHash ( pExpr, tSorterSchema, uHash, bDisable );
 }
 
@@ -27773,7 +27773,7 @@ int DecodeUtf8 ( const BYTE * sWord, int * pBuf )
 bool SuggestResult_t::SetWord ( const char * sWord, const ISphTokenizer * pTok, bool bUseLastWord )
 {
 	TokenizerRefPtr_c pTokenizer ( pTok->Clone ( SPH_CLONE_QUERY_LIGHTWEIGHT ) );
-	pTokenizer->SetBuffer ( (BYTE *)sWord, strlen ( sWord ) );
+	pTokenizer->SetBuffer ( (BYTE *)sWord, (int) strlen ( sWord ) );
 
 	const BYTE * pToken = pTokenizer->GetToken();
 	for ( ; pToken!=NULL; )
@@ -27823,7 +27823,7 @@ static void SuggestGetChekpoints ( const ISphWordlistSuggest * pWordlist, int iI
 	const char * sTrigramEnd = sTrigram + dTrigrams.GetLength();
 	while (true)
 	{
-		int iTrigramLen = strlen ( sTrigram );
+		auto iTrigramLen = (int) strlen ( sTrigram );
 		int iInfixLen = sphGetInfixLength ( sTrigram, iTrigramLen, iInfixCodepointBytes );
 
 		// count how many checkpoint we will get

+ 1 - 1
src/sphinx.h

@@ -1752,7 +1752,7 @@ public:
 	virtual	int					Apply ( const BYTE * sField, int iLength, CSphVector<BYTE> & dStorage, bool bQuery ) = 0;
 	int							Apply ( const void* szField, CSphVector<BYTE>& dStorage, bool bQuery )
 	{
-		return Apply ( (const BYTE*)szField, strlen ( (const char*)szField ), dStorage, bQuery );
+		return Apply ( (const BYTE*)szField, (int) strlen ( (const char*)szField ), dStorage, bQuery );
 	}
 
 	int Apply ( ByteBlob_t sField, CSphVector<BYTE>& dStorage, bool bQuery )

+ 2 - 2
src/sphinxexcerpt.cpp

@@ -720,7 +720,7 @@ void StringSourceTraits_c::PrepareText ( const VecTraits_T<BYTE> & dSourceText,
 		if ( dDestText.GetLength() )
 		{
 			pStripper->Strip ( dDestText.Begin() );
-			dDestText.Resize ( strlen ( (const char*)dDestText.Begin() ) );
+			dDestText.Resize ( (int) strlen ( (const char*)dDestText.Begin() ) );
 		}
 	}
 }
@@ -1281,7 +1281,7 @@ bool SnippetBuilder_c::SetQuery ( const CSphString & sQuery, bool bIgnoreFields,
 	const BYTE * szModifiedQuery = (BYTE *)sQuery.cstr();
 	if ( m_pFieldFilter && szModifiedQuery )
 	{
-		if ( m_pFieldFilter->Apply ( szModifiedQuery, strlen ( (char*)szModifiedQuery ), dFiltered, true ) )
+		if ( m_pFieldFilter->Apply ( szModifiedQuery, (int) strlen ( (char*)szModifiedQuery ), dFiltered, true ) )
 			szModifiedQuery = dFiltered.Begin();
 	}
 

+ 2 - 2
src/sphinxexpr.cpp

@@ -1225,7 +1225,7 @@ public:
 			{
 				for ( ; iArg < dEvaluated.GetLength() && dEvaluated[iArg]; iArg++ )
 				{
-					int iLen = strlen ( (const char *)dEvaluated[iArg] );
+					auto iLen = (int) strlen ( (const char *)dEvaluated[iArg] );
 					memcpy ( tArg.m_dBuffer.AddN (iLen), dEvaluated[iArg], iLen );
 				}
 			}
@@ -4915,7 +4915,7 @@ public:
 		auto pFn = (UdfCharptr_fn) m_pCall->m_pUdf->m_fnFunc;
 		char * pRes = pFn ( &m_pCall->m_tInit, &m_pCall->m_tArgs, &m_bError ); // owned now!
 		*ppStr = (const BYTE*) pRes;
-		int iLen = ( pRes ? strlen(pRes) : 0 );
+		int iLen = ( pRes ?(int) strlen(pRes) : 0 );
 		FreeArgs();
 		return iLen;
 	}

+ 3 - 3
src/sphinxint.h

@@ -513,7 +513,7 @@ public:
 	{
 		int iLen = 0;
 		if ( sVal )
-			iLen = strlen ( sVal );
+			iLen = (int) strlen ( sVal );
 		PutDword ( iLen );
 		if ( iLen )
 			PutBytes ( (const BYTE *)sVal, iLen );
@@ -1793,7 +1793,7 @@ template <typename CP>
 int sphCheckpointCmp ( const char * sWord, int iLen, SphWordID_t iWordID, bool bWordDict, const CP & tCP )
 {
 	if ( bWordDict )
-		return sphDictCmp ( sWord, iLen, tCP.m_sWord, strlen ( tCP.m_sWord ) );
+		return sphDictCmp ( sWord, iLen, tCP.m_sWord, (int) strlen ( tCP.m_sWord ) );
 
 	int iRes = 0;
 	iRes = iWordID<tCP.m_uWordID ? -1 : iRes;
@@ -1805,7 +1805,7 @@ template <typename CP>
 int sphCheckpointCmpStrictly ( const char * sWord, int iLen, SphWordID_t iWordID, bool bWordDict, const CP & tCP )
 {
 	if ( bWordDict )
-		return sphDictCmpStrictly ( sWord, iLen, tCP.m_sWord, strlen ( tCP.m_sWord ) );
+		return sphDictCmpStrictly ( sWord, iLen, tCP.m_sWord, (int) strlen ( tCP.m_sWord ) );
 
 	int iRes = 0;
 	iRes = iWordID<tCP.m_uWordID ? -1 : iRes;

+ 11 - 11
src/sphinxjson.cpp

@@ -240,7 +240,7 @@ public:
 
 	inline void PackStr ( const char * s )
 	{
-		PackStr ( s, strlen(s));
+		PackStr ( s, (int) strlen(s));
 	}
 
 	void PackInt ( DWORD v )
@@ -725,7 +725,7 @@ bool sphJsonParse ( CSphVector<BYTE> & dData, char * sData, bool bAutoconv, bool
 
 bool sphJsonParse ( CSphVector<BYTE> &dData, char * sData, bool bAutoconv, bool bToLowercase, bool bCheckSize, StringBuilder_c &sMsg )
 {
-	int iLen = strlen ( sData );
+	auto iLen = (int) strlen ( sData );
 	if ( sData[iLen+1]!=0 )
 	{
 		sMsg << "internal error: input data passed to sphJsonParse() must be terminated with a double zero";
@@ -774,7 +774,7 @@ DWORD sphJsonKeyMask ( const char * sKey, int iLen )
 
 static inline DWORD KeyMask ( const char * s )
 {
-	return sphJsonKeyMask ( s, strlen ( s ) );
+	return sphJsonKeyMask ( s, (int) strlen ( s ) );
 }
 
 // returns -1 if size is unreachable (for remote agents)
@@ -2241,7 +2241,7 @@ bool Bson_c::StrEq ( const char * sValue ) const
 		return false;
 	const BYTE * p = m_dData.first;
 	int iStrLen = sphJsonUnpackInt ( &p );
-	int iLen = strlen ( sValue );
+	auto iLen = (int) strlen ( sValue );
 	if ( iStrLen==iLen && !memcmp ( p, sValue, iStrLen ) )
 		return true;
 	return false;
@@ -2257,7 +2257,7 @@ NodeHandle_t Bson_c::ChildByName ( const char * sName ) const
 	if ( m_dData.second==JSON_OBJECT )
 		sphJsonUnpackInt ( &p );
 
-	int iLen = strlen ( sName );
+	auto iLen = (int) strlen ( sName );
 
 	// fast reject by bloom filter
 	auto uMask = sphJsonKeyMask ( sName, iLen );
@@ -2431,7 +2431,7 @@ bool Bson_c::HasAnyOf ( int iNames, ... ) const
 	bool bMayBe = false;
 	for ( const char * sName : dNames )
 	{
-		int iLen = strlen ( sName );
+		auto iLen = (int) strlen ( sName );
 		auto uMask = sphJsonKeyMask ( sName, iLen );
 		bMayBe |= ( ( uNodeMask & uMask )==uMask );
 		if ( bMayBe )
@@ -2450,7 +2450,7 @@ bool Bson_c::HasAnyOf ( int iNames, ... ) const
 		int iStrLen = sphJsonUnpackInt ( &p );
 		for ( const char * sName : dNames )
 		{
-			int iLen = strlen ( sName );
+			auto iLen = (int) strlen ( sName );
 			if ( iStrLen==iLen && !memcmp ( p, sName, iStrLen ) )
 				return true;
 		}
@@ -2736,7 +2736,7 @@ public:
 		if ( m_bAutoconv && eOrigType==JSON_STRING )
 		{
 			int64_t iFoo;
-			if ( !sphJsonStringToNumber ( pNode->valuestring, strlen ( pNode->valuestring ), eOrigType, iFoo, pNode->valuedouble ) )
+			if ( !sphJsonStringToNumber ( pNode->valuestring, (int) strlen ( pNode->valuestring ), eOrigType, iFoo, pNode->valuedouble ) )
 				return eOrigType;
 			pNode->valueint = iFoo;
 		}
@@ -2817,7 +2817,7 @@ public:
 			{
 				cJSON_ArrayForEach( pNode, pCJSON )
 				{
-					int iLen = strlen ( pNode->string );
+					auto iLen = (int) strlen ( pNode->string );
 					for ( auto i = 0; i<iLen; ++i )
 						pNode->string[i] = Mytolower ( pNode->string[i] );
 					uMask |= KeyMask ( pNode->string );
@@ -2889,7 +2889,7 @@ public:
 		{
 			cJSON_ArrayForEach( pNode, pCJSON )
 			{
-				int iLen = strlen ( pNode->string );
+				auto iLen = (int) strlen ( pNode->string );
 				for ( auto i = 0; i<iLen; ++i )
 					pNode->string[i] = Mytolower ( pNode->string[i] );
 				uMask |= KeyMask ( pNode->string );
@@ -2936,7 +2936,7 @@ BsonContainer_c::BsonContainer_c ( char * sJson, bool bAutoconv, bool bToLowerca
 BsonContainer2_c::BsonContainer2_c ( const char * sJson, bool bAutoconv, bool bToLowercase )
 {
 	auto pCjson = cJSON_Parse ( sJson );
-	m_Bson.Reserve ( strlen ( sJson ) );
+	m_Bson.Reserve ( (int) strlen ( sJson ) );
 	bson::cJsonToBson ( pCjson, m_Bson, bAutoconv, bToLowercase/*, m_sError*/ );
 	if ( pCjson )
 		cJSON_Delete ( pCjson );

+ 3 - 3
src/sphinxjsonquery.cpp

@@ -79,7 +79,7 @@ QueryTreeBuilder_c::QueryTreeBuilder_c ( const CSphQuery * pQuery, const ISphTok
 
 void QueryTreeBuilder_c::CollectKeywords ( const char * szStr, XQNode_t * pNode, const XQLimitSpec_t & tLimitSpec )
 {
-	m_pTokenizer->SetBuffer ( (const BYTE*)szStr, strlen ( szStr ) );
+	m_pTokenizer->SetBuffer ( (const BYTE*)szStr, (int) strlen ( szStr ) );
 
 	while (true)
 	{
@@ -168,7 +168,7 @@ bool QueryTreeBuilder_c::HandleSpecialFields ( const char * & pPtr, FieldMask_t
 {
 	if ( *pPtr=='_' )
 	{
-		int iLen = strlen(g_szAll);
+		auto iLen = (int) strlen(g_szAll);
 		if ( !strncmp ( pPtr, g_szAll, iLen ) )
 		{
 			pPtr += iLen;
@@ -1535,7 +1535,7 @@ static bool ParseJsonUpdate ( const JsonObj_c & tRoot, SqlStmt_t & tStmt, DocID_
 				szValue = sEncoded.cstr();
 			}
 
-			int iLength = strlen ( szValue );
+			auto iLength = (int) strlen ( szValue );
 			tUpd.m_dPool.Add ( tUpd.m_dBlobs.GetLength() );
 			tUpd.m_dPool.Add ( iLength );
 

+ 2 - 2
src/sphinxmetaphone.cpp

@@ -589,7 +589,7 @@ void stem_dmetaphone ( BYTE * pWord )
 	BYTE	sOriginal [3*SPH_MAX_WORD_LEN+3+EXTRA_RESERVE];
 	BYTE	sPrimary [3*SPH_MAX_WORD_LEN+3];
 	BYTE	sSecondary [ 3*SPH_MAX_WORD_LEN+3 ];
-	int		iLength = strlen ( (const char *)pWord );
+	auto	iLength = (int) strlen ( (const char *)pWord );
 	memcpy ( sOriginal, pWord, iLength + 1 );
 	sPrimary[0] = '\0';
 	sSecondary[0] = '\0';
@@ -610,7 +610,7 @@ void stem_dmetaphone ( BYTE * pWord )
 	CurrentWord_t Word;
 	Word.pWord = sOriginal;
 	Word.iLength = iLength;
-	Word.iLengthPadded = strlen ( (const char *)sOriginal );
+	Word.iLengthPadded = (int) strlen ( (const char *)sOriginal );
 
 	// skip these when at start of word
 	if ( StrAt ( Word, 0, 2, "GN", "KN", "PN", "WR", "PS" ) )

+ 3 - 3
src/sphinxpq.cpp

@@ -399,7 +399,7 @@ static void QueryGetTerms ( const XQNode_t * pNode, CSphDict * pDict, DictMap_t
 		if ( !uWord )
 			continue;
 
-		iLen = strnlen ( (const char *)sTmp, sizeof(sTmp) );
+		iLen = (int) strnlen ( (const char *)sTmp, sizeof(sTmp) );
 		DictTerm_t & tTerm = hDict.m_hTerms.Acquire ( uHash );
 		tTerm.m_uWordID = uWord;
 		tTerm.m_iWordOff = hDict.m_dKeywords.GetLength();
@@ -602,7 +602,7 @@ static Slice_t GetPrefixLocator ( const char * sWord, bool bHasMorphology, const
 		if ( pCheckpoint )
 		{
 			// there could be valid data prior 1st checkpoint that should be unpacked and checked
-			int iNameLen = strnlen ( pCheckpoint->m_sWord, SPH_MAX_KEYWORD_LEN );
+			auto iNameLen = (int) strnlen ( pCheckpoint->m_sWord, SPH_MAX_KEYWORD_LEN );
 			if ( pCheckpoint!=pSeg->m_dWordCheckpoints.Begin() || (sphDictCmp ( sPrefix, iPrefix, pCheckpoint->m_sWord, iNameLen )==0 && iPrefix==iNameLen) )
 				tChPoint.m_uOff = pCheckpoint->m_iOffset;
 
@@ -610,7 +610,7 @@ static Slice_t GetPrefixLocator ( const char * sWord, bool bHasMorphology, const
 			pCheckpoint++;
 			while ( pCheckpoint<=pLast )
 			{
-				iNameLen = strnlen ( pCheckpoint->m_sWord, SPH_MAX_KEYWORD_LEN );
+				iNameLen = (int) strnlen ( pCheckpoint->m_sWord, SPH_MAX_KEYWORD_LEN );
 				int iCmp = sphDictCmp ( sPrefix, iPrefix, pCheckpoint->m_sWord, iNameLen );
 				if ( iCmp==0 && iPrefix==iNameLen )
 					tChPoint.m_uOff = pCheckpoint->m_iOffset;

+ 5 - 5
src/sphinxquery.cpp

@@ -34,7 +34,7 @@ class XQParser_t;
 void XQParseHelper_c::SetString ( const char * szString )
 {
 	assert ( m_pTokenizer );
-	m_pTokenizer->SetBuffer ( (const BYTE*)szString, strlen(szString) );
+	m_pTokenizer->SetBuffer ( (const BYTE*)szString, (int) strlen(szString) );
 	m_iAtomPos = 0;
 }
 
@@ -233,7 +233,7 @@ bool XQParseHelper_c::Error ( const char * sTemplate, ... )
 	char sBuf[256];
 
 	const char * sPrefix = "query error: ";
-	int iPrefix = strlen(sPrefix);
+	auto iPrefix = strlen(sPrefix);
 	memcpy ( sBuf, sPrefix, iPrefix );
 
 	va_list ap;
@@ -253,7 +253,7 @@ void XQParseHelper_c::Warning ( const char * sTemplate, ... )
 	char sBuf[256];
 
 	const char * sPrefix = "query warning: ";
-	int iPrefix = strlen(sPrefix);
+	auto iPrefix = strlen(sPrefix);
 	memcpy ( sBuf, sPrefix, iPrefix );
 
 	va_list ap;
@@ -1721,7 +1721,7 @@ bool XQParser_t::Parse ( XQQuery_t & tParsed, const char * sQuery, const CSphQue
 
 	// check for relaxed syntax
 	const char * OPTION_RELAXED = "@@relaxed";
-	const int OPTION_RELAXED_LEN = strlen ( OPTION_RELAXED );
+	auto OPTION_RELAXED_LEN = (const int) strlen ( OPTION_RELAXED );
 
 	m_bStopOnInvalid = true;
 	if ( sQuery && strncmp ( sQuery, OPTION_RELAXED, OPTION_RELAXED_LEN )==0 && !sphIsAlpha ( sQuery[OPTION_RELAXED_LEN] ) )
@@ -1757,7 +1757,7 @@ bool XQParser_t::Parse ( XQQuery_t & tParsed, const char * sQuery, const CSphQue
 
 	Setup ( pSchema, pMyTokenizer, pMyDict, &tParsed, tSettings );
 	m_sQuery = (BYTE*) sQuery;
-	m_iQueryLen = sQuery ? strlen(sQuery) : 0;
+	m_iQueryLen = sQuery ? (int) strlen(sQuery) : 0;
 	m_iPendingNulls = 0;
 	m_iPendingType = 0;
 	m_pRoot = NULL;

+ 32 - 28
src/sphinxrt.cpp

@@ -1438,7 +1438,7 @@ CSphSource_StringVector::CSphSource_StringVector ( const VecTraits_T<const char
 	for ( const char* sField : dFields )
 	{
 		m_dFields.Add ( (BYTE*) sField );
-		m_dFieldLengths.Add ( strlen ( sField ) );
+		m_dFieldLengths.Add ( (int) strlen ( sField ) );
 		assert ( sField );
 	}
 	m_dFields.Add (nullptr);
@@ -1831,7 +1831,7 @@ void RtAccum_t::AddDocument ( ISphHits * pHits, const CSphMatch & tDoc, bool bRe
 			const char * pStr = ppStr ? ppStr[iStrAttr++] : nullptr;
 			int iLen = 0;
 			if ( tColumn.m_eAttrType==SPH_ATTR_STRING )
-				iLen = ( pStr ? strlen ( pStr ) : 0 );
+				iLen = ( pStr ? (int) strlen ( pStr ) : 0 );
 			else // SPH_ATTR_JSON - packed len + data
 				iLen = sphUnpackPtrAttr ( (const BYTE*)pStr, (const BYTE**)&pStr );
 
@@ -4026,7 +4026,7 @@ static bool LoadVector ( CSphReader & tReader, CSphVector < T, P > & tVector,
 
 	tVector.Resize ( iSize );
 	if ( tVector.GetLength() )
-		tReader.GetBytes ( tVector.Begin(), tVector.GetLengthBytes() );
+		tReader.GetBytes ( tVector.Begin(), (int) tVector.GetLengthBytes() );
 
 	return true;
 }
@@ -4048,7 +4048,7 @@ static bool LoadVector ( BinlogReader_c & tReader, CSphVector < T, P > & tVector
 	STATIC_ASSERT ( IS_TRIVIALLY_COPYABLE(T), NON_TRIVIAL_VECTORS_ARE_UNSERIALIZABLE );
 	tVector.Resize ( (int) tReader.UnzipOffset() ); // FIXME? sanitize?
 	if ( tVector.GetLength() )
-		tReader.GetBytes ( tVector.Begin(), tVector.GetLengthBytes() );
+		tReader.GetBytes ( tVector.Begin(), (int) tVector.GetLengthBytes() );
 	return !tReader.GetErrorFlag();
 }
 
@@ -4471,7 +4471,7 @@ int RtIndex_c::DebugCheck ( FILE * fp )
 					}
 				}
 
-				int iCalcWordLen = strlen ( (const char *)sWord+1 );
+				auto iCalcWordLen = (int) strlen ( (const char *)sWord+1 );
 				if ( iWordLen!=iCalcWordLen )
 				{
 					sWord[sizeof(sWord)-1] = '\0';
@@ -4792,7 +4792,7 @@ int RtIndex_c::DebugCheck ( FILE * fp )
 		{
 			const RtWordCheckpoint_t & tRefCP = dRefCheckpoints[i];
 			const RtWordCheckpoint_t & tCP = tSegment.m_dWordCheckpoints[i];
-			const int iLen = m_bKeywordDict ? strlen ( tCP.m_sWord ) : 0;
+			const int iLen = m_bKeywordDict ? (const int) strlen ( tCP.m_sWord ) : 0;
 			if ( m_bKeywordDict && ( !tCP.m_sWord || ( !strlen ( tRefCP.m_sWord ) || !strlen ( tCP.m_sWord ) ) ) )
 			{
 				tReporter.Fail ( "empty word checkpoint %d ((segment=%d, read_word=%s, read_len=%u, readpos=%d, calc_word=%s, calc_len=%u, calcpos=%d)",
@@ -5336,7 +5336,7 @@ struct DictEntryRtPayload_t
 
 		int iTotalDocs = 0;
 		int iTotalHits = 0;
-		if ( m_dWordExpand.GetLength() )
+		if ( !m_dWordExpand.IsEmpty() )
 		{
 			int iRtExpansionLimit = tArgs.m_iExpansionLimit * m_iSegExpansionLimit;
 			if ( tArgs.m_iExpansionLimit && m_dWordExpand.GetLength()>iRtExpansionLimit )
@@ -5366,7 +5366,8 @@ struct DictEntryRtPayload_t
 					tArgs.m_dExpanded.Last().m_iHits += pCur->m_iHits;
 				} else
 				{
-					tArgs.AddExpanded ( sBase + pCur->m_iNameOff + 1, sBase[pCur->m_iNameOff], pCur->m_iDocs, pCur->m_iHits );
+					tArgs.AddExpanded ( sBase + pCur->m_iNameOff + 1, sBase[pCur->m_iNameOff],
+							pCur->m_iDocs, pCur->m_iHits );
 					pLast = pCur;
 				}
 				iTotalDocs += pCur->m_iDocs;
@@ -5391,13 +5392,15 @@ struct DictEntryRtPayload_t
 				{
 					// sort expansions by frequency desc
 					// per segment clip the less frequent ones if needed, as they are likely misspellings
-					sphSort ( m_dWordPayload.Begin()+tSeg.m_uOff, tSeg.m_uLen, ExpandedOrderDesc_T<RtExpandedPayload_t>() );
+					sphSort ( m_dWordPayload.Begin()+tSeg.m_uOff, tSeg.m_uLen,
+							ExpandedOrderDesc_T<RtExpandedPayload_t>() );
 					tSeg.m_uLen = uExpansionLimit;
 				}
 
 				iPayloads += tSeg.m_uLen;
 				// sort by ascending doc-list offset
-				sphSort ( m_dWordPayload.Begin()+tSeg.m_uOff, tSeg.m_uLen, bind ( &RtExpandedPayload_t::m_uDoclistOff ) );
+				sphSort ( m_dWordPayload.Begin()+tSeg.m_uOff, tSeg.m_uLen,
+						bind ( &RtExpandedPayload_t::m_uDoclistOff ) );
 			}
 
 			auto * pPayload = new RtSubstringPayload_t ( m_dSeg.GetLength(), iPayloads );
@@ -5460,7 +5463,7 @@ void RtIndex_c::GetPrefixedWords ( const char * sSubstring, int iSubLen, const c
 			if ( pCurCheckpoint )
 			{
 				// there could be valid data prior 1st checkpoint that should be unpacked and checked
-				int iCheckpointNameLen = strlen ( pCurCheckpoint->m_sWord );
+				auto iCheckpointNameLen = (int) strlen ( pCurCheckpoint->m_sWord );
 				if ( pCurCheckpoint!=pCurSeg->m_dWordCheckpoints.Begin()
 					|| ( sphDictCmp ( sSubstring, iSubLen, pCurCheckpoint->m_sWord, iCheckpointNameLen )==0 && iSubLen==iCheckpointNameLen ) )
 				{
@@ -5477,7 +5480,8 @@ void RtIndex_c::GetPrefixedWords ( const char * sSubstring, int iSubLen, const c
 			if ( iCmp<0 )
 			{
 				break;
-			} else if ( iCmp==0 && iSubLen<=pWord->m_sWord[0] && sphWildcardMatch ( (const char *)pWord->m_sWord+1+iSkipMagic, sWildcard, pWildcard ) )
+			} else if ( iCmp==0 && iSubLen<=pWord->m_sWord[0]
+				&& sphWildcardMatch ( (const char *)pWord->m_sWord+1+iSkipMagic, sWildcard, pWildcard ) )
 			{
 				tDict2Payload.Add ( pWord, iSeg );
 			}
@@ -6108,7 +6112,7 @@ public:
 #endif
 };
 
-void QueryDiskChunks ( const CSphQuery * pQuery,
+static void QueryDiskChunks ( const CSphQuery * pQuery,
 		CSphQueryResult * pResult,
 		const CSphMultiQueryArgs & tArgs,
 		SphChunkGuard_t& tGuard,
@@ -6413,7 +6417,7 @@ bool RtIndex_c::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult
 	if ( m_pFieldFilter && sModifiedQuery )
 	{
 		pFieldFilter = m_pFieldFilter->Clone();
-		if ( pFieldFilter && pFieldFilter->Apply ( sModifiedQuery, strlen ( (char*)sModifiedQuery ), dFiltered, true ) )
+		if ( pFieldFilter && pFieldFilter->Apply ( sModifiedQuery, (int) strlen ( (char*)sModifiedQuery ), dFiltered, true ) )
 			sModifiedQuery = dFiltered.Begin();
 	}
 
@@ -6869,7 +6873,7 @@ void RtIndex_c::DoGetKeywords ( CSphVector<CSphKeywordInfo> & dKeywords, const c
 	if ( m_pFieldFilter && sQuery )
 	{
 		pFieldFilter = m_pFieldFilter->Clone();
-		if ( pFieldFilter && pFieldFilter->Apply ( sModifiedQuery, strlen ( (char*)sModifiedQuery ), dFiltered, true ) )
+		if ( pFieldFilter && pFieldFilter->Apply ( sModifiedQuery, (int) strlen ( (char*)sModifiedQuery ), dFiltered, true ) )
 			sModifiedQuery = dFiltered.Begin();
 	}
 
@@ -6897,7 +6901,7 @@ void RtIndex_c::DoGetKeywords ( CSphVector<CSphKeywordInfo> & dKeywords, const c
 		tExpCtx.m_bMergeSingles = false;
 		tExpCtx.m_pIndexData = &tGuard.m_dRamChunks;
 
-		pTokenizer->SetBuffer ( sModifiedQuery, strlen ( (const char*)sModifiedQuery ) );
+		pTokenizer->SetBuffer ( sModifiedQuery, (int) strlen ( (const char*)sModifiedQuery ) );
 		tAotFilter.GetKeywords ( dKeywords, tExpCtx );
 	} else
 	{
@@ -9783,15 +9787,15 @@ void RtAccum_t::LoadRtTrx ( const BYTE * pData, int iLen )
 
 	// insert and replace
 	m_dAccum.Resize ( tReader.GetDword() );
-	tReader.GetBytes ( m_dAccum.Begin(), m_dAccum.GetLengthBytes() );
+	tReader.GetBytes ( m_dAccum.Begin(),(int) m_dAccum.GetLengthBytes() );
 	m_dAccumRows.Resize ( tReader.GetDword() );
-	tReader.GetBytes ( m_dAccumRows.Begin(), m_dAccumRows.GetLengthBytes() );
+	tReader.GetBytes ( m_dAccumRows.Begin(), (int) m_dAccumRows.GetLengthBytes() );
 	m_dBlobs.Resize ( tReader.GetDword() );
-	tReader.GetBytes ( m_dBlobs.Begin(), m_dBlobs.GetLengthBytes() );
+	tReader.GetBytes ( m_dBlobs.Begin(), (int) m_dBlobs.GetLengthBytes() );
 	m_dPerDocHitsCount.Resize ( tReader.GetDword() );
-	tReader.GetBytes ( m_dPerDocHitsCount.Begin(), m_dPerDocHitsCount.GetLengthBytes() );
+	tReader.GetBytes ( m_dPerDocHitsCount.Begin(), (int) m_dPerDocHitsCount.GetLengthBytes() );
 	m_dPackedKeywords.Reset ( tReader.GetDword() );
-	tReader.GetBytes ( m_dPackedKeywords.Begin(), m_dPackedKeywords.GetLengthBytes() );
+	tReader.GetBytes ( m_dPackedKeywords.Begin(), (int) m_dPackedKeywords.GetLengthBytes() );
 	if ( !!tReader.GetByte() )
 	{
 		if ( !m_pDocstore.Ptr() )
@@ -9802,7 +9806,7 @@ void RtAccum_t::LoadRtTrx ( const BYTE * pData, int iLen )
 
 	// delete
 	m_dAccumKlist.Resize ( tReader.GetDword() );
-	tReader.GetBytes ( m_dAccumKlist.Begin(), m_dAccumKlist.GetLengthBytes() );
+	tReader.GetBytes ( m_dAccumKlist.Begin(), (int) m_dAccumKlist.GetLengthBytes() );
 }
 
 void RtAccum_t::SaveRtTrx ( MemoryWriter_c & tWriter ) const
@@ -9812,15 +9816,15 @@ void RtAccum_t::SaveRtTrx ( MemoryWriter_c & tWriter ) const
 
 	// insert and replace
 	tWriter.PutDword ( m_dAccum.GetLength() );
-	tWriter.PutBytes ( m_dAccum.Begin(), m_dAccum.GetLengthBytes() );
+	tWriter.PutBytes ( m_dAccum.Begin(), (int) m_dAccum.GetLengthBytes() );
 	tWriter.PutDword ( m_dAccumRows.GetLength() );
-	tWriter.PutBytes ( m_dAccumRows.Begin(), m_dAccumRows.GetLengthBytes() );
+	tWriter.PutBytes ( m_dAccumRows.Begin(), (int) m_dAccumRows.GetLengthBytes() );
 	tWriter.PutDword ( m_dBlobs.GetLength() );
-	tWriter.PutBytes ( m_dBlobs.Begin(), m_dBlobs.GetLengthBytes() );
+	tWriter.PutBytes ( m_dBlobs.Begin(), (int) m_dBlobs.GetLengthBytes() );
 	tWriter.PutDword ( m_dPerDocHitsCount.GetLength() );
-	tWriter.PutBytes ( m_dPerDocHitsCount.Begin(), m_dPerDocHitsCount.GetLengthBytes() );
+	tWriter.PutBytes ( m_dPerDocHitsCount.Begin(), (int) m_dPerDocHitsCount.GetLengthBytes() );
 	// packed keywords default length is 1 no need to pass that
-	int iLen = ( m_bKeywordDict && m_pDictRt->GetPackedLen()>1 ? m_pDictRt->GetPackedLen() : 0 );
+	int iLen = ( m_bKeywordDict && m_pDictRt->GetPackedLen()>1 ? (int) m_pDictRt->GetPackedLen() : 0 );
 	tWriter.PutDword ( iLen );
 	if ( iLen )
 		tWriter.PutBytes ( m_pDictRt->GetPackedKeywords(), iLen );
@@ -9830,5 +9834,5 @@ void RtAccum_t::SaveRtTrx ( MemoryWriter_c & tWriter ) const
 
 	// delete
 	tWriter.PutDword ( m_dAccumKlist.GetLength() );
-	tWriter.PutBytes ( m_dAccumKlist.Begin(), m_dAccumKlist.GetLengthBytes() );
+	tWriter.PutBytes ( m_dAccumKlist.Begin(), (int) m_dAccumKlist.GetLengthBytes() );
 }

+ 6 - 6
src/sphinxsearch.cpp

@@ -2847,7 +2847,7 @@ public:
 			sArgs += 2;
 		}
 
-		int iLen = strlen ( sArgs );
+		auto iLen = (int)strlen ( sArgs );
 		if ( dArgs.GetLength()!=iLen )
 		{
 			sError.SetSprintf ( "%s() requires %d argument(s), not %d", sFuncname, iLen, dArgs.GetLength() );
@@ -3587,7 +3587,7 @@ BYTE * RankerState_Expr_fn<NEED_PACKEDFACTORS, HANDLE_DUPES>::PackFactors()
 	memcpy ( pPack, m_dFieldTF.Begin(), m_dFieldTF.GetLength()*sizeof(m_dFieldTF[0]) );
 	pPack += m_dFieldTF.GetLength();
 
-	*pPackStart = (pPack-pPackStart)*sizeof(DWORD);
+	*pPackStart = (DWORD)((pPack-pPackStart)*sizeof(DWORD));
 	assert ( (pPack-pPackStart)*sizeof(DWORD)<=(DWORD)m_tFactorPool.GetElementSize() );
 	return (BYTE*)pPackStart;
 }
@@ -3871,8 +3871,8 @@ public:
 				m_dTFIDF[i], m_dMinIDF[i], m_dMaxIDF[i], m_dSumIDF[i],
 				m_iMinHitPos[i], m_iMinBestSpanPos[i], m_tExactHit.BitGet ( i ), m_iMaxWindowHits[i] );
 
-			int iValLen = strlen ( dVal.Begin() );
-			int iTotalLen = iValLen+strlen(sTmp);
+			auto iValLen = (int) strlen ( dVal.Begin() );
+			auto iTotalLen = iValLen+(int)strlen(sTmp);
 			if ( dVal.GetLength() < iTotalLen+1 )
 				dVal.Resize ( iTotalLen+1 );
 
@@ -3884,8 +3884,8 @@ public:
 			if ( !IsTermSkipped ( i ) )
 		{
 			snprintf ( sTmp, MAX_STR_LEN, ", word%d=(tf=%d, idf=%f)", i, m_dTF[i], m_dIDF[i] );
-			int iValLen = strlen ( dVal.Begin() );
-			int iTotalLen = iValLen+strlen(sTmp);
+			auto iValLen = (int)strlen ( dVal.Begin() );
+			auto iTotalLen = iValLen+(int)strlen(sTmp);
 			if ( dVal.GetLength() < iTotalLen+1 )
 				dVal.Resize ( iTotalLen+1 );
 

+ 6 - 6
src/sphinxsort.cpp

@@ -4242,7 +4242,7 @@ protected:
 public:
 	explicit SortClauseTokenizer_t ( const char * sBuffer )
 	{
-		int iLen = strlen(sBuffer);
+		auto iLen = (int) strlen(sBuffer);
 		m_pBuf = new char [ iLen+1 ];
 		m_pMax = m_pBuf+iLen;
 		m_pCur = m_pBuf;
@@ -4477,7 +4477,7 @@ ESortClauseParseResult sphParseSortClause ( const CSphQuery * pQuery, const char
 					if ( pAttr->m_pExpr )
 						pAttr->m_pExpr->AddRef(); // SetupSortRemap uses refcounted pointer, but does not AddRef() itself, so help it
 					tState.m_tSubExpr[iField] = pAttr->m_pExpr;
-					tState.m_tSubKeys[iField] = JsonKey_t ( pTok, strlen ( pTok ) );
+					tState.m_tSubKeys[iField] = JsonKey_t ( pTok, (int) strlen ( pTok ) );
 
 				} else
 				{
@@ -4489,7 +4489,7 @@ ESortClauseParseResult sphParseSortClause ( const CSphQuery * pQuery, const char
 						{
 							ExprParseArgs_t tExprArgs;
 							tState.m_tSubExpr[iField] = sphExprParse ( pTok, tSchema, sError, tExprArgs );
-							tState.m_tSubKeys[iField] = JsonKey_t ( pTok, strlen ( pTok ) );
+							tState.m_tSubKeys[iField] = JsonKey_t ( pTok, (int) strlen ( pTok ) );
 						}
 					}
 				}
@@ -4505,7 +4505,7 @@ ESortClauseParseResult sphParseSortClause ( const CSphQuery * pQuery, const char
 				if ( pExpr )
 				{
 					tState.m_tSubExpr[iField] = pExpr;
-					tState.m_tSubKeys[iField] = JsonKey_t ( pTok, strlen(pTok) );
+					tState.m_tSubKeys[iField] = JsonKey_t ( pTok, (int) strlen(pTok) );
 					tState.m_tSubKeys[iField].m_uMask = 0;
 					tState.m_tSubType[iField] = eAttrType;
 					iAttr = 0; // will be remapped in SetupSortRemap
@@ -4754,7 +4754,7 @@ uint64_t ExprGeodist_t::GetHash ( const ISphSchema & tSorterSchema, uint64_t uPr
 	uint64_t uHash = sphCalcExprDepHash ( this, tSorterSchema, uPrevHash, bDisable );
 
 	static const char * EXPR_TAG = "ExprGeodist_t";
-	uHash = sphFNV64 ( EXPR_TAG, strlen(EXPR_TAG), uHash );
+	uHash = sphFNV64 ( EXPR_TAG, (int) strlen(EXPR_TAG), uHash );
 	uHash = sphFNV64 ( &m_fGeoAnchorLat, sizeof(m_fGeoAnchorLat), uHash );
 	uHash = sphFNV64 ( &m_fGeoAnchorLong, sizeof(m_fGeoAnchorLong), uHash );
 
@@ -5603,7 +5603,7 @@ public:
 		BYTE * pDst = dBuf.Begin()+iLen+1;
 		int iDstAvailable = dBuf.GetLength() - iLen - LOCALE_SAFE_GAP;
 
-		int iDstLen = strxfrm ( (char *)pDst, (const char *) dBuf.Begin(), iDstAvailable );
+		auto iDstLen = (int) strxfrm ( (char *)pDst, (const char *) dBuf.Begin(), iDstAvailable );
 		assert ( iDstLen<iDstAvailable+LOCALE_SAFE_GAP );
 
 		uint64_t uAcc = sphFNV64 ( pDst, iDstLen, uPrev );

+ 5 - 5
src/sphinxstd.cpp

@@ -2276,7 +2276,7 @@ private:
 		};
 
 		CSphTightVector<Centroid_t> dValues;
-		dValues.Reserve ( m_dMap.size() );
+		dValues.Reserve ( (int) m_dMap.size() );
 		for ( auto i : m_dMap )
 		{
 			Centroid_t & tCentroid = dValues.Add();
@@ -2496,7 +2496,7 @@ StringBuilder_c & StringBuilder_c::AppendName ( const char * sName )
 	if ( !sName || !strlen ( sName ) )
 		return *this;
 
-	AppendChunk ( {sName, strlen ( sName )}, '"' );
+	AppendChunk ( {sName, (int) strlen ( sName )}, '"' );
 	GrowEnough(2);
 	m_szBuffer[m_iUsed] = ':';
 	m_szBuffer[m_iUsed+1] = '\0';
@@ -2536,7 +2536,7 @@ StringBuilder_c & StringBuilder_c::operator += ( const char * sText )
 	if ( !sText || *sText=='\0' )
 		return *this;
 
-	return AppendChunk ( {sText, strlen ( sText )} );
+	return AppendChunk ( {sText, (int) strlen ( sText )} );
 }
 
 StringBuilder_c & StringBuilder_c::operator+= ( const Str_t& sChunk )
@@ -2710,10 +2710,10 @@ StringBuilder_c::LazyComma_c::LazyComma_c ( const char * sDelim, const char * sP
 	: Comma_c ( sDelim )
 {
 	if ( sPrefix )
-		m_sPrefix = { sPrefix, strlen(sPrefix) };
+		m_sPrefix = { sPrefix, (int) strlen(sPrefix) };
 
 	if ( sTerm )
-		m_sSuffix = { sTerm, strlen(sTerm ) };
+		m_sSuffix = { sTerm, (int) strlen(sTerm ) };
 }
 
 StringBuilder_c::LazyComma_c::LazyComma_c( const StrBlock_t& dBlock )

+ 7 - 7
src/sphinxstd.h

@@ -1826,7 +1826,7 @@ public:
 	/// (could be > GetLengthBytes() since uses limit, not size)
 	inline int64_t AllocatedBytes() const
 	{
-		return m_iLimit*sizeof(T);
+		return (int) m_iLimit*sizeof(T);
 	}
 
 public:
@@ -2524,7 +2524,7 @@ public:
 			m_sValue = EMPTY;
 		} else
 		{
-			int iLen = 1 + strlen ( rhs.m_sValue );
+			auto iLen = 1 + (int)strlen ( rhs.m_sValue ) + 1;
 			m_sValue = new char[iLen + SAFETY_GAP];
 
 			memcpy ( m_sValue, rhs.m_sValue, iLen ); // NOLINT
@@ -2596,7 +2596,7 @@ public:
 				m_sValue = EMPTY;
 			} else
 			{
-				int iLen = 1+strlen(sString);
+				auto iLen = 1+(int) strlen(sString);
 				m_sValue = new char [ iLen+SAFETY_GAP ];
 
 				strcpy ( m_sValue, sString ); // NOLINT
@@ -2620,7 +2620,7 @@ public:
 	CSphString SubString ( int iStart, int iCount ) const
 	{
 		#ifndef NDEBUG
-		int iLen = strlen(m_sValue);
+		auto iLen = (int) strlen(m_sValue);
 		iCount = Min( iLen - iStart, iCount );
 		#endif
 		assert ( iStart>=0 && iStart<iLen );
@@ -2735,8 +2735,8 @@ public:
 		if ( !m_sValue || !sSuffix )
 			return false;
 
-		int iVal = strlen ( m_sValue );
-		int iSuffix = strlen ( sSuffix );
+		auto iVal = (int) strlen ( m_sValue );
+		auto iSuffix = (int) strlen ( sSuffix );
 		if ( iVal<iSuffix )
 			return false;
 		return strncmp ( m_sValue+iVal-iSuffix, sSuffix, iSuffix )==0;
@@ -2952,7 +2952,7 @@ public:
 	// standalone - cast to 'Str_t' when necessary
 	explicit Comma_c ( const char * sDelim=nullptr )
 	{
-		m_sComma = sDelim ? Str_t { sDelim, strlen( sDelim ) } : dEmptyStr;
+		m_sComma = sDelim ? Str_t { sDelim, (int) strlen( sDelim ) } : dEmptyStr;
 	}
 
 	explicit Comma_c( Str_t sDelim ): m_sComma( std::move( sDelim )) {}

+ 3 - 3
src/sphinxstemcz.cpp

@@ -118,7 +118,7 @@ static void Palatalize ( BYTE * word )
 		return;
 
 	int nRules = sizeof ( g_dPalatalizeRules ) / sizeof ( g_dPalatalizeRules[0] );
-	int iWordLength = strlen ( (char*)word );
+	auto iWordLength = (int) strlen ( (char*)word );
 
 	for ( int i = 0; i < nRules; ++i )
 	{
@@ -142,7 +142,7 @@ static void ApplyRules ( BYTE * word, const ClampRule_t * pRules, int nRules )
 	if ( !word || !pRules )
 		return;
 
-	int iWordLength = strlen ( (char *)word );
+	auto iWordLength = (int) strlen ( (char *)word );
 
 	for ( int i = 0; i < nRules; ++i )
 	{
@@ -160,7 +160,7 @@ static void ApplyRules ( BYTE * word, const ClampRule_t * pRules, int nRules )
 static void RemoveChars ( char * szString, char cChar )
 {
 	char * szPos;
-	int iLength = strlen ( szString );
+	auto iLength = (int) strlen ( szString );
 	while ( ( szPos = strchr ( szString, cChar ) )!=NULL )
 		memmove ( szPos, szPos + 1, iLength - ( szPos - szString ) );
 }

+ 22 - 22
src/sphinxutils.cpp

@@ -114,7 +114,7 @@ void sphSplitApply ( const char * sIn, int iSize, StrFunctor &&dFunc )
 		return;
 
 	const char * p = ( char * ) sIn;
-	if ( iSize<0 ) iSize = strlen (p);
+	if ( iSize<0 ) iSize = (int) strlen (p);
 	const char * pEnd = p + iSize;
 	while ( p < pEnd )
 	{
@@ -2083,9 +2083,9 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 			if ( !sPercent ) // no formatters, only plain chars
 			{
 				auto uLen = strlen (sFmt-1);
-				Grow ( pOutput, uLen );
-				memcpy ( tail ( pOutput ), sFmt-1, uLen );
-				pOutput += uLen;
+				Grow ( pOutput, (int) uLen );
+				memcpy ( tail ( pOutput ), sFmt-1, (int) uLen );
+				pOutput += (int) uLen;
 				sFmt+=uLen-1;
 				continue;
 			}
@@ -2094,7 +2094,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 			if ( uLen )
 			{
 				Grow ( pOutput, uLen );
-				memcpy ( tail ( pOutput ), sFmt - 1, uLen );
+				memcpy ( tail ( pOutput ), sFmt - 1, (int) uLen );
 				pOutput += uLen;
 				sFmt+=uLen;
 			}
@@ -2167,21 +2167,21 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 				if ( iWidth )
 					iWidth-=iValue;
 
-				Grow ( pOutput, iWidth );
+				Grow ( pOutput, (int) iWidth );
 				if ( iWidth && bHeadingSpace )
 				{
-					memset ( tail ( pOutput ), ' ', iWidth );
-					pOutput += iWidth;
+					memset ( tail ( pOutput ), ' ', (int) iWidth );
+					pOutput += (int) iWidth;
 				}
 
-				Grow ( pOutput, iValue );
+				Grow ( pOutput, (int) iValue );
 				memcpy ( tail ( pOutput ), pValue, iValue );
-				pOutput += iValue;
+				pOutput += (int) iValue;
 
 				if ( iWidth && !bHeadingSpace )
 				{
-					memset ( tail ( pOutput ), ' ', iWidth );
-					pOutput += iWidth;
+					memset ( tail ( pOutput ), ' ', (int) iWidth );
+					pOutput += (int) iWidth;
 				}
 
 				state = SNORMAL;
@@ -2192,7 +2192,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 			{
 				void * pValue = va_arg ( ap, void * );
 				auto uValue = uint64_t ( pValue );
-				::NtoA_T ( &pOutput, uValue, 16, iWidth, iPrec, cFill );
+				::NtoA_T ( &pOutput, uValue, 16, (int) iWidth, (int) iPrec, cFill );
 				state = SNORMAL;
 				break;
 			}
@@ -2201,14 +2201,14 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'u': // decimal unsigned
 			{
 				DWORD uValue = va_arg ( ap, DWORD );
-				::NtoA_T ( &pOutput, uValue, ( c=='x' ) ? 16 : 10, iWidth, iPrec, cFill );
+				::NtoA_T ( &pOutput, uValue, ( c=='x' ) ? 16 : 10, (int) iWidth,(int)  iPrec, cFill );
 				state = SNORMAL;
 				break;
 			}
 		case 'd': // decimal integer
 			{
 				int iValue = va_arg ( ap, int );
-				::NtoA_T ( &pOutput, iValue, 10, iWidth, iPrec, cFill );
+				::NtoA_T ( &pOutput, iValue, 10, (int) iWidth, (int) iPrec, cFill );
 				state = SNORMAL;
 				break;
 			}
@@ -2223,7 +2223,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'l': // decimal int64
 			{
 				int64_t iValue = va_arg ( ap, int64_t );
-				::NtoA_T ( &pOutput, iValue, 10, iWidth, iPrec, cFill );
+				::NtoA_T ( &pOutput, iValue, 10, (int) iWidth, (int) iPrec, cFill );
 				state = SNORMAL;
 				break;
 			}
@@ -2231,7 +2231,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'U': // decimal uint64
 			{
 				uint64_t iValue = va_arg ( ap, uint64_t );
-				::NtoA_T ( &pOutput, iValue, 10, iWidth, iPrec, cFill );
+				::NtoA_T ( &pOutput, iValue, 10, (int) iWidth, (int) iPrec, cFill );
 				state = SNORMAL;
 				break;
 			}
@@ -2239,7 +2239,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'D': // fixed-point signed 64-bit
 			{
 				int64_t iValue = va_arg ( ap, int64_t );
-				::IFtoA_T ( &pOutput, iValue, iPrec );
+				::IFtoA_T ( &pOutput, iValue, (int) iPrec );
 				state = SNORMAL;
 				break;
 			}
@@ -2247,7 +2247,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'F': // fixed-point signed 32-bit
 			{
 				int iValue = va_arg ( ap, int );
-				::IFtoA_T ( &pOutput, iValue, iPrec );
+				::IFtoA_T ( &pOutput, iValue, (int) iPrec );
 				state = SNORMAL;
 				break;
 			}
@@ -2255,7 +2255,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 't': // timespan given in int64 useconds
 			{
 				int64_t iValue = va_arg ( ap, int64_t );
-				::TMtoA_T ( &pOutput, iValue, iPrec );
+				::TMtoA_T ( &pOutput, iValue, (int) iPrec );
 				state = SNORMAL;
 				break;
 			}
@@ -2263,7 +2263,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 		case 'T': // timestamp (related to now()) given in int64 useconds
 			{
 				int64_t iValue = va_arg ( ap, int64_t );
-				::TMStoA_T ( &pOutput, iValue, iPrec );
+				::TMStoA_T ( &pOutput, iValue, (int) iPrec );
 				state = SNORMAL;
 				break;
 			}
@@ -2273,7 +2273,7 @@ void vSprintf_T ( PCHAR * _pOutput, const char * sFmt, va_list ap )
 				double fValue = va_arg ( ap, double );
 
 				// ensure 32 is enough to take any float value.
-				Grow ( pOutput, Max ( iWidth, ( size_t ) 32 ));
+				Grow ( pOutput, Max ( (int) iWidth, 32 ));
 
 				// extract current format from source format line
 				auto *pF = sFmt;

+ 3 - 3
src/tests.cpp

@@ -81,7 +81,7 @@ char * LoadFile ( const char * sName, int * pLen, bool bReportErrors )
 	}
 	const int MAX_DATA = 10485760;
 	char * sData = new char [ MAX_DATA ];
-	int iData = fread ( sData, 1, MAX_DATA, fp );
+	auto iData = (int) fread ( sData, 1, MAX_DATA, fp );
 	fclose ( fp );
 	if ( iData<=0 )
 	{
@@ -181,7 +181,7 @@ void BenchStripper ()
 
 	const int MAX_SIZE = 1048576;
 	char * sBuf = new char [ MAX_SIZE ];
-	int iLen = fread ( sBuf, 1, MAX_SIZE-1, fp );
+	auto iLen = (int) fread ( sBuf, 1, MAX_SIZE-1, fp );
 	fclose ( fp );
 
 	char * sRef = new char [ MAX_SIZE ];
@@ -733,7 +733,7 @@ void BenchStemmer ()
 	FILE * fp = fopen ( CORPUS, "rb" );
 	if ( !fp )
 		sphDie ( "fopen %s failed", CORPUS );
-	int iLen = fread ( pRaw, 1, POOLSIZE, fp );
+	auto iLen = (int) fread ( pRaw, 1, POOLSIZE, fp );
 	printf ( "read %d bytes\n", iLen );
 	fclose ( fp );
 

+ 2 - 2
src/threadutils.cpp

@@ -721,9 +721,9 @@ struct ThreadPool_c::Impl_t
 		, m_tService ( iThreadCount==1 )
 	{
 		createWork ();
-		m_dThreads.Resize ( iThreadCount );
+		m_dThreads.Resize ( (int) iThreadCount );
 		for ( size_t i = 0; i<iThreadCount; ++i )
-			m_dThreads[i] = makeTinyThread ( [this] { loop (); }, i, szName );
+			m_dThreads[i] = makeTinyThread ( [this] { loop (); }, (int)i, szName );
 		LOG ( DEBUG, TP ) << "thread pool created with threads: " << iThreadCount;
 	}
 

+ 1 - 1
src/udfexample.c

@@ -253,7 +253,7 @@ DLLEXPORT char * hideemail_push_token ( void * userdata, char * token, int * ext
 	if ( pos0==0 || pos1==0 )
 		return token;
 
-	len0 = strlen ( token );
+	len0 = (int) strlen ( token );
 
 	// domain size not same as expected - hide email
 	if ( len0-(pos0+1-token)!=len1 )

+ 1 - 1
src/wordbreaker.cpp

@@ -286,7 +286,7 @@ void UrlBreakInit ( const char * sDict, bool bVerbose )
 
 void UrlBreak ( Split_t & tBest, const char * sWord )
 {
-	const int iLen = strlen(sWord);
+	auto iLen = (const int) strlen(sWord);
 
 	tBest.m_Pos.Resize(0);