From aa090255cfc30e3aeef7e2ed8d1c8eac3e477cdb Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Thu, 14 Mar 2013 14:31:39 +0000
Subject: fix: various problems with memory

git-svn-id: http://svn.miranda-ng.org/main/trunk@4025 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/Weather/src/weather.h          |  4 ++--
 plugins/Weather/src/weather_update.cpp | 16 +++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

(limited to 'plugins/Weather/src')

diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h
index 694a475549..e44a2c4a9a 100644
--- a/plugins/Weather/src/weather.h
+++ b/plugins/Weather/src/weather.h
@@ -67,8 +67,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define NOSTATUSDATA	1
 
 // limits
-#define MAX_TEXT_SIZE	4096
-#define MAX_DATA_LEN	1024
+#define MAX_TEXT_SIZE   4096
+#define MAX_DATA_LEN    1024
 
 // db info mangement mode
 #define WDBM_REMOVE			1
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index a4186be1c6..8029b13821 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -401,7 +401,7 @@ int GetWeatherData(HANDLE hContact)
 	GetSvc(Svc);
 
 	// check for invalid station
-	if (id[0] == 0)	 return INVALID_ID;
+	if (id[0] == 0)  return INVALID_ID;
 	if (Svc[0] == 0) return INVALID_SVC;
 
 	// get the update strings (loaded to memory from ini files)
@@ -412,25 +412,27 @@ int GetWeatherData(HANDLE hContact)
 	WIDATAITEMLIST* Item;
 	WORD cond = NA;
 	char loc[256];
-	char* szId = mir_t2a( id );
-	for ( int i=0; i<4; ++i) {
+	for (int i=0; i<4; ++i) {
 		// generate update URL
 		switch(i) {
 		case 0:
-			_snprintf(loc, SIZEOF(loc), Data->UpdateURL, szId);
+			_snprintf(loc, SIZEOF(loc), Data->UpdateURL, _T2A(id));
 			break;
 
 		case 1:
-			_snprintf(loc, SIZEOF(loc), Data->UpdateURL2, szId);
+			_snprintf(loc, SIZEOF(loc), Data->UpdateURL2, _T2A(id));
 			break;
 
 		case 2:
-			_snprintf(loc, SIZEOF(loc), Data->UpdateURL3, szId);
+			_snprintf(loc, SIZEOF(loc), Data->UpdateURL3, _T2A(id));
 			break;
 
 		case 3:
-			_snprintf(loc, SIZEOF(loc), Data->UpdateURL4, szId);
+			_snprintf(loc, SIZEOF(loc), Data->UpdateURL4, _T2A(id));
 			break;
+
+		default:
+			continue;
 		}
 
 		if ( loc[0] == 0 )
-- 
cgit v1.2.3