From 75a2eab4a30c503df310118d0d75ff503d59e562 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 27 Nov 2012 17:43:42 +0000 Subject: Weather is a virtual protocol now, optionally git-svn-id: http://svn.miranda-ng.org/main/trunk@2522 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Weather/src/weather_conv.cpp | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'protocols/Weather/src/weather_conv.cpp') diff --git a/protocols/Weather/src/weather_conv.cpp b/protocols/Weather/src/weather_conv.cpp index ff5e37cb58..780253b8ac 100644 --- a/protocols/Weather/src/weather_conv.cpp +++ b/protocols/Weather/src/weather_conv.cpp @@ -1,7 +1,8 @@ /* Weather Protocol plugin for Miranda IM -Copyright (C) 2005-2011 Boris Krasnovskiy All Rights Reserved -Copyright (C) 2002-2005 Calvin Che +Copyright (c) 2012 Miranda NG Team +Copyright (c) 2005-2011 Boris Krasnovskiy All Rights Reserved +Copyright (c) 2002-2005 Calvin Che This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -90,7 +91,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str) _tcscpy(str, tempchar); return; } - if (!is_number(tempchar)) { + if ( !is_number(tempchar)) { _tcscpy(str, NODATA); return; } @@ -99,8 +100,8 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str) temp = _ttof(tempchar); // convert all to F first - if (!_tcsicmp(unit, _T("C"))) temp = (temp*9/5)+32; - else if (!_tcsicmp(unit, _T("K"))) temp = ((temp-273.15)*9/5)+32; + if ( !_tcsicmp(unit, _T("C"))) temp = (temp*9/5)+32; + else if ( !_tcsicmp(unit, _T("K"))) temp = ((temp-273.15)*9/5)+32; // convert to apporiate unit switch (opt.tUnit) { @@ -142,17 +143,17 @@ void GetPressure(TCHAR *tempchar, TCHAR *unit, TCHAR* str) } // convert all to mb first - if (!_tcsicmp(unit, _T("KPA"))) + if ( !_tcsicmp(unit, _T("KPA"))) tempunit = (double)output * 10; - else if (!_tcsicmp(unit, _T("HPA"))) + else if ( !_tcsicmp(unit, _T("HPA"))) tempunit = (double)output; - else if (!_tcsicmp(unit, _T("MB"))) + else if ( !_tcsicmp(unit, _T("MB"))) tempunit = (double)output; - else if (!_tcsicmp(unit, _T("IN"))) + else if ( !_tcsicmp(unit, _T("IN"))) tempunit = (double)output * 33.86388; - else if (!_tcsicmp(unit, _T("MM"))) + else if ( !_tcsicmp(unit, _T("MM"))) tempunit = (double)output * 1.33322; - else if (!_tcsicmp(unit, _T("TORR"))) + else if ( !_tcsicmp(unit, _T("TORR"))) tempunit = (double)output * 1.33322; // convert to apporiate unit @@ -199,13 +200,13 @@ void GetSpeed(TCHAR *tempchar, TCHAR *unit, TCHAR *str) return; // convert all to m/s first - if (!_tcsicmp(unit, _T("KM/H"))) + if ( !_tcsicmp(unit, _T("KM/H"))) tempunit /= 3.6; -// else if (!_tcsicmp(unit, _T("M/S")) +// else if ( !_tcsicmp(unit, _T("M/S")) // tempunit = tempunit; - else if (!_tcsicmp(unit, _T("MPH"))) + else if ( !_tcsicmp(unit, _T("MPH"))) tempunit *= 0.44704; - else if (!_tcsicmp(unit, _T("KNOTS"))) + else if ( !_tcsicmp(unit, _T("KNOTS"))) tempunit *= 0.514444; // convert to apporiate unit @@ -248,9 +249,9 @@ void GetDist(TCHAR *tempchar, TCHAR *unit, TCHAR *str) } // convert all to km first - if (!_tcsicmp(unit, _T("KM"))) + if ( !_tcsicmp(unit, _T("KM"))) tempunit = (double)output; - else if (!_tcsicmp(unit, _T("MILES"))) + else if ( !_tcsicmp(unit, _T("MILES"))) tempunit = (double)output * 1.609; // convert to apporiate unit @@ -288,9 +289,9 @@ void GetElev(TCHAR *tempchar, TCHAR *unit, TCHAR *str) } // convert all to m first - if (!_tcsicmp(unit, _T("M"))) + if ( !_tcsicmp(unit, _T("M"))) tempunit = (double)output; - else if (!_tcsicmp(unit, _T("FT"))) + else if ( !_tcsicmp(unit, _T("FT"))) tempunit = (double)output / 3.28; // convert to apporiate unit @@ -556,7 +557,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) if ( !DBGetContactSettingTString(w->hContact, WEATHERCONDITION, name, &dbv)) { if (dbv.ptszVal != TranslateTS(NODATA) && dbv.ptszVal != TranslateT("")) _tcscat(str, dbv.ptszVal); - DBFreeVariant(&dbv); + db_free(&dbv); } break; } -- cgit v1.2.3