misc VS warning fixes
This commit is contained in:
@@ -768,7 +768,7 @@ int execute(const char *p)
|
||||
#ifndef STANDALONE
|
||||
bool exechook(int context, const char *ident, const char *body,...) // execute cubescript hook if available and allowed in current context/gamemode
|
||||
{ // always use one of HOOK_SP_MP, HOOK_SP or HOOK_MP and then OR them (as needed) with HOOK_TEAM, HOOK_NOTEAM, HOOK_BOTMODE, HOOK_FLAGMODE, HOOK_ARENA
|
||||
if(multiplayer(NULL) && (context & HOOK_FLAGMASK) != HOOK_MP && (context & HOOK_FLAGMASK) != HOOK_SP_MP) return false; // hook is singleplayer-only
|
||||
if(multiplayer(false) && (context & HOOK_FLAGMASK) != HOOK_MP && (context & HOOK_FLAGMASK) != HOOK_SP_MP) return false; // hook is singleplayer-only
|
||||
if(((context & HOOK_TEAM) && !m_teammode) ||
|
||||
((context & HOOK_NOTEAM) && m_teammode) ||
|
||||
((context & HOOK_BOTMODE) && !m_botmode) ||
|
||||
|
||||
@@ -608,7 +608,7 @@ void ed25519test(char *vectorfilename) // check ed25519 functions with test vec
|
||||
{ // a line consists of 32 bytes private key, 32 byte public key, ":", 32 byte public key (again), ":", message, ":", signed message, ":"
|
||||
char *vprivpub = l, *vpub = strchr(l, ':'), *vmsg, *vsmsg, hextemp[65];
|
||||
int linelen = strlen(l), msglen = 0;
|
||||
uchar privpub[64], pub[32], msg[linelen], smsg[linelen], temp[64];
|
||||
uchar privpub[64], pub[32], *msg = new uchar[linelen], *smsg = new uchar[linelen], temp[64];
|
||||
lines++;
|
||||
if(!vpub || !(vmsg = strchr(vpub + 1, ':')) || !(vsmsg = strchr(vmsg + 1, ':')) ||
|
||||
hex2bin(privpub, vprivpub, 64) != 64 || hex2bin(pub, ++vpub, 32) != 32 || (msglen = hex2bin(msg, ++vmsg, linelen)) < 0 || hex2bin(smsg, ++vsmsg, linelen) != (msglen + 64) ||
|
||||
@@ -629,6 +629,8 @@ void ed25519test(char *vectorfilename) // check ed25519 functions with test vec
|
||||
}
|
||||
pub[msglen % 32]++;
|
||||
if(ed25519_sign_check(smsg, msglen + 64, pub)) { verifyfail2++; continue; } // verification of altered signed message didn't fail (...but should've)
|
||||
delete[] smsg;
|
||||
delete[] msg;
|
||||
}
|
||||
DELETEA(vectorfile);
|
||||
conoutf("processed %d lines in %d milliseconds", lines, watch.elapsed());
|
||||
|
||||
@@ -120,7 +120,7 @@ void fe25519_freeze(fe25519 *r)
|
||||
m &= equal(r->v[i],255);
|
||||
m &= ge(r->v[0],237);
|
||||
|
||||
m = -m;
|
||||
m = (uint32_t) -int(m);
|
||||
|
||||
r->v[31] -= m&127;
|
||||
for(i=30;i>0;i--)
|
||||
@@ -173,7 +173,7 @@ void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b)
|
||||
{
|
||||
int i;
|
||||
uint32_t mask = b;
|
||||
mask = -mask;
|
||||
mask = (uint32_t) -int(mask);
|
||||
for(i=0;i<32;i++) r->v[i] ^= mask & (x->v[i] ^ r->v[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#ifdef __GNUC__
|
||||
#include <new>
|
||||
#include <signal.h>
|
||||
|
||||
Reference in New Issue
Block a user