Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: platform_tools/android/app/jni/com_skia_SkiaIntentService.cpp

Issue 22617002: Update Skia Android tools. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: more fixes to make the bots happy Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #include "com_skia_SkiaIntentService.h"
2
3 #include <stdint.h>
4 #include <stdio.h>
5
6 extern int main(int argc, char * const argv[]);
7
8 void cleanUp(JNIEnv* env, jobjectArray jstrs, const char** strs, int32_t count) {
9 for (int32_t i = 0; i < count; ++i)
10 env->ReleaseStringUTFChars(
11 (jstring) env->GetObjectArrayElement(jstrs, i), strs[i]);
12 }
13
14 JNIEXPORT jint JNICALL Java_com_skia_SkiaIntentService_run(
15 JNIEnv* env,
16 jobject,
17 jobjectArray args) {
18
19 // Convert command line arguments to C format.
20 int argc = env->GetArrayLength(args);
21 const char** argv = new const char*[argc];
22 for (int32_t i = 0; i < argc; ++i) {
23 jstring str = (jstring) env->GetObjectArrayElement(args, i);
24 argv[i] = env->GetStringUTFChars(str, NULL);
25 if (NULL == argv[i]) {
26 cleanUp(env, args, argv, i - 1);
27 return 1;
28 }
29 }
30
31 // Execute program main()
32 int retval = main(argc, (char* const*) argv);
33
34 // Clean up temporaries and return the exit code.
35 cleanUp(env, args, argv, argc);
36 delete[] argv;
37 return retval;
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698