Fix a couple of warnings

Use autogenerated copy constructors for ranges, don't use fallthrough as
control flow, initialize variables, don't cast something to a `const T`
in an expression.
This commit is contained in:
heinrich5991 2018-12-24 22:58:06 +01:00
parent d2e39d2f50
commit 6e0d3139c8
6 changed files with 12 additions and 19 deletions

View file

@ -138,11 +138,6 @@ public:
end = 0x0;
}
plain_range(const plain_range &r)
{
*this = r;
}
plain_range(T *b, T *e)
{
begin = b;
@ -184,11 +179,6 @@ public:
plain_range_sorted()
{}
plain_range_sorted(const plain_range_sorted &r)
{
*this = r;
}
plain_range_sorted(T *b, T *e)
: parent(b, e)
{}

View file

@ -553,7 +553,7 @@ static void StrVariableCommand(IConsole::IResult *pResult, void *pUserData)
int Length = 0;
while(*pString)
{
int Size = str_utf8_encode(Temp, static_cast<const unsigned char>(*pString++));
int Size = str_utf8_encode(Temp, static_cast<unsigned char>(*pString++));
if(Length+Size < pData->m_MaxSize)
{
mem_copy(pData->m_pStr+Length, &Temp, Size);

View file

@ -37,9 +37,9 @@ void CMapImages::LoadMapImages(IMap *pMap, class CLayers *pLayers, int MapType)
for(int k = 0; k < pLayers->NumLayers(); k++)
{
const CMapItemLayer * const pLayer = pLayers->GetLayer(k);
if(!FoundQuadLayer && pLayer->m_Type == LAYERTYPE_QUADS && ((const CMapItemLayerQuads * const)pLayer)->m_Image == i)
if(!FoundQuadLayer && pLayer->m_Type == LAYERTYPE_QUADS && ((const CMapItemLayerQuads *)pLayer)->m_Image == i)
FoundQuadLayer = true;
if(!FoundTileLayer && pLayer->m_Type == LAYERTYPE_TILES && ((const CMapItemLayerTilemap * const)pLayer)->m_Image == i)
if(!FoundTileLayer && pLayer->m_Type == LAYERTYPE_TILES && ((const CMapItemLayerTilemap *)pLayer)->m_Image == i)
FoundTileLayer = true;
}
if(FoundTileLayer)

View file

@ -524,12 +524,13 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
// get paras
switch(gs_GameMsgList[GameMsgID].m_ParaType)
{
case PARA_III:
aParaI[NumParaI++] = pUnpacker->GetInt();
case PARA_II:
aParaI[NumParaI++] = pUnpacker->GetInt();
case PARA_I:
aParaI[NumParaI++] = pUnpacker->GetInt();
case PARA_I: NumParaI = 1; break;
case PARA_II: NumParaI = 2; break;
case PARA_III: NumParaI = 3; break;
}
for(int i = 0; i < NumParaI; i++)
{
aParaI[i] = pUnpacker->GetInt();
}
// check for unpacking errors

View file

@ -126,6 +126,7 @@ const char *CLocalizationDatabase::FindString(unsigned Hash, unsigned ContextHas
{
CString String;
String.m_Hash = Hash;
String.m_ContextHash = 0; // this is ignored for the search anyway
sorted_array<CString>::range r = ::find_binary(m_Strings.all(), String);
if(r.empty())
return 0;

View file

@ -648,6 +648,7 @@ void CGameContext::OnClientEnter(int ClientID)
{
CNetMsg_De_ClientEnter Msg;
Msg.m_pName = NewClientInfoMsg.m_pName;
Msg.m_ClientID = ClientID;
Msg.m_Team = NewClientInfoMsg.m_Team;
Server()->SendPackMsg(&Msg, MSGFLAG_NOSEND, -1);
}