Move logging from WARN to INFO channel. Remove redefined constants

This commit is contained in:
Alexey Pelykh 2012-03-18 09:46:09 +02:00
parent 2dc5acfcd7
commit c00f9b408d
5 changed files with 20 additions and 24 deletions

View file

@ -17,7 +17,6 @@
#include "multipolygons.h" #include "multipolygons.h"
#include "proto/osmand_odb.pb.h" #include "proto/osmand_odb.pb.h"
#define INT_MAX 0x7fffffff /* max value for an int */
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false #define DO_(EXPRESSION) if (!(EXPRESSION)) return false
using namespace google::protobuf; using namespace google::protobuf;
using namespace google::protobuf::internal; 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); proccessMultiPolygons(multyPolygons, q.left, q.right, q.bottom, q.top, q.zoom, result->result);
if(q.result.size() > 0) { 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()); q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size());
} }
delete req; delete req;

View file

@ -45,7 +45,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
loadJniMapObjects(); loadJniMapObjects();
loadJniBinaryRead(); 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; return JNI_VERSION_1_6;
} }

View file

@ -14,7 +14,7 @@ class BaseMapDataObject
{ {
public : public :
static const unsigned int UNDEFINED_STRING = 0x7fffffff; static const unsigned int UNDEFINED_STRING = INT_MAX;
const int type; const int type;
static const int MAP_DATA_OBJECT = 1; static const int MAP_DATA_OBJECT = 1;
static const int MULTI_POLYGON = 2; static const int MULTI_POLYGON = 2;

View file

@ -10,9 +10,6 @@
#include "common.h" #include "common.h"
#include "mapObjects.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 { struct tagValueType {
int type; int type;
std::string tag; std::string tag;
@ -160,7 +157,7 @@ void proccessMultiPolygons(std::map<tagValueType, std::vector<MapDataObject*> >&
completedRingNames.clear(); completedRingNames.clear();
incompletedRingNames.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, MultiPolygonObject* pl = processMultiPolygon(leftX, rightX, bottomY, topY, completedRings, incompletedRings,
completedRingNames, incompletedRingNames, val->first, *directList, *inverselist, zoom); completedRingNames, incompletedRingNames, val->first, *directList, *inverselist, zoom);
if (pl != NULL) { if (pl != NULL) {

View file

@ -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) 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_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(); SkBitmap* bitmap = new SkBitmap();
if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) { if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) {
int rowBytes = bitmapInfo.stride; 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); bitmap->setConfig(SkBitmap::kARGB_8888_Config, bitmapInfo.width, bitmapInfo.height, rowBytes);
} else if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGB_565) { } else if(bitmapInfo.format == ANDROID_BITMAP_FORMAT_RGB_565) {
int rowBytes = bitmapInfo.stride; 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); bitmap->setConfig(SkBitmap::kRGB_565_Config, bitmapInfo.width, bitmapInfo.height, rowBytes);
} else { } else {
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Unknown target bitmap format"); __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) { 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_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); bitmap->setPixels(lockedBitmapData);
@ -751,7 +751,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
SkPaint* paint = new SkPaint; SkPaint* paint = new SkPaint;
paint->setAntiAlias(true); 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; ElapsedTimer initObjects;
initObjects.start(); initObjects.start();
@ -762,7 +762,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
SearchResult* result = ((SearchResult*) searchResult); SearchResult* result = ((SearchResult*) searchResult);
// std::vector <BaseMapDataObject* > mapDataObjects = marshalObjects(binaryMapDataObjects); // std::vector <BaseMapDataObject* > 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(); initObjects.pause();
@ -774,7 +774,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
rc.nativeOperations.pause(); rc.nativeOperations.pause();
pushToJavaRenderingContext(renderingContext, &rc); 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) { if(AndroidBitmap_unlockPixels(ienv, targetBitmap) != ANDROID_BITMAP_RESUT_SUCCESS) {
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to execute AndroidBitmap_unlockPixels"); __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, "<init>", "(Ljava/nio/ByteBuffer;)V"); jmethodID resultClassCtorId = getGlobalJniEnv()->GetMethodID(resultClass, "<init>", "(Ljava/nio/ByteBuffer;)V");
#ifdef DEBUG_NAT_OPERATIONS #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 #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 #endif
/* Construct a result object */ /* 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) { jboolean useEnglishNames, jobject renderingRuleSearchRequest, jint defaultColor) {
setGlobalJniEnv(ienv); 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(); SkBitmap* bitmap = new SkBitmap();
if(isTransparent == JNI_TRUE) if(isTransparent == JNI_TRUE)
@ -827,7 +827,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
bitmapDataSize = bitmap->getSize(); bitmapDataSize = bitmap->getSize();
bitmapData = malloc(bitmapDataSize); 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); bitmap->setPixels(bitmapData);
@ -837,7 +837,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
SkPaint* paint = new SkPaint; SkPaint* paint = new SkPaint;
paint->setAntiAlias(true); 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; ElapsedTimer initObjects;
initObjects.start(); initObjects.start();
@ -848,7 +848,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
SearchResult* result = ((SearchResult*) searchResult); SearchResult* result = ((SearchResult*) searchResult);
// std::vector <BaseMapDataObject* > mapDataObjects = marshalObjects(binaryMapDataObjects); // std::vector <BaseMapDataObject* > 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(); initObjects.pause();
@ -860,7 +860,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
rc.nativeOperations.pause(); rc.nativeOperations.pause();
pushToJavaRenderingContext(renderingContext, &rc); 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 variables
delete paint; delete paint;
@ -874,9 +874,9 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
jmethodID resultClassCtorId = ienv->GetMethodID(resultClass, "<init>", "(Ljava/nio/ByteBuffer;)V"); jmethodID resultClassCtorId = ienv->GetMethodID(resultClass, "<init>", "(Ljava/nio/ByteBuffer;)V");
#ifdef DEBUG_NAT_OPERATIONS #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 #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 #endif
// Allocate ctor paramters // Allocate ctor paramters