Changeset 18978 for trunk/FACT++


Ignore:
Timestamp:
04/05/18 19:00:31 (7 years ago)
Author:
tbretz
Message:
clang++ complained about the way some arrays are initialized and there were two mistakes in conditionals -- unfortunately, this is not trivial to check, but it should also be of no relevance.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/InterpreterV8.cc

    r18840 r18978  
    1313
    1414#ifdef HAVE_NOVA
    15 #include "externals/nova.h"
     15#include "nova.h"
    1616#endif
    1717
     
    2525#include "tools.h"
    2626#include "Readline.h"
    27 #include "externals/izstream.h"
     27#include "izstream.h"
    2828
    2929#include "WindowLog.h"
     
    157157    const int nn = args.Length()==2 ? 0 : args.Length()-3;
    158158
    159     Handle<Value> argv[nn];
     159    vector<Handle<Value>> argv(nn);
    160160    for (int i=0; i<nn; i++)
    161161        argv[i] = args[i+3];
     
    164164    while (1)
    165165    {
    166         const Handle<Value> rc = args.Length()<3 ? func->Call(func, nn, argv) : func->Call(args[2]->ToObject(), nn, argv);
     166        const Handle<Value> rc = args.Length()<3 ?
     167            func->Call(func, nn, argv.data()) :
     168            func->Call(args[2]->ToObject(), nn, argv.data());
     169
    167170        if (rc.IsEmpty())
    168171            return Undefined();
     
    628631    string arg0 = args.Length() ? *String::AsciiValue(args[0]) : "";
    629632    if (arg0=="*")
    630         arg0=="";
     633        arg0="";
    631634
    632635    const set<Service> services = JsGetServices();
     
    11871190        return ThrowException(String::New(e.what()));
    11881191    }
     1192#else
     1193    return Undefined();
    11891194#endif
    11901195}
     
    12271232        return ThrowException(String::New(e.what()));
    12281233    }
     1234#else
     1235    return Undefined();
    12291236#endif
    12301237}
     
    21992206    obj->Set(String::New("observatory"), String::New(args.obs.c_str()), ReadOnly);
    22002207
    2201     const bool isUp = rc>0 ||
     2208    const bool isUp =
    22022209        (rst.rise<rst.set && (args.jd>rst.rise && args.jd<rst.set)) ||
    22032210        (rst.rise>rst.set && (args.jd<rst.set  || args.jd>rst.rise));
    22042211
    2205     obj->Set(String::New("isUp"), Boolean::New(rc>=0 && isUp), ReadOnly);
    2206 
    2207     if (rc!=0)
     2212    obj->Set(String::New("isUp"), Boolean::New(isUp), ReadOnly);
     2213
     2214    if (!rc) // circumpolar
    22082215        return obj;
    22092216
     
    22612268
    22622269    ln_rst_time sun;
    2263     const int rc = ln_get_solar_rst_horizon(local.jd-0.5, &local.posn, hrz, &sun);
     2270    const bool rc = ln_get_solar_rst_horizon(local.jd-0.5, &local.posn, hrz, &sun)==0;
    22642271    Handle<Object> rst = ConstructRiseSet(local, sun, rc);
    22652272    rst->Set(String::New("horizon"), Number::New(hrz));
     
    22822289
    22832290    ln_rst_time moon;
    2284     const int rc = ln_get_lunar_rst(local.jd-0.5, &local.posn, &moon);
     2291    const bool rc = ln_get_lunar_rst(local.jd-0.5, &local.posn, &moon)==0;
    22852292    Handle<Object> rst = ConstructRiseSet(local, moon, rc);
    22862293    return handle_scope.Close(rst);
     
    25512558Handle<Value> InterpreterV8::Constructor(/*Handle<FunctionTemplate> T,*/ const Arguments &args)
    25522559{
    2553     Handle<Value> argv[args.Length()];
     2560    vector<Handle<Value>> argv(args.Length());
    25542561
    25552562    for (int i=0; i<args.Length(); i++)
    25562563        argv[i] = args[i];
    25572564
    2558     return args.Callee()->NewInstance(args.Length(), argv);
     2565    return args.Callee()->NewInstance(args.Length(), argv.data());
    25592566}
    25602567
Note: See TracChangeset for help on using the changeset viewer.