Skip to content

Commit 5603b05

Browse files
committed
refactor: format code
1 parent 5809dbd commit 5603b05

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

dart_native/android/src/main/jni/dart_native.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ extern "C"
2222
static jclass gStrCls;
2323

2424
/// key is jobject, value is pai which contain jclass and reference count
25-
static std::map<jobject, std::pair<jclass, int>> objectGlobalReference;
25+
static std::map<jobject, std::pair<jclass, int> > objectGlobalReference;
2626

27-
void _addGlobalObject(jobject globalObject, jclass globalClass) {
27+
void _addGlobalObject(jobject globalObject, jclass globalClass)
28+
{
2829
std::pair<jclass, int> objPair = std::make_pair(globalClass, 0);
2930
objectGlobalReference[globalObject] = objPair;
3031
}
3132

32-
jclass _getGlobalClass(jobject globalObject) {
33-
if (objectGlobalReference.find(globalObject) != objectGlobalReference.end()) {
33+
jclass _getGlobalClass(jobject globalObject)
34+
{
35+
if (objectGlobalReference.find(globalObject) != objectGlobalReference.end())
36+
{
3437
std::pair<jclass, int> objPair = objectGlobalReference[globalObject];
3538
return objPair.first;
3639
}
@@ -225,7 +228,7 @@ extern "C"
225228
{
226229
/// mark the last pointer as string
227230
/// dart will check this pointer
228-
dataTypes[argumentCount] = (char *) "java.lang.String";
231+
dataTypes[argumentCount] = (char *)"java.lang.String";
229232
nativeInvokeResult = convertToDartUtf16(env, (jstring)obj);
230233
}
231234
else
@@ -280,7 +283,8 @@ extern "C"
280283
}
281284

282285
/// reference counter
283-
void _updateObjectReference(jobject globalObject, bool isRetain) {
286+
void _updateObjectReference(jobject globalObject, bool isRetain)
287+
{
284288
DNDebug("_updateObjectReference %s", isRetain ? "retain" : "release");
285289
auto it = objectGlobalReference.find(globalObject);
286290
if (it == objectGlobalReference.end())
@@ -386,7 +390,7 @@ extern "C"
386390

387391
if (strcmp(dataTypes[i], "java.lang.String") == 0)
388392
{
389-
arguments[i] = (jstring) argument == nullptr ? reinterpret_cast<uint16_t *>((char *)"")
393+
arguments[i] = (jstring)argument == nullptr ? reinterpret_cast<uint16_t *>((char *)"")
390394
: convertToDartUtf16(env, (jstring)argument);
391395
}
392396
else
@@ -414,7 +418,7 @@ extern "C"
414418

415419
const Work work = [dartObjectAddress, dataTypes, arguments, argumentCount, funName, &sem, isSemInitSuccess]() {
416420
NativeMethodCallback methodCallback = getCallbackMethod(dartObjectAddress, funName);
417-
void *target = (void *) dartObjectAddress;
421+
void *target = (void *)dartObjectAddress;
418422
if (methodCallback != nullptr && target != nullptr)
419423
{
420424
methodCallback(target, funName, arguments, dataTypes, argumentCount);
@@ -440,7 +444,7 @@ extern "C"
440444
}
441445
else
442446
{
443-
callbackResult = (jobject) arguments[argumentCount];
447+
callbackResult = (jobject)arguments[argumentCount];
444448
}
445449
}
446450
sem_destroy(&sem);

0 commit comments

Comments
 (0)