From 5d2000e95281b2df8f8e5e0bb8a7cab7ddf4ea3b Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Mon, 27 Aug 2012 23:26:59 +0200 Subject: [PATCH] try to find the manager error --- Sources/libetk/etk/File.cpp | 14 +++++++------- Sources/libewol/ewol/Resource.h | 6 +++++- Sources/libewol/ewol/ResourceManager.cpp | 3 ++- Sources/libewol/ewol/font/TexturedFont.cpp | 21 ++++++++++++++++----- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Sources/libetk/etk/File.cpp b/Sources/libetk/etk/File.cpp index 790fca51..8bd6dc81 100644 --- a/Sources/libetk/etk/File.cpp +++ b/Sources/libetk/etk/File.cpp @@ -80,7 +80,7 @@ void etk::SetBaseFolderData(const char * folder) s_fileAPK = folder; loadAPK(s_fileAPK); #else - TK_ERROR("Not Availlable Outside Android"); + TK_WARNING("Not Availlable Outside Android"); #endif } @@ -89,7 +89,7 @@ void etk::SetBaseFolderDataUser(const char * folder) #ifdef __TARGET_OS__Android baseFolderDataUser = folder; #else - TK_ERROR("Not Availlable Outside Android"); + TK_WARNING("Not Availlable Outside Android"); #endif } @@ -98,7 +98,7 @@ void etk::SetBaseFolderCache(const char * folder) #ifdef __TARGET_OS__Android baseFolderCache = folder; #else - TK_ERROR("Not Availlable Outside Android"); + TK_WARNING("Not Availlable Outside Android"); #endif } @@ -143,10 +143,10 @@ void etk::InitDefaultFolder(const char * applName) // start log } #endif - TK_ERROR("baseFolderHome : \"" << baseFolderHome << "\""); - TK_ERROR("baseFolderData : \"" << baseFolderData << "\""); - TK_ERROR("baseFolderDataUser : \"" << baseFolderDataUser << "\""); - TK_ERROR("baseFolderCache : \"" << baseFolderCache << "\""); + TK_INFO("baseFolderHome : \"" << baseFolderHome << "\""); + TK_INFO("baseFolderData : \"" << baseFolderData << "\""); + TK_INFO("baseFolderDataUser : \"" << baseFolderDataUser << "\""); + TK_INFO("baseFolderCache : \"" << baseFolderCache << "\""); } etk::UString etk::GetUserHomeFolder(void) diff --git a/Sources/libewol/ewol/Resource.h b/Sources/libewol/ewol/Resource.h index 11af891f..4a127915 100644 --- a/Sources/libewol/ewol/Resource.h +++ b/Sources/libewol/ewol/Resource.h @@ -39,7 +39,11 @@ namespace ewol public: Resource(etk::UString& filename) : m_name(filename), m_counter(1) { }; virtual ~Resource(void) { }; - virtual bool HasName(etk::UString& fileName) { return fileName==m_name; }; + virtual bool HasName(etk::UString& fileName) + { + EWOL_DEBUG("check : " << fileName << " ?= " << m_name << " = " << (fileName==m_name) ); + return fileName==m_name; + }; virtual etk::UString GetName(void) { return m_name; }; void Increment(void) { m_counter++; }; bool Decrement(void) { m_counter--; return (m_counter==0)?true:false; }; diff --git a/Sources/libewol/ewol/ResourceManager.cpp b/Sources/libewol/ewol/ResourceManager.cpp index 245d5113..ace35f0c 100644 --- a/Sources/libewol/ewol/ResourceManager.cpp +++ b/Sources/libewol/ewol/ResourceManager.cpp @@ -57,7 +57,8 @@ void ewol::resource::UnInit(void) static ewol::Resource* LocalKeep(etk::UString& filename) { EWOL_DEBUG("KEEP : DEFAULT : file : \"" << filename << "\""); - for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) { + //for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) { + for (int32_t iii=0; iiiHasName(filename)) { l_resourceList[iii]->Increment(); diff --git a/Sources/libewol/ewol/font/TexturedFont.cpp b/Sources/libewol/ewol/font/TexturedFont.cpp index 960ccb91..3612605b 100644 --- a/Sources/libewol/ewol/font/TexturedFont.cpp +++ b/Sources/libewol/ewol/font/TexturedFont.cpp @@ -62,17 +62,27 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : m_lastGlyphPos(0,0), m_lastRawHeigh(0) { - char tmpName[1024] = ""; int32_t tmpSize = 0; // extarct name and size : - if (sscanf(fontName.c_str(), "%s:%d", tmpName, &tmpSize)!=2) { + char * tmpData = fontName.c_str(); + char * tmpPos = strchr(tmpData, ':'); + + if (tmpPos==NULL) { m_size = 1; - EWOL_CRITICAL("Can not parse the font name : \"" << fontName << "\""); + EWOL_CRITICAL("Can not parse the font name : \"" << fontName << "\" ??? ':' " ); return; + } else { + if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) { + m_size = 1; + EWOL_CRITICAL("Can not parse the font name : \"" << fontName << "\" ==> size ???"); + return; + } + *tmpPos = '\0'; } m_size = tmpSize; - m_name = tmpName; - ewol::resource::Keep(fontName, m_font); + m_name = tmpData; + //EWOL_CRITICAL("Load FONT name : \"" << m_name << "\" ==> size=" << m_size); + ewol::resource::Keep(m_name, m_font); if (NULL == m_font) { return; } @@ -204,6 +214,7 @@ bool ewol::TexturedFont::HasName(etk::UString& fileName) etk::UString tmpName = m_name; tmpName += ":"; tmpName += m_size; + EWOL_DEBUG("check : " << fileName << " ?= " << tmpName << " = " << (fileName==tmpName) ); return fileName==tmpName; }