From c00f9b408de47be71096724482468e4cede30744 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sun, 18 Mar 2012 09:46:09 +0200 Subject: [PATCH] Move logging from WARN to INFO channel. Remove redefined constants --- OsmAnd/jni/osmand/binaryRead.cpp | 3 +-- OsmAnd/jni/osmand/common.cpp | 2 +- OsmAnd/jni/osmand/mapObjects.h | 2 +- OsmAnd/jni/osmand/multipolygons.h | 5 +---- OsmAnd/jni/osmand/rendering.cpp | 32 +++++++++++++++---------------- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/OsmAnd/jni/osmand/binaryRead.cpp b/OsmAnd/jni/osmand/binaryRead.cpp index 3530f37cb0..826ea74643 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" -#define INT_MAX 0x7fffffff /* max value for an int */ #define DO_(EXPRESSION) if (!(EXPRESSION)) return false using namespace google::protobuf; using namespace google::protobuf::internal; @@ -744,7 +743,7 @@ 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) { - __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees, + __android_log_print(ANDROID_LOG_INFO, 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; diff --git a/OsmAnd/jni/osmand/common.cpp b/OsmAnd/jni/osmand/common.cpp index 535b0d4e76..8eea2efa0f 100644 --- a/OsmAnd/jni/osmand/common.cpp +++ b/OsmAnd/jni/osmand/common.cpp @@ -45,7 +45,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) loadJniMapObjects(); loadJniBinaryRead(); - __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "JNI_OnLoad completed"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "JNI_OnLoad completed"); return JNI_VERSION_1_6; } diff --git a/OsmAnd/jni/osmand/mapObjects.h b/OsmAnd/jni/osmand/mapObjects.h index 4ede2fe336..535d90163e 100644 --- a/OsmAnd/jni/osmand/mapObjects.h +++ b/OsmAnd/jni/osmand/mapObjects.h @@ -14,7 +14,7 @@ class BaseMapDataObject { public : - static const unsigned int UNDEFINED_STRING = 0x7fffffff; + static const unsigned int UNDEFINED_STRING = INT_MAX; const int type; static const int MAP_DATA_OBJECT = 1; static const int MULTI_POLYGON = 2; diff --git a/OsmAnd/jni/osmand/multipolygons.h b/OsmAnd/jni/osmand/multipolygons.h index 750ac7b191..4dea8a191f 100644 --- a/OsmAnd/jni/osmand/multipolygons.h +++ b/OsmAnd/jni/osmand/multipolygons.h @@ -10,9 +10,6 @@ #include "common.h" #include "mapObjects.h" -#define INT_MAX 0x7fffffff /* max value for an int */ -#define INT_MIN (-0x7fffffff-1) /* min value for an int */ - struct tagValueType { int type; std::string tag; @@ -160,7 +157,7 @@ void proccessMultiPolygons(std::map >& completedRingNames.clear(); incompletedRingNames.clear(); - __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()); + __android_log_print(ANDROID_LOG_INFO, 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) { diff --git a/OsmAnd/jni/osmand/rendering.cpp b/OsmAnd/jni/osmand/rendering.cpp index abf33fb2f9..68312bb9d8 100644 --- a/OsmAnd/jni/osmand/rendering.cpp +++ b/OsmAnd/jni/osmand/rendering.cpp @@ -723,16 +723,16 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib if(AndroidBitmap_getInfo(getGlobalJniEnv(), targetBitmap, &bitmapInfo) != ANDROID_BITMAP_RESUT_SUCCESS) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to execute AndroidBitmap_getInfo"); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Creating SkBitmap in native w:%d h:%d s:%d f:%d!", bitmapInfo.width, bitmapInfo.height, bitmapInfo.stride, bitmapInfo.format); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Creating SkBitmap in native w:%d h:%d s:%d f:%d!", bitmapInfo.width, bitmapInfo.height, bitmapInfo.stride, bitmapInfo.format); SkBitmap* bitmap = new SkBitmap(); if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) { int rowBytes = bitmapInfo.stride; - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Row bytes for RGBA_8888 is %d", rowBytes); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Row bytes for RGBA_8888 is %d", rowBytes); bitmap->setConfig(SkBitmap::kARGB_8888_Config, bitmapInfo.width, bitmapInfo.height, rowBytes); } else if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGB_565) { int rowBytes = bitmapInfo.stride; - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Row bytes for RGB_565 is %d", rowBytes); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Row bytes for RGB_565 is %d", rowBytes); bitmap->setConfig(SkBitmap::kRGB_565_Config, bitmapInfo.width, bitmapInfo.height, rowBytes); } else { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Unknown target bitmap format"); @@ -742,7 +742,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib if(AndroidBitmap_lockPixels(getGlobalJniEnv(), targetBitmap, &lockedBitmapData) != ANDROID_BITMAP_RESUT_SUCCESS || !lockedBitmapData) { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to execute AndroidBitmap_lockPixels"); } - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Locked %d bytes at %p", bitmap->getSize(), lockedBitmapData); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Locked %d bytes at %p", bitmap->getSize(), lockedBitmapData); bitmap->setPixels(lockedBitmapData); @@ -751,7 +751,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib SkPaint* paint = new SkPaint; paint->setAntiAlias(true); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Initializing rendering"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Initializing rendering"); ElapsedTimer initObjects; initObjects.start(); @@ -762,7 +762,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib SearchResult* result = ((SearchResult*) searchResult); // std::vector mapDataObjects = marshalObjects(binaryMapDataObjects); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Rendering image"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Rendering image"); initObjects.pause(); @@ -774,7 +774,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib rc.nativeOperations.pause(); pushToJavaRenderingContext(renderingContext, &rc); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "End Rendering image"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "End Rendering image"); if(AndroidBitmap_unlockPixels(ienv, targetBitmap) != ANDROID_BITMAP_RESUT_SUCCESS) { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to execute AndroidBitmap_unlockPixels"); } @@ -791,9 +791,9 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib jmethodID resultClassCtorId = getGlobalJniEnv()->GetMethodID(resultClass, "", "(Ljava/nio/ByteBuffer;)V"); #ifdef DEBUG_NAT_OPERATIONS - __android_log_print(ANDROID_LOG_WARN, LOG_TAG,"Native ok (init %d, native op %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG,"Native ok (init %d, native op %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); #else - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Native ok (init %d, rendering %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Native ok (init %d, rendering %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); #endif /* Construct a result object */ @@ -810,7 +810,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib jboolean useEnglishNames, jobject renderingRuleSearchRequest, jint defaultColor) { setGlobalJniEnv(ienv); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Creating SkBitmap in native w:%d h:%d!", requestedBitmapWidth, requestedBitmapHeight); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Creating SkBitmap in native w:%d h:%d!", requestedBitmapWidth, requestedBitmapHeight); SkBitmap* bitmap = new SkBitmap(); if(isTransparent == JNI_TRUE) @@ -827,7 +827,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib bitmapDataSize = bitmap->getSize(); bitmapData = malloc(bitmapDataSize); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Allocated %d bytes at %p", bitmapDataSize, bitmapData); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Allocated %d bytes at %p", bitmapDataSize, bitmapData); } bitmap->setPixels(bitmapData); @@ -837,7 +837,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib SkPaint* paint = new SkPaint; paint->setAntiAlias(true); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Initializing rendering"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Initializing rendering"); ElapsedTimer initObjects; initObjects.start(); @@ -848,7 +848,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib SearchResult* result = ((SearchResult*) searchResult); // std::vector mapDataObjects = marshalObjects(binaryMapDataObjects); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Rendering image"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Rendering image"); initObjects.pause(); @@ -860,7 +860,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib rc.nativeOperations.pause(); pushToJavaRenderingContext(renderingContext, &rc); - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "End Rendering image"); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "End Rendering image"); // delete variables delete paint; @@ -874,9 +874,9 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib jmethodID resultClassCtorId = ienv->GetMethodID(resultClass, "", "(Ljava/nio/ByteBuffer;)V"); #ifdef DEBUG_NAT_OPERATIONS - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Native ok (init %d, native op %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Native ok (init %d, native op %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); #else - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, "Native ok (init %d, rendering %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Native ok (init %d, rendering %d) ", initObjects.getElapsedTime(), rc.nativeOperations.getElapsedTime()); #endif // Allocate ctor paramters