Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63dde9c8 authored by Yang Ni's avatar Yang Ni Committed by Gerrit Code Review
Browse files

Merge "Fix value size data type in closure creation."

parents 5960c3d5 4c93c8c9
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ you will need approval.
public class ScriptGroup2 extends BaseObj {

    public static class Closure extends BaseObj {
        private Object[] mArgs;
        private Allocation mReturnValue;
        private Map<Script.FieldID, Object> mBindings;

@@ -62,8 +63,9 @@ public class ScriptGroup2 extends BaseObj {
                       Object[] args, Map<Script.FieldID, Object> globals) {
            super(0, rs);

            mArgs = args;
            mReturnValue = Allocation.createTyped(rs, returnType);
            mBindings = new HashMap<Script.FieldID, Object>();
            mBindings = globals;
            mGlobalFuture = new HashMap<Script.FieldID, Future>();

            int numValues = args.length + globals.size();
@@ -112,7 +114,8 @@ public class ScriptGroup2 extends BaseObj {
            super(0, rs);
            mFP = FieldPacker.createFieldPack(args);

            mBindings = new HashMap<Script.FieldID, Object>();
            mArgs = args;
            mBindings = globals;
            mGlobalFuture = new HashMap<Script.FieldID, Future>();

            int numValues = globals.size();
@@ -198,11 +201,13 @@ public class ScriptGroup2 extends BaseObj {
        }

        void setArg(int index, Object obj) {
            mArgs[index] = obj;
            ValueAndSize vs = new ValueAndSize(mRS, obj);
            mRS.nClosureSetArg(getID(mRS), index, vs.value, vs.size);
        }

        void setGlobal(Script.FieldID fieldID, Object obj) {
            mBindings.put(fieldID, obj);
            ValueAndSize vs = new ValueAndSize(mRS, obj);
            mRS.nClosureSetGlobal(getID(mRS), fieldID.getID(mRS), vs.value, vs.size);
        }
+2 −2
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID,
  return (jlong)(uintptr_t)rsClosureCreate(
      (RsContext)con, (RsScriptKernelID)kernelID, (RsAllocation)returnValue,
      fieldIDs, (size_t)fieldIDs_length, values, (size_t)values_length,
      (size_t*)sizes, (size_t)sizes_length,
      (int*)sizes, (size_t)sizes_length,
      depClosures, (size_t)depClosures_length,
      depFieldIDs, (size_t)depFieldIDs_length);
}
@@ -405,7 +405,7 @@ nInvokeClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong invokeID,
  return (jlong)(uintptr_t)rsInvokeClosureCreate(
      (RsContext)con, (RsScriptInvokeID)invokeID, jParams, jParamLength,
      fieldIDs, (size_t)fieldIDs_length, values, (size_t)values_length,
      (size_t*)sizes, (size_t)sizes_length);
      (int*)sizes, (size_t)sizes_length);
}

static void