Fixed more 64-bit related compiler warnings.

This commit is contained in:
hiker 2017-04-11 22:30:57 +10:00
parent c6109c9392
commit efec344738
9 changed files with 12 additions and 12 deletions

View File

@ -49,7 +49,7 @@ Event::Event(ENetEvent* event)
if (m_type == EVENT_TYPE_MESSAGE)
{
m_data = new NetworkString(event->packet->data,
event->packet->dataLength);
(int)event->packet->dataLength);
}
else
m_data = NULL;

View File

@ -75,7 +75,7 @@ void NetworkString::unitTesting()
* the characters of the given string. */
BareNetworkString& BareNetworkString::encodeString(const std::string &value)
{
int len = value.size();
int len = (int)value.size();
if(len<=255)
return this->addUInt8(len).addString(value);
else

View File

@ -55,7 +55,7 @@ Protocol::~Protocol()
*/
NetworkString* Protocol::getNetworkString(size_t capacity)
{
return new NetworkString(m_type, capacity);
return new NetworkString(m_type, (int)capacity);
} // getNetworkString
// ----------------------------------------------------------------------------

View File

@ -128,7 +128,7 @@ public:
virtual void asynchronousUpdate() = 0;
/// functions to check incoming data easily
NetworkString* getNetworkString(size_t capacity=16);
NetworkString* getNetworkString(size_t capacity = 16);
bool checkDataSize(Event* event, unsigned int minimum_size);
void sendMessageToPeersChangingToken(NetworkString *message,
bool reliable = true);

View File

@ -128,7 +128,7 @@ void LatencyProtocol::asynchronousUpdate()
{
NetworkString *ping_request =
getNetworkString(5);
ping_request->addUInt8(1).addUInt32(m_pings[i].size());
ping_request->addUInt8(1).addUInt32((int)m_pings[i].size());
m_pings[i] [ m_pings_count ] = current_time;
peers[i]->sendPacket(ping_request, false);
delete ping_request;

View File

@ -618,7 +618,7 @@ void STKHost::handleDirectSocketRequest()
// current players, and the client's ip address and port
// number (which solves the problem which network interface
// might be the right one if there is more than one).
BareNetworkString s(name.size()+1+11);
BareNetworkString s((int)name.size()+1+11);
s.encodeString(name);
s.addUInt8(NetworkConfig::get()->getMaxPlayers());
s.addUInt8(0); // FIXME: current number of connected players

View File

@ -162,7 +162,7 @@ void MultitouchSettingsDialog::updateValues()
CheckBoxWidget* buttons_en = getWidget<CheckBoxWidget>("buttons_enabled");
assert(buttons_en != NULL);
buttons_en->setState(UserConfigParams::m_multitouch_mode);
buttons_en->setState(UserConfigParams::m_multitouch_mode!=0);
CheckBoxWidget* accelerometer;
accelerometer = getWidget<CheckBoxWidget>("accelerometer_disabled");

View File

@ -149,11 +149,11 @@ void ArenaGraph::loadNavmesh(const std::string &navmesh)
createQuad(all_vertices[quad_index[0]],
all_vertices[quad_index[1]], all_vertices[quad_index[2]],
all_vertices[quad_index[3]], m_all_nodes.size(),
all_vertices[quad_index[3]], (int)m_all_nodes.size(),
false/*invisible*/, false/*ai_ignore*/, true/*is_arena*/,
false/*ignore*/);
ArenaNode* cur_node = getNode(m_all_nodes.size() - 1);
ArenaNode* cur_node = getNode((int)m_all_nodes.size() - 1);
cur_node->setAdjacentNodes(adjacent_quad_index);
}
}
@ -337,7 +337,7 @@ void ArenaGraph::setNearbyNodesOfAllNodes()
{
std::vector<float>::iterator it =
std::min_element(dist.begin(), dist.end());
const int pos = it - dist.begin();
const int pos = int(it - dist.begin());
nearby_nodes.push_back(pos);
dist[pos] = 999999.0f;
}

View File

@ -451,7 +451,7 @@ bool Translations::isRTLText(const wchar_t *in_ptr)
FriBidiChar *fribidiInput = toFribidiChar(in_ptr);
FriBidiCharType *types = new FriBidiCharType[length];
fribidi_get_bidi_types(fribidiInput, length, types);
fribidi_get_bidi_types(fribidiInput, (FriBidiStrIndex)length, types);
freeFribidiChar(fribidiInput);
// Declare as RTL if one character is RTL
@ -608,7 +608,7 @@ core::stringw Translations::fribidizeLine(const core::stringw &str)
FriBidiChar *fribidiOutput = new FriBidiChar[length + 1];
memset(fribidiOutput, 0, (length + 1) * sizeof(FriBidiChar));
fribidi_boolean result = fribidi_log2vis(fribidiInput,
length,
(FriBidiStrIndex)length,
&pbase_dir,
fribidiOutput,
/* gint *position_L_to_V_list */ NULL,