diff --git a/OsmAnd/jni/osmand/binaryRead.cpp b/OsmAnd/jni/osmand/binaryRead.cpp index 7d2099ccf9..3530f37cb0 100644 --- a/OsmAnd/jni/osmand/binaryRead.cpp +++ b/OsmAnd/jni/osmand/binaryRead.cpp @@ -17,7 +17,6 @@ #include "multipolygons.h" #include "proto/osmand_odb.pb.h" -char errorMsg[1024]; #define INT_MAX 0x7fffffff /* max value for an int */ #define DO_(EXPRESSION) if (!(EXPRESSION)) return false using namespace google::protobuf; @@ -347,8 +346,7 @@ bool initMapStructure(io::CodedInputStream* input, BinaryMapFile* file) { } } if (version != versionConfirm) { - __android_log_print(ANDROID_LOG_WARN, "net.osmand", - "Corrupted file. It should be ended as it starts with version"); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Corrupted file. It should be ended as it starts with version"); return false; } return true; @@ -746,9 +744,8 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar proccessMultiPolygons(multyPolygons, q.left, q.right, q.bottom, q.top, q.zoom, result->result); if(q.result.size() > 0) { - sprintf(errorMsg, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees, - q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size()); - __android_log_print(ANDROID_LOG_INFO, "net.osmand", errorMsg); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees, + q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size()); } delete req; return (jint)result; @@ -771,8 +768,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLi FILE* file = fopen(inputName.c_str(), "r"); if (file == NULL) { - sprintf(errorMsg, "File could not be open to read from C : %s", inputName.c_str()); - __android_log_print(ANDROID_LOG_WARN, "net.osmand", errorMsg); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "File could not be open to read from C : %s", inputName.c_str()); return false; } BinaryMapFile* mapFile = new BinaryMapFile(); @@ -782,8 +778,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLi io::CodedInputStream cis(&input); cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2); if (!initMapStructure(&cis, mapFile)) { - sprintf(errorMsg, "File not initialised : %s", inputName.c_str()); - __android_log_print(ANDROID_LOG_WARN, "net.osmand", errorMsg); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "File not initialised : %s", inputName.c_str()); delete mapFile; return false; } diff --git a/OsmAnd/jni/osmand/multipolygons.h b/OsmAnd/jni/osmand/multipolygons.h index 992b8609bc..750ac7b191 100644 --- a/OsmAnd/jni/osmand/multipolygons.h +++ b/OsmAnd/jni/osmand/multipolygons.h @@ -13,7 +13,6 @@ #define INT_MAX 0x7fffffff /* max value for an int */ #define INT_MIN (-0x7fffffff-1) /* min value for an int */ -char textMsg[1024] ; struct tagValueType { int type; std::string tag; @@ -118,7 +117,7 @@ MultiPolygonObject* processMultiPolygon(int leftX, int rightX, int bottomY, int whole.push_back(int_pair(leftX, bottomY)); whole.push_back(int_pair(rightX, bottomY)); completedRings.push_back(whole); - __android_log_print(ANDROID_LOG_INFO, "net.osmand", "!!! Isolated island !!!"); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "!!! Isolated island !!!"); } } @@ -161,14 +160,13 @@ void proccessMultiPolygons(std::map >& completedRingNames.clear(); incompletedRingNames.clear(); - sprintf(textMsg, "Process multipolygon %s %s direct list %d rev %d", val->first.tag.c_str(), val->first.value.c_str(), directList->size(), inverselist->size()); - __android_log_print(ANDROID_LOG_INFO, "net.osmand", textMsg); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Process multipolygon %s %s direct list %d rev %d", val->first.tag.c_str(), val->first.value.c_str(), directList->size(), inverselist->size()); MultiPolygonObject* pl = processMultiPolygon(leftX, rightX, bottomY, topY, completedRings, incompletedRings, completedRingNames, incompletedRingNames, val->first, *directList, *inverselist, zoom); if (pl != NULL) { listPolygons.push_back(pl); } else { - __android_log_print(ANDROID_LOG_INFO, "net.osmand", "Multipolygon skipped"); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Multipolygon skipped"); } } } @@ -361,7 +359,7 @@ void unifyIncompletedRings(std::vector >& incompletedRings // System.err // .println(MessageFormat.format(dbId + str, dx, dy, dsx, dsy, leftX + "", topY + "", rightX + "", bottomY + "")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ // } - __android_log_print(ANDROID_LOG_INFO, "net.osmand", "Error processing multipolygon"); + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Error processing multipolygon"); } else { nonvisitedRings.insert(j); }