summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-16 14:35:10 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-16 14:35:10 +0300
commit40686cc1869953a42f311b6d8a3558e99acef37d (patch)
tree7e6b0d69261ddbfb0aa82535a20eeaf5159103a0 /protocols
parent1513340956911f3e3efc252bc1a0bae046dc8d3e (diff)
useless checks removed
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/avatars.cpp5
-rw-r--r--protocols/Facebook/src/avatars.cpp5
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp6
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp10
-rw-r--r--protocols/MSN/src/msn_misc.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_avatars.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp4
-rw-r--r--protocols/Steam/src/steam_avatars.cpp5
-rw-r--r--protocols/Tox/src/tox_avatars.cpp5
-rw-r--r--protocols/Twitter/src/utility.cpp3
-rw-r--r--protocols/VKontakte/src/vk_avatars.cpp6
11 files changed, 13 insertions, 45 deletions
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp
index cc12cbb381..38e7cb4eb9 100644
--- a/protocols/Discord/src/avatars.cpp
+++ b/protocols/Discord/src/avatars.cpp
@@ -20,10 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
CMStringW CDiscordProto::GetAvatarFilename(MCONTACT hContact)
{
CMStringW wszResult(FORMAT, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(wszResult);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(wszResult);
+ CreateDirectoryTreeW(wszResult);
wszResult.AppendChar('\\');
diff --git a/protocols/Facebook/src/avatars.cpp b/protocols/Facebook/src/avatars.cpp
index 76754bbefc..f93a305664 100644
--- a/protocols/Facebook/src/avatars.cpp
+++ b/protocols/Facebook/src/avatars.cpp
@@ -26,10 +26,7 @@ void FacebookProto::GetAvatarFilename(MCONTACT hContact, wchar_t *pwszFileName)
{
WCHAR wszPath[MAX_PATH];
mir_snwprintf(wszPath, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_avatarcache%"), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(wszPath);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(wszPath);
+ CreateDirectoryTreeW(wszPath);
CMStringW id(getMStringW(hContact, DBKEY_ID));
mir_snwprintf(pwszFileName, MAX_PATH, L"%s\\%s.jpg", wszPath, id.c_str());
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index f1b20c59f0..e5090ceb56 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -149,11 +149,7 @@ void CIcqProto::Json2string(MCONTACT hContact, const JSONNode &node, const char
void CIcqProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(pszDest);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(pszDest);
-
+ CreateDirectoryTreeW(pszDest);
pszDest[tPathLen++] = '\\';
CMStringW wszFileName(getMStringW(hContact, "IconId"));
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 4d96430685..2e861fcb2d 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -135,11 +135,9 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType)
void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
- int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
+ size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
- DWORD dwAttributes = GetFileAttributesW(pszDest);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(pszDest);
+ CreateDirectoryTreeW(pszDest);
pszDest[tPathLen++] = '\\';
@@ -476,9 +474,7 @@ void CJabberProto::OnGetBob(const TiXmlElement *node, CJabberIqInfo *pReq)
if (auto *cid = XmlGetAttr(data, "cid")) {
if (auto *src = data->GetText()) {
VARSW wszTempPath(L"%miranda_userdata%\\JabberTmp");
- DWORD dwAttributes = GetFileAttributesW(wszTempPath);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(wszTempPath);
+ CreateDirectoryTreeW(wszTempPath);
const wchar_t *pwszExt = L".bin";
if (auto *pszType = XmlGetAttr(data, "type"))
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index d20e10662a..e9b8d84948 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -147,8 +147,7 @@ void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_
{
size_t tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
- if (_waccess(pszDest, 0))
- CreateDirectoryTreeW(pszDest);
+ CreateDirectoryTreeW(pszDest);
size_t tPathLen2 = tPathLen;
if (hContact != NULL) {
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp
index 82ffb3ca73..b7e01445d5 100644
--- a/protocols/SkypeWeb/src/skype_avatars.cpp
+++ b/protocols/SkypeWeb/src/skype_avatars.cpp
@@ -123,11 +123,7 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARSW(L"%miranda_avatarcache%").get(), m_tszUserName);
-
- DWORD dwAttributes = GetFileAttributes(pszDest);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(pszDest);
-
+ CreateDirectoryTreeW(pszDest);
pszDest[tPathLen++] = '\\';
const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 6ebe23a08d..3bc30f8b42 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -50,9 +50,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) :
HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead);
m_tszAvatarFolder = std::wstring(VARSW(L"%miranda_avatarcache%")) + L"\\" + m_tszUserName;
- DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(m_tszAvatarFolder.c_str());
+ CreateDirectoryTreeW(m_tszAvatarFolder.c_str());
//sounds
g_plugin.addSound("skype_inc_call", L"SkypeWeb", LPGENW("Incoming call"));
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp
index d01c3b0358..9a72b6fec0 100644
--- a/protocols/Steam/src/steam_avatars.cpp
+++ b/protocols/Steam/src/steam_avatars.cpp
@@ -4,10 +4,7 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t path[MAX_PATH];
mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(path);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(path);
+ CreateDirectoryTreeW(path);
ptrA steamId(getStringA(hContact, "SteamID"));
if (steamId != NULL)
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index 0a255512a0..ca5c7d40a5 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -4,10 +4,7 @@ wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(path);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(path);
+ CreateDirectoryTreeW(path);
ptrW address(getWStringA(hContact, TOX_SETTINGS_ID));
if (address == NULL) {
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp
index dff0737531..be54107c5e 100644
--- a/protocols/Twitter/src/utility.cpp
+++ b/protocols/Twitter/src/utility.cpp
@@ -137,8 +137,7 @@ bool save_url(HNETLIBUSER hNetlib, const std::string &url, const std::wstring &f
if (success) {
// Create folder if necessary
std::wstring dir = filename.substr(0, filename.rfind('\\'));
- if (_waccess(dir.c_str(), 0))
- CreateDirectoryTreeW(dir.c_str());
+ CreateDirectoryTreeW(dir.c_str());
// Write to file
FILE *f = _wfopen(filename.c_str(), L"wb");
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp
index 59f953ea2f..1d487ea137 100644
--- a/protocols/VKontakte/src/vk_avatars.cpp
+++ b/protocols/VKontakte/src/vk_avatars.cpp
@@ -131,11 +131,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
void CVkProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pwszDest, size_t cbLen)
{
int tPathLen = mir_snwprintf(pwszDest, cbLen, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
-
- DWORD dwAttributes = GetFileAttributes(pwszDest);
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(pwszDest);
-
+ CreateDirectoryTreeW(pwszDest);
pwszDest[tPathLen++] = '\\';
const wchar_t *szFileType = L".jpg";