summaryrefslogtreecommitdiff
path: root/protocols/Weather
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-15 21:02:17 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-15 21:02:17 +0300
commit4cf1469fc15b6a34a1b711f82e6678c41401552d (patch)
tree2fbe4432b1d5e4f58ede03116375ca181cc105cc /protocols/Weather
parentf6487d1f797f9a890f409bf7f27ceacbb512c9a6 (diff)
code cleaning
Diffstat (limited to 'protocols/Weather')
-rw-r--r--protocols/Weather/src/stdafx.h48
-rw-r--r--protocols/Weather/src/weather_conv.cpp4
-rw-r--r--protocols/Weather/src/weather_ini.cpp6
3 files changed, 35 insertions, 23 deletions
diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h
index 10b851e826..11ef55d70d 100644
--- a/protocols/Weather/src/stdafx.h
+++ b/protocols/Weather/src/stdafx.h
@@ -246,58 +246,66 @@ void DestroyUpdateList(void);
#define WID_SET 1
#define WID_BREAK 2
-typedef struct {
+struct WIDATAITEM
+{
wchar_t *Name;
wchar_t *Start;
wchar_t *End;
wchar_t *Unit;
- char *Url;
+ char *Url;
wchar_t *Break;
- int Type;
-} WIDATAITEM;
+ int Type;
+};
-struct WITEMLIST {
+struct WITEMLIST
+{
WIDATAITEM Item;
struct WITEMLIST *Next;
};
typedef struct WITEMLIST WIDATAITEMLIST;
-typedef struct {
+struct WIIDSEARCH
+{
BOOL Available;
char *SearchURL;
wchar_t *NotFoundStr;
WIDATAITEM Name;
-} WIIDSEARCH;
+};
-typedef struct {
+struct WINAMESEARCHTYPE
+{
BOOL Available;
wchar_t *First;
WIDATAITEM Name;
WIDATAITEM ID;
-} WINAMESEARCHTYPE;
+};
-typedef struct {
+struct WINAMESEARCH
+{
char *SearchURL;
wchar_t *NotFoundStr;
wchar_t *SingleStr;
WINAMESEARCHTYPE Single;
WINAMESEARCHTYPE Multiple;
-} WINAMESEARCH;
+};
-struct STRLIST {
+struct STRLIST
+{
wchar_t *Item;
struct STRLIST *Next;
};
typedef struct STRLIST WICONDITEM;
-typedef struct {
+struct WICONDLIST
+{
WICONDITEM *Head;
WICONDITEM *Tail;
-} WICONDLIST;
+};
-typedef struct {
+struct WIDATA
+{
wchar_t *FileName;
wchar_t *ShortFileName;
BOOL Enabled;
@@ -320,18 +328,20 @@ typedef struct {
char *UpdateURL4;
char *Cookie;
char *UserAgent;
-// items
+
+ // items
int UpdateDataCount;
WIDATAITEMLIST *UpdateData;
WIDATAITEMLIST *UpdateDataTail;
WIIDSEARCH IDSearch;
WINAMESEARCH NameSearch;
- WICONDLIST CondList[8];
-} WIDATA;
+ WICONDLIST CondList[MAX_COND];
+};
//============ DATA LIST (LINKED LIST) ============
-struct DATALIST {
+struct DATALIST
+{
WIDATA Data;
struct DATALIST *next;
};
diff --git a/protocols/Weather/src/weather_conv.cpp b/protocols/Weather/src/weather_conv.cpp
index 6ab6b2958f..e7f495e5f4 100644
--- a/protocols/Weather/src/weather_conv.cpp
+++ b/protocols/Weather/src/weather_conv.cpp
@@ -316,8 +316,8 @@ void GetElev(wchar_t *tempchar, wchar_t *unit, wchar_t *str)
// cond = the string for weather condition
// return value = status for the icon (ONLINE, OFFLINE, etc)
-static const wchar_t *statusStr[] = { L"Lightning", L"Fog", L"Snow", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A", L"Rain Shower", L"Snow Shower"};
-static const WORD statusValue[] = { LIGHT, FOG, SNOW, RAIN, PCLOUDY, CLOUDY, SUNNY, NA, RSHOWER, SSHOWER };
+static const wchar_t *statusStr[MAX_COND] = { L"Lightning", L"Fog", L"Snow", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A", L"Rain Shower", L"Snow Shower"};
+static const WORD statusValue[MAX_COND] = { LIGHT, FOG, SNOW, RAIN, PCLOUDY, CLOUDY, SUNNY, NA, RSHOWER, SSHOWER };
WORD GetIcon(const wchar_t *cond, WIDATA *Data)
{
diff --git a/protocols/Weather/src/weather_ini.cpp b/protocols/Weather/src/weather_ini.cpp
index 077f0ef1a3..a719a799c4 100644
--- a/protocols/Weather/src/weather_ini.cpp
+++ b/protocols/Weather/src/weather_ini.cpp
@@ -224,7 +224,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
// pszShortFile = the file name of the ini file, but not including the path
// Data = the struct to load the ini content to, and return to previous function
-static const char *statusStr[] =
+static const char *statusStr[MAX_COND] =
{
"LIGHTNING",
"FOG",
@@ -233,7 +233,9 @@ static const char *statusStr[] =
"PARTLY CLOUDY",
"CLOUDY",
"SUNNY",
- "N/A"
+ "N/A",
+ "RAIN SHOWER",
+ "SNOW SHOWER",
};
static void LoadStationData(const wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Data)