Ignore:
Timestamp:
11/07/14 17:51:01 (9 years ago)
Author:
Maciej Komosinski
Message:

Sources support both 32-bit and 64-bit, and more compilers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.cpp

    r228 r247  
    281281}
    282282
    283 static long longsign(long x)
     283static int longsign(paInt x)
    284284{
    285285if (x<0) return -1;
     
    288288}
    289289
    290 static long compareNull(const ExtValue& v)
     290static int compareNull(const ExtValue& v)
    291291{
    292292switch(v.type)
     
    299299}
    300300
    301 long ExtValue::compare(const ExtValue& src) const
    302 {
    303 if (type==TUnknown)
     301int ExtValue::compare(const ExtValue& src) const
     302{
     303if (isNull())
    304304        return compareNull(src);
    305 else if (src.type==TUnknown)
     305else if (src.isNull())
    306306        return compareNull(*this);
    307307switch(type)
     
    309309        case TInt:
    310310        {
    311         long t=src.getInt();
     311        paInt t=src.getInt();
    312312        if (idata()>0)
    313313                {if (t>0) return longsign(idata()-t); else return +1;}
     
    545545        if (args.finished() && (type!=0) && (type!='%'))
    546546                {
    547                 ret+=fmt.substr(curr-begin);
     547                ret+=fmt.substr((int)(curr-begin));
    548548                break;
    549549                }
    550         SString sub=fmt.substr(curr-begin,next-curr);
     550        SString sub=fmt.substr((int)(curr-begin),(int)(next-curr));
    551551        switch(type)
    552552                {
     
    601601}
    602602
    603 long ExtValue::getInt(const char* s)
     603paInt ExtValue::getInt(const char* s)
    604604{
    605605if ((s[0]=='0')&&(s[1]=='x'))
    606606        {
    607         long val;
     607        paInt val;
    608608        sscanf(s+2,"%lx",&val);
    609609        return val;
     
    612612        {
    613613        if (strchr(s,'e')||(strchr(s,'E')))
    614                 return (long)atof(s);
     614                return (paInt)atof(s);
    615615        else
    616                 return atol(s);
     616                return atoi(s);
    617617        }
    618618}
     
    622622if ((s[0]=='0')&&(s[1]=='x'))
    623623        {
    624         long val;
     624        paInt val;
    625625        sscanf(s+2,"%lx",&val);
    626626        return val;
     
    630630}
    631631
    632 long ExtValue::getInt() const
     632paInt ExtValue::getInt() const
    633633{
    634634switch(type)
     
    639639        case TObj:
    640640                FMprintf("ExtValue","getInt",FMLV_WARN,"Getting integer value from object reference (%s)",(const char*)getString());
    641                 return (long)odata().param;
     641                return (paInt)(intptr_t)odata().param;
    642642        default:;
    643643        }
     
    654654        case TObj:
    655655                FMprintf("ExtValue","getDouble",FMLV_WARN,"Getting floating point value from object reference (%s)",(const char*)getString());
    656                 return (double)(long)odata().param;
     656                return (double)(intptr_t)odata().param;
    657657        default:;
    658658        }
     
    732732        else
    733733                {
    734                 setInt(atol(in));
     734                setInt(atoi(in));
    735735                return p;
    736736                }
     
    769769        {
    770770        ret=skipQuoteString(in+1,NULL);
    771         SString s(in+1,ret-(in+1));
     771        SString s(in+1,(int)(ret-(in+1)));
    772772        sstringUnquote(s);
    773773        setString(s);
     
    864864else if ((ret=skipWord(in))&&(ret!=in))
    865865        {
    866         SString clsname(in,ret-in);
     866        SString clsname(in,(int)(ret-in));
    867867        ExtValue tmp;
    868868        ret=tmp.deserialize(ret);
     
    929929ExtValue ExtValue::getExtType()
    930930{
    931 if (getType()!=TObj) return ExtValue((long)getType());
     931if (getType()!=TObj) return ExtValue((paInt)getType());
    932932ExtObject& o=odata();
    933933return ExtValue(SString(o.isEmpty()?"":o.interfaceName()));
Note: See TracChangeset for help on using the changeset viewer.