Loading core/jni/android_graphics_drawable_VectorDrawable.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ static void setPathString(JNIEnv* env, jobject, jlong pathPtr, jstring inputStr, PathParser::ParseResult result; PathParser::ParseResult result; PathData data; PathData data; PathParser::getPathDataFromString(&data, &result, pathString, stringLength); PathParser::getPathDataFromAsciiString(&data, &result, pathString, stringLength); if (result.failureOccurred) { if (result.failureOccurred) { doThrowIAE(env, result.failureMessage.c_str()); doThrowIAE(env, result.failureMessage.c_str()); } } Loading core/jni/android_util_PathParser.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ static void parseStringForPath(JNIEnv* env, jobject, jlong skPathHandle, jstring SkPath* skPath = reinterpret_cast<SkPath*>(skPathHandle); SkPath* skPath = reinterpret_cast<SkPath*>(skPathHandle); PathParser::ParseResult result; PathParser::ParseResult result; PathParser::parseStringForSkPath(skPath, &result, pathString, strLength); PathParser::parseAsciiStringForSkPath(skPath, &result, pathString, strLength); env->ReleaseStringUTFChars(inputPathStr, pathString); env->ReleaseStringUTFChars(inputPathStr, pathString); if (result.failureOccurred) { if (result.failureOccurred) { doThrowIAE(env, result.failureMessage.c_str()); doThrowIAE(env, result.failureMessage.c_str()); Loading @@ -56,7 +56,7 @@ static long createPathDataFromStringPath(JNIEnv* env, jobject, jstring inputStr, const char* pathString = env->GetStringUTFChars(inputStr, NULL); const char* pathString = env->GetStringUTFChars(inputStr, NULL); PathData* pathData = new PathData(); PathData* pathData = new PathData(); PathParser::ParseResult result; PathParser::ParseResult result; PathParser::getPathDataFromString(pathData, &result, pathString, strLength); PathParser::getPathDataFromAsciiString(pathData, &result, pathString, strLength); env->ReleaseStringUTFChars(inputStr, pathString); env->ReleaseStringUTFChars(inputStr, pathString); if (!result.failureOccurred) { if (!result.failureOccurred) { return reinterpret_cast<jlong>(pathData); return reinterpret_cast<jlong>(pathData); Loading libs/hwui/PathParser.cpp +13 −4 Original line number Original line Diff line number Diff line Loading @@ -162,7 +162,7 @@ bool PathParser::isVerbValid(char verb) { || verb == 's' || verb == 't' || verb == 'v' || verb == 'z'; || verb == 's' || verb == 't' || verb == 'v' || verb == 'z'; } } void PathParser::getPathDataFromString(PathData* data, ParseResult* result, void PathParser::getPathDataFromAsciiString(PathData* data, ParseResult* result, const char* pathStr, size_t strLen) { const char* pathStr, size_t strLen) { if (pathStr == NULL) { if (pathStr == NULL) { result->failureOccurred = true; result->failureOccurred = true; Loading @@ -171,7 +171,16 @@ void PathParser::getPathDataFromString(PathData* data, ParseResult* result, } } size_t start = 0; size_t start = 0; size_t end = 1; // Skip leading spaces. while (isspace(pathStr[start]) && start < strLen) { start++; } if (start == strLen) { result->failureOccurred = true; result->failureMessage = "Path string cannot be empty."; return; } size_t end = start + 1; while (end < strLen) { while (end < strLen) { end = nextStart(pathStr, strLen, end); end = nextStart(pathStr, strLen, end); Loading Loading @@ -226,9 +235,9 @@ void PathParser::dump(const PathData& data) { ALOGD("points are : %s", os.str().c_str()); ALOGD("points are : %s", os.str().c_str()); } } void PathParser::parseStringForSkPath(SkPath* skPath, ParseResult* result, const char* pathStr, size_t strLen) { void PathParser::parseAsciiStringForSkPath(SkPath* skPath, ParseResult* result, const char* pathStr, size_t strLen) { PathData pathData; PathData pathData; getPathDataFromString(&pathData, result, pathStr, strLen); getPathDataFromAsciiString(&pathData, result, pathStr, strLen); if (result->failureOccurred) { if (result->failureOccurred) { return; return; } } Loading libs/hwui/PathParser.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -39,9 +39,9 @@ public: /** /** * Parse the string literal and create a Skia Path. Return true on success. * Parse the string literal and create a Skia Path. Return true on success. */ */ ANDROID_API static void parseStringForSkPath(SkPath* outPath, ParseResult* result, ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result, const char* pathStr, size_t strLength); const char* pathStr, size_t strLength); ANDROID_API static void getPathDataFromString(PathData* outData, ParseResult* result, ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result, const char* pathStr, size_t strLength); const char* pathStr, size_t strLength); static void dump(const PathData& data); static void dump(const PathData& data); static bool isVerbValid(char verb); static bool isVerbValid(char verb); Loading libs/hwui/VectorDrawable.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ float Path::getMatrixScale(const SkMatrix& groupStackedMatrix) { Path::Path(const char* pathStr, size_t strLength) { Path::Path(const char* pathStr, size_t strLength) { PathParser::ParseResult result; PathParser::ParseResult result; Data data; Data data; PathParser::getPathDataFromString(&data, &result, pathStr, strLength); PathParser::getPathDataFromAsciiString(&data, &result, pathStr, strLength); mStagingProperties.setData(data); mStagingProperties.setData(data); } } Loading Loading
core/jni/android_graphics_drawable_VectorDrawable.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ static void setPathString(JNIEnv* env, jobject, jlong pathPtr, jstring inputStr, PathParser::ParseResult result; PathParser::ParseResult result; PathData data; PathData data; PathParser::getPathDataFromString(&data, &result, pathString, stringLength); PathParser::getPathDataFromAsciiString(&data, &result, pathString, stringLength); if (result.failureOccurred) { if (result.failureOccurred) { doThrowIAE(env, result.failureMessage.c_str()); doThrowIAE(env, result.failureMessage.c_str()); } } Loading
core/jni/android_util_PathParser.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ static void parseStringForPath(JNIEnv* env, jobject, jlong skPathHandle, jstring SkPath* skPath = reinterpret_cast<SkPath*>(skPathHandle); SkPath* skPath = reinterpret_cast<SkPath*>(skPathHandle); PathParser::ParseResult result; PathParser::ParseResult result; PathParser::parseStringForSkPath(skPath, &result, pathString, strLength); PathParser::parseAsciiStringForSkPath(skPath, &result, pathString, strLength); env->ReleaseStringUTFChars(inputPathStr, pathString); env->ReleaseStringUTFChars(inputPathStr, pathString); if (result.failureOccurred) { if (result.failureOccurred) { doThrowIAE(env, result.failureMessage.c_str()); doThrowIAE(env, result.failureMessage.c_str()); Loading @@ -56,7 +56,7 @@ static long createPathDataFromStringPath(JNIEnv* env, jobject, jstring inputStr, const char* pathString = env->GetStringUTFChars(inputStr, NULL); const char* pathString = env->GetStringUTFChars(inputStr, NULL); PathData* pathData = new PathData(); PathData* pathData = new PathData(); PathParser::ParseResult result; PathParser::ParseResult result; PathParser::getPathDataFromString(pathData, &result, pathString, strLength); PathParser::getPathDataFromAsciiString(pathData, &result, pathString, strLength); env->ReleaseStringUTFChars(inputStr, pathString); env->ReleaseStringUTFChars(inputStr, pathString); if (!result.failureOccurred) { if (!result.failureOccurred) { return reinterpret_cast<jlong>(pathData); return reinterpret_cast<jlong>(pathData); Loading
libs/hwui/PathParser.cpp +13 −4 Original line number Original line Diff line number Diff line Loading @@ -162,7 +162,7 @@ bool PathParser::isVerbValid(char verb) { || verb == 's' || verb == 't' || verb == 'v' || verb == 'z'; || verb == 's' || verb == 't' || verb == 'v' || verb == 'z'; } } void PathParser::getPathDataFromString(PathData* data, ParseResult* result, void PathParser::getPathDataFromAsciiString(PathData* data, ParseResult* result, const char* pathStr, size_t strLen) { const char* pathStr, size_t strLen) { if (pathStr == NULL) { if (pathStr == NULL) { result->failureOccurred = true; result->failureOccurred = true; Loading @@ -171,7 +171,16 @@ void PathParser::getPathDataFromString(PathData* data, ParseResult* result, } } size_t start = 0; size_t start = 0; size_t end = 1; // Skip leading spaces. while (isspace(pathStr[start]) && start < strLen) { start++; } if (start == strLen) { result->failureOccurred = true; result->failureMessage = "Path string cannot be empty."; return; } size_t end = start + 1; while (end < strLen) { while (end < strLen) { end = nextStart(pathStr, strLen, end); end = nextStart(pathStr, strLen, end); Loading Loading @@ -226,9 +235,9 @@ void PathParser::dump(const PathData& data) { ALOGD("points are : %s", os.str().c_str()); ALOGD("points are : %s", os.str().c_str()); } } void PathParser::parseStringForSkPath(SkPath* skPath, ParseResult* result, const char* pathStr, size_t strLen) { void PathParser::parseAsciiStringForSkPath(SkPath* skPath, ParseResult* result, const char* pathStr, size_t strLen) { PathData pathData; PathData pathData; getPathDataFromString(&pathData, result, pathStr, strLen); getPathDataFromAsciiString(&pathData, result, pathStr, strLen); if (result->failureOccurred) { if (result->failureOccurred) { return; return; } } Loading
libs/hwui/PathParser.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -39,9 +39,9 @@ public: /** /** * Parse the string literal and create a Skia Path. Return true on success. * Parse the string literal and create a Skia Path. Return true on success. */ */ ANDROID_API static void parseStringForSkPath(SkPath* outPath, ParseResult* result, ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result, const char* pathStr, size_t strLength); const char* pathStr, size_t strLength); ANDROID_API static void getPathDataFromString(PathData* outData, ParseResult* result, ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result, const char* pathStr, size_t strLength); const char* pathStr, size_t strLength); static void dump(const PathData& data); static void dump(const PathData& data); static bool isVerbValid(char verb); static bool isVerbValid(char verb); Loading
libs/hwui/VectorDrawable.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ float Path::getMatrixScale(const SkMatrix& groupStackedMatrix) { Path::Path(const char* pathStr, size_t strLength) { Path::Path(const char* pathStr, size_t strLength) { PathParser::ParseResult result; PathParser::ParseResult result; Data data; Data data; PathParser::getPathDataFromString(&data, &result, pathStr, strLength); PathParser::getPathDataFromAsciiString(&data, &result, pathStr, strLength); mStagingProperties.setData(data); mStagingProperties.setData(data); } } Loading