summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-08-09 19:23:48 -0700
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-08-09 19:23:48 -0700
commitbddaf98342a461f4e02389d4db390098fb423fbf (patch)
tree30e472aa10754b2c93a24a3519387b766e814907 /includes
parent032872bf6f7c14b0fdbc9cd75daae56bbeb50af0 (diff)
Fixing even more warnings.
Diffstat (limited to 'includes')
-rw-r--r--includes/BHashes.h15
-rw-r--r--includes/BLua.h8
-rw-r--r--includes/Base64.h2
3 files changed, 17 insertions, 8 deletions
diff --git a/includes/BHashes.h b/includes/BHashes.h
index c08b48d..3d7be49 100644
--- a/includes/BHashes.h
+++ b/includes/BHashes.h
@@ -3,6 +3,8 @@
#include <Exceptions.h>
#include <tomcrypt.h>
+#undef max
+
namespace Balau {
template<const struct ltc_hash_descriptor * desc>
@@ -13,9 +15,16 @@ class Hash {
int r = desc->init(&m_state);
IAssert(r == CRYPT_OK, "init for %s returned %i", desc->name, r);
}
- void update(const uint8_t * data, const size_t len) {
- int r = desc->process(&m_state, data, len);
- IAssert(r == CRYPT_OK, "process for %s returned %i", desc->name, r);
+ void update(const uint8_t * data, size_t len) {
+ while (len) {
+ unsigned long blockLen = std::numeric_limits<unsigned long>::max();
+ if (blockLen > len)
+ blockLen = (unsigned long) len;
+ int r = desc->process(&m_state, data, blockLen);
+ data += blockLen;
+ len -= blockLen;
+ IAssert(r == CRYPT_OK, "process for %s returned %i", desc->name, r);
+ }
}
unsigned final(void * digest, unsigned outlen) {
AAssert(outlen >= digestSize(), "digest size too small being passed on for %s: %u instead of %u", name(), outlen, digestSize());
diff --git a/includes/BLua.h b/includes/BLua.h
index a8df837..b5c147a 100644
--- a/includes/BLua.h
+++ b/includes/BLua.h
@@ -79,8 +79,8 @@ class LuaObjectFactory {
static void pushMeta(Lua & L, const char (&str)[S], lua_CFunction func, int upvalues = 0) {
pushMeta(L, str, S - 1, func, upvalues);
}
- static void pushMethod(Lua & L, const char * name, int strSize, lua_CFunction func, int upvalues = 0);
- static void pushMeta(Lua & L, const char * name, int strSize, lua_CFunction func, int upvalues = 0);
+ static void pushMethod(Lua & L, const char * name, size_t strSize, lua_CFunction func, int upvalues = 0);
+ static void pushMeta(Lua & L, const char * name, size_t strSize, lua_CFunction func, int upvalues = 0);
static LuaObjectBase * getMeInternal(Lua & L, int idx);
friend class Lua;
private:
@@ -132,7 +132,7 @@ class Lua {
void push(bool b) { checkstack(); lua_pushboolean(L, b); }
template<size_t S>
void push(const char (&str)[S]) { checkstack(); lua_pushlstring(L, str, S - 1); }
- void push(const char * str, int size = -1) { if (size < 0) size = strlen(str); checkstack(); lua_pushlstring(L, str, size); }
+ void push(const char * str, ssize_t size = -1) { if (size < 0) size = strlen(str); checkstack(); lua_pushlstring(L, str, size); }
void push(void * p) { checkstack(); lua_pushlightuserdata(L, p); }
void push(lua_CFunction f, int n = 0) { checkstack(); lua_pushcclosure(L, f, n); }
void pop(int idx = 1) { lua_pop(L, idx); }
@@ -379,7 +379,7 @@ class LuaHelpers : public LuaHelpersBase {
lua_functypes_t * tab;
bool method;
- caller = L.tonumber(L.upvalue(1));
+ caller = (int) L.tonumber(L.upvalue(1));
proceed = (proceed_t) L.touserdata(L.upvalue(2));
proceed_static = (proceed_static_t) L.touserdata(L.upvalue(3));
tab = (lua_functypes_t *) L.touserdata(L.upvalue(4));
diff --git a/includes/Base64.h b/includes/Base64.h
index 8d0b71d..05f9d36 100644
--- a/includes/Base64.h
+++ b/includes/Base64.h
@@ -7,7 +7,7 @@ namespace Balau {
class Base64 {
public:
static String encode(const uint8_t * data, int len);
- static int decode(const String & str_in, uint8_t * data_out, size_t outLen = static_cast<size_t>(-1));
+ static ssize_t decode(const String & str_in, uint8_t * data_out, size_t outLen = static_cast<size_t>(-1));
static const double ratio;
private: