Index: cpp/frams/util/callbacks.cpp
===================================================================
--- cpp/frams/util/callbacks.cpp	(revision 228)
+++ cpp/frams/util/callbacks.cpp	(revision 247)
@@ -61,5 +61,5 @@
 }
 
-void Callback::action(long data)
+void Callback::action(intptr_t data)
 {
 if (size()==0) return;
Index: cpp/frams/util/callbacks.h
===================================================================
--- cpp/frams/util/callbacks.h	(revision 228)
+++ cpp/frams/util/callbacks.h	(revision 247)
@@ -8,4 +8,5 @@
 #include "list.h"
 #include "statrick.h"
+#include <stdint.h>
 
 //#define USEMEMBERCALLBACK
@@ -15,5 +16,5 @@
 public:
 virtual ~CallbackNode() {}
-virtual void action(long calldata)=0;
+virtual void action(intptr_t calldata)=0;
 virtual int equals(CallbackNode*n) {return (this==n);}
 };
@@ -25,11 +26,11 @@
 void *userdata;
 CallBase *object;
-void (CallBase::*member)(void*,long);
+void (CallBase::*member)(void*,intptr_t);
   public:
-MemberCallbackNode(CallBase *o,void (CallBase::*m)(void*,long),void *d):object(o),member(m),userdata(d) {}
-void action(long calldata) {(object->*member)(userdata,calldata);}
+MemberCallbackNode(CallBase *o,void (CallBase::*m)(void*,intptr_t),void *d):object(o),member(m),userdata(d) {}
+void action(intptr_t calldata) {(object->*member)(userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define MEMBERCALLBACK(obj,mem,dat) new MemberCallbackNode((CallBase*)(obj),(void (CallBase::*)(void*,long))(mem),(void*)(dat))
+#define MEMBERCALLBACK(obj,mem,dat) new MemberCallbackNode((CallBase*)(obj),(void (CallBase::*)(void*,intptr_t))(mem),(void*)(dat))
 #endif
 
@@ -37,11 +38,11 @@
 {
 void *userdata;
-void (*fun)(void*,long);
+void (*fun)(void*,intptr_t);
   public:
-FunctionCallbackNode(void (*f)(void*,long),void *d):userdata(d),fun(f) {}
-void action(long calldata) {(*fun)(userdata,calldata);}
+FunctionCallbackNode(void (*f)(void*,intptr_t),void *d):userdata(d),fun(f) {}
+void action(intptr_t calldata) {(*fun)(userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define FUNCTIONCALLBACK(fun,dat) new FunctionCallbackNode((void (*)(void*,long))(fun),(void*)(dat))
+#define FUNCTIONCALLBACK(fun,dat) new FunctionCallbackNode((void (*)(void*,intptr_t))(fun),(void*)(dat))
 
 class StatrickCallbackNode :public CallbackNode
@@ -49,11 +50,11 @@
 void *object;
 void *userdata;
-void (*fun)(void*,void*,long);
+void (*fun)(void*,void*,intptr_t);
   public:
-StatrickCallbackNode(void *o,void (*f)(void*,void*,long),void *d):object(o),userdata(d),fun(f) {}
-void action(long calldata) {(*fun)(object,userdata,calldata);}
+StatrickCallbackNode(void *o,void (*f)(void*,void*,intptr_t),void *d):object(o),userdata(d),fun(f) {}
+void action(intptr_t calldata) {(*fun)(object,userdata,calldata);}
 int equals(CallbackNode*);
 };
-#define STATRICKCALLBACK(obj,name,dat) new StatrickCallbackNode((void*)(obj),(void (*)(void*,void*,long))STATRICKNAME(name),(void*)(dat))
+#define STATRICKCALLBACK(obj,name,dat) new StatrickCallbackNode((void*)(obj),(void (*)(void*,void*,intptr_t))STATRICKNAME(name),(void*)(dat))
 
 /**
@@ -61,6 +62,6 @@
       add(Function* fun, void* anydata)
    'fun' will be called with your pointer as the first argument (void*)
-   and event specific value as the second argument (long)
-      fun(void* anydata,long eventdata)
+   and event specific value as the second argument (intptr_t)
+      fun(void* anydata,intptr_t eventdata)
 
    'StatrickCallbackNode' uses static functions to emulate object member calls.
@@ -81,13 +82,13 @@
 ~Callback();
 CallbackNode* add(CallbackNode*n);
-CallbackNode* add(void (*f)(void*,long),void *d)
+CallbackNode* add(void (*f)(void*,intptr_t),void *d)
 	{return add(new FunctionCallbackNode(f,d));}
-void remove(void (*f)(void*,long),void *d)
+void remove(void (*f)(void*,intptr_t),void *d)
 	{remove(new FunctionCallbackNode(f,d));}
 void remove(CallbackNode*n);
 void removeNode(CallbackNode*n);
-void operator+=(void* fun) {add((void (*)(void*,long))fun,0);}
-void operator-=(void* fun) {remove((void (*)(void*,long))fun,0);}
-void action(long data);
+void operator+=(void* fun) {add((void (*)(void*,intptr_t))fun,0);}
+void operator-=(void* fun) {remove((void (*)(void*,intptr_t))fun,0);}
+void action(intptr_t data);
 void action() {action(0);}
 int size() {return SList::size();}
@@ -97,11 +98,11 @@
 ///////////////////
 
-#define STCALLBACKDEF(name) STATRICKDEF2(name,void*,long)
-#define STCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,long)  \
-	void name(void* arg1,long arg2)
-#define VIRTCALLBACKDEF(name) STATRICKSTUB2(STATRICKCLASS,name,void*,long)  \
-	virtual void name(void* arg1,long arg2)
-#define VIRTCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,long)  \
-	virtual void name(void* arg1,long arg2)
+#define STCALLBACKDEF(name) STATRICKDEF2(name,void*,intptr_t)
+#define STCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,intptr_t)  \
+	void name(void* arg1,intptr_t arg2)
+#define VIRTCALLBACKDEF(name) STATRICKSTUB2(STATRICKCLASS,name,void*,intptr_t)  \
+	virtual void name(void* arg1,intptr_t arg2)
+#define VIRTCALLBACKDEFC(cls,name) STATRICKSTUB2(cls,name,void*,intptr_t)  \
+	virtual void name(void* arg1,intptr_t arg2)
 
 /* STCALLBACKDEFC(Class,name)
@@ -115,5 +116,5 @@
  */
 
-#define CALLBACKARGS void* arg1,long arg2
+#define CALLBACKARGS void* arg1,intptr_t arg2
 
 #endif
Index: cpp/frams/util/extvalue.cpp
===================================================================
--- cpp/frams/util/extvalue.cpp	(revision 228)
+++ cpp/frams/util/extvalue.cpp	(revision 247)
@@ -281,5 +281,5 @@
 }
 
-static long longsign(long x)
+static int longsign(paInt x)
 {
 if (x<0) return -1;
@@ -288,5 +288,5 @@
 }
 
-static long compareNull(const ExtValue& v)
+static int compareNull(const ExtValue& v)
 {
 switch(v.type)
@@ -299,9 +299,9 @@
 }
 
-long ExtValue::compare(const ExtValue& src) const
-{
-if (type==TUnknown)
+int ExtValue::compare(const ExtValue& src) const
+{
+if (isNull())
 	return compareNull(src);
-else if (src.type==TUnknown)
+else if (src.isNull())
 	return compareNull(*this);
 switch(type)
@@ -309,5 +309,5 @@
 	case TInt:
 	{
-	long t=src.getInt();
+	paInt t=src.getInt();
 	if (idata()>0)
 		{if (t>0) return longsign(idata()-t); else return +1;}
@@ -545,8 +545,8 @@
 	if (args.finished() && (type!=0) && (type!='%'))
 		{
-		ret+=fmt.substr(curr-begin);
+		ret+=fmt.substr((int)(curr-begin));
 		break;
 		}
-	SString sub=fmt.substr(curr-begin,next-curr);
+	SString sub=fmt.substr((int)(curr-begin),(int)(next-curr));
 	switch(type)
 		{
@@ -601,9 +601,9 @@
 }
 
-long ExtValue::getInt(const char* s)
+paInt ExtValue::getInt(const char* s)
 {
 if ((s[0]=='0')&&(s[1]=='x'))
 	{
-	long val;
+	paInt val;
 	sscanf(s+2,"%lx",&val);
 	return val;
@@ -612,7 +612,7 @@
 	{
 	if (strchr(s,'e')||(strchr(s,'E')))
-		return (long)atof(s);
+		return (paInt)atof(s);
 	else
-		return atol(s);
+		return atoi(s);
 	}
 }
@@ -622,5 +622,5 @@
 if ((s[0]=='0')&&(s[1]=='x'))
 	{
-	long val;
+	paInt val;
 	sscanf(s+2,"%lx",&val);
 	return val;
@@ -630,5 +630,5 @@
 }
 
-long ExtValue::getInt() const
+paInt ExtValue::getInt() const
 {
 switch(type)
@@ -639,5 +639,5 @@
 	case TObj:
 		FMprintf("ExtValue","getInt",FMLV_WARN,"Getting integer value from object reference (%s)",(const char*)getString());
-		return (long)odata().param;
+		return (paInt)(intptr_t)odata().param;
 	default:;
 	}
@@ -654,5 +654,5 @@
 	case TObj:
 		FMprintf("ExtValue","getDouble",FMLV_WARN,"Getting floating point value from object reference (%s)",(const char*)getString());
-		return (double)(long)odata().param;
+		return (double)(intptr_t)odata().param;
 	default:;
 	}
@@ -732,5 +732,5 @@
 	else
 		{
-		setInt(atol(in));
+		setInt(atoi(in));
 		return p;
 		}
@@ -769,5 +769,5 @@
 	{
 	ret=skipQuoteString(in+1,NULL);
-	SString s(in+1,ret-(in+1));
+	SString s(in+1,(int)(ret-(in+1)));
 	sstringUnquote(s);
 	setString(s);
@@ -864,5 +864,5 @@
 else if ((ret=skipWord(in))&&(ret!=in))
 	{
-	SString clsname(in,ret-in);
+	SString clsname(in,(int)(ret-in));
 	ExtValue tmp;
 	ret=tmp.deserialize(ret);
@@ -929,5 +929,5 @@
 ExtValue ExtValue::getExtType()
 {
-if (getType()!=TObj) return ExtValue((long)getType());
+if (getType()!=TObj) return ExtValue((paInt)getType());
 ExtObject& o=odata();
 return ExtValue(SString(o.isEmpty()?"":o.interfaceName()));
Index: cpp/frams/util/extvalue.h
===================================================================
--- cpp/frams/util/extvalue.h	(revision 228)
+++ cpp/frams/util/extvalue.h	(revision 247)
@@ -101,5 +101,5 @@
 #ifdef EXTVALUEUNION
 long data[(EXTVALUEUNIONSIZE+sizeof(long)-1)/sizeof(long)];
-long& idata() const {return (long&)data[0];};
+paInt& idata() const {return (paInt&)data[0];};
 double& ddata() const {return *(double*)data;};
 ExtObject& odata() const {return *(ExtObject*)data;};
@@ -107,10 +107,10 @@
 #else
 union {
-long i;
+paInt i;
 double d;
 SString *s;
 ExtObject *o;
 };
-long& idata() const {return (long&)i;};
+paInt& idata() const {return (paInt&)i;};
 double& ddata() const {return (double&)d;};
 ExtObject& odata() const {return *o;};
@@ -123,10 +123,10 @@
 ExtValue():type(TUnknown){}
 ~ExtValue() {setEmpty();}
-ExtValue(long v) {seti(v);}
+ExtValue(paInt v) {seti(v);}
 ExtValue(double v) {setd(v);}
 ExtValue(const SString &v) {sets(v);}
 ExtValue(const ExtObject &srco) {seto(srco);}
 static ExtValue invalid() {ExtValue v; v.setInvalid(); return v;}
-long compare(const ExtValue& src) const;
+int compare(const ExtValue& src) const;
 int operator==(const ExtValue& src) const;
 void operator+=(const ExtValue& src);
@@ -144,11 +144,11 @@
 ExtPType getType() {return type;}
 void *getObjectTarget(const char* classname,bool warn=true) const;
-void setInt(long v) {if (type!=TInt) setri(v); else idata()=v;}
+void setInt(paInt v) {if (type!=TInt) setri(v); else idata()=v;}
 void setDouble(double v) {if (type!=TDouble) setrd(v); else ddata()=v;}
 void setString(const SString &v) {if (type!=TString) setrs(v); else sdata()=v;}
 void setObject(const ExtObject &src) {if (type!=TObj) setro(src); else odata()=src;}
-static long getInt(const char* s);
+static paInt getInt(const char* s);
 static double getDouble(const char* s);
-long getInt() const;
+paInt getInt() const;
 double getDouble() const;
 SString getString() const;
@@ -176,7 +176,7 @@
 void setr(const ExtValue& src){setEmpty();set(src);}
 void set(const ExtValue& src);
-void setri(long v) {setEmpty();seti(v);}
+void setri(paInt v) {setEmpty();seti(v);}
 void setrd(double v) {setEmpty();setd(v);}
-void seti(long v) {type=TInt;idata()=v;}
+void seti(paInt v) {type=TInt;idata()=v;}
 void setd(double v) {type=TDouble;ddata()=v;}
 #ifdef EXTVALUEUNION
Index: cpp/frams/util/hashtable.h
===================================================================
--- cpp/frams/util/hashtable.h	(revision 228)
+++ cpp/frams/util/hashtable.h	(revision 247)
@@ -29,5 +29,5 @@
 int threshold;
 float load;
-long sync;
+int sync;
 
 int hash(const SString &s);
Index: cpp/frams/util/list.h
===================================================================
--- cpp/frams/util/list.h	(revision 228)
+++ cpp/frams/util/list.h	(revision 247)
@@ -55,5 +55,5 @@
 public:
 
-SListTempl(const SListTempl<T>& src):have(0),used(0),mem(0),pos(0)
+SListTempl(const SListTempl<T>& src):have(0),used(0),pos(0),mem(0)
 	{(*this)=src;}
 SListTempl():have(0),used(0),pos(0),mem(0)
Index: cpp/frams/util/rndutil.cpp
===================================================================
--- cpp/frams/util/rndutil.cpp	(revision 228)
+++ cpp/frams/util/rndutil.cpp	(revision 247)
@@ -5,10 +5,11 @@
 #include "rndutil.h"
 #include <common/nonstd_math.h>
+#include <cstdint>
 #include <stdlib.h>
 
 unsigned short pseudornd(short x)
 {
-	static long seed = 0;
-	long y;
+	static int32_t seed = 0;
+	int32_t y;
 	if (x <= 0) { seed = -x; return 0; }
 	seed = (y = (3677 * seed + 3680) & 0x7fffffff) - 1;
Index: cpp/frams/util/sstring.cpp
===================================================================
--- cpp/frams/util/sstring.cpp	(revision 228)
+++ cpp/frams/util/sstring.cpp	(revision 247)
@@ -113,5 +113,5 @@
 // to be moved somewhere else?
 // public domain source: http://isthe.com/chongo/src/fnv
-typedef unsigned long Fnv32_t;
+typedef uint32_t Fnv32_t;
 
 #define FNV_32_PRIME ((Fnv32_t)0x01000193)
@@ -143,5 +143,5 @@
 //////////////////////////////////////////////////
 
-unsigned long SBuf::hash() const
+uint32_t SBuf::hash() const
 {
 return fnv_32a_buf(txt,used,FNV1_32A_INIT);
@@ -339,8 +339,8 @@
 ///////////////////////////////////////
 
-int SString::equals(const SString& s) const
-{
-if (s.buf==buf) return 1;
-return !strcmp(buf->txt,s.buf->txt);
+bool SString::equals(const SString& s) const
+{
+if (s.buf==buf) return true;
+return strcmp(buf->txt,s.buf->txt)==0;
 }
 
Index: cpp/frams/util/sstring.h
===================================================================
--- cpp/frams/util/sstring.h	(revision 228)
+++ cpp/frams/util/sstring.h	(revision 247)
@@ -22,4 +22,5 @@
 // - mutex required to be thread safe
 
+#include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
@@ -47,5 +48,5 @@
 SBuf();
 ~SBuf();
-unsigned long hash() const; // 32-bit FNV-1 hash -> http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash
+uint32_t hash() const; // 32-bit FNV-1 hash -> http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash
 };
 
@@ -155,7 +156,7 @@
 void operator+=(const SString&); ///< append other SString
 
-int equals(const SString &s) const; ///< TRUE if equal
-int operator==(const SString &s) const {return equals(s);} ///< TRUE if equal
-int operator!=(const SString &s) const {return !equals(s);}
+bool equals(const SString &s) const; ///< TRUE if equal
+bool operator==(const SString &s) const {return equals(s);} ///< TRUE if equal
+bool operator!=(const SString &s) const {return !equals(s);}
 const char* operator()(int p) const {return buf->txt+p;} ///< pointer to p'th character in SString
 char operator[](int i) const {return buf->txt[i];} ///< get char like in array
@@ -175,5 +176,5 @@
 int startsWith(const char *pattern) const;
 char charAt(int pos) const {return buf->txt[pos];}
-unsigned long hash() const {return buf->hash();}
+uint32_t hash() const {return buf->hash();}
 
 static SString valueOf(int);
