diff --git a/srchybrid/CatDialog.cpp b/srchybrid/CatDialog.cpp index 29ca339a..ebb0e6d2 100644 --- a/srchybrid/CatDialog.cpp +++ b/srchybrid/CatDialog.cpp @@ -180,9 +180,17 @@ void CCatDialog::OnBnClickedOk() m_myCat->color = newcolor; m_myCat->prio = m_prio.GetCurSel(); GetDlgItemText(IDC_AUTOCATEXT, m_myCat->autocat); + if (m_myCat->ac_regexpeval && !IsRegExpValid(m_myCat->autocat)) { + GetDlgItem(IDC_AUTOCATEXT)->SetFocus(); + return; + } GetDlgItemText(IDC_REGEXP, m_myCat->regexp); if (m_myCat->regexp.GetLength() > 0) { + if (!IsRegExpValid(m_myCat->regexp)) { + GetDlgItem(IDC_REGEXP)->SetFocus(); + return; + } if (m_pacRegExp && m_pacRegExp->IsBound()) { m_pacRegExp->AddItem(m_myCat->regexp, 0); m_myCat->filter = 18; diff --git a/srchybrid/CommentDialog.cpp b/srchybrid/CommentDialog.cpp index 69b15bf6..ed5a0d36 100644 --- a/srchybrid/CommentDialog.cpp +++ b/srchybrid/CommentDialog.cpp @@ -53,6 +53,7 @@ END_MESSAGE_MAP() CCommentDialog::CCommentDialog() : CResizablePage(CCommentDialog::IDD) + , m_iRating(-1) , m_paFiles() , m_bDataChanged() , m_bMergedComment() @@ -109,7 +110,7 @@ BOOL CCommentDialog::OnSetActive() return FALSE; if (m_bDataChanged) { bool bContainsSharedKnownFile = false; - int iRating = -1; + m_iRating = -1; m_bMergedComment = false; CString strComment; for (int i = 0; i < m_paFiles->GetSize(); ++i) { @@ -124,20 +125,20 @@ BOOL CCommentDialog::OnSetActive() bContainsSharedKnownFile = true; if (i == 0) { strComment = file->GetFileComment(); - iRating = file->GetFileRating(); + m_iRating = file->GetFileRating(); } else { if (!m_bMergedComment && strComment.Compare(file->GetFileComment()) != 0) { strComment.Empty(); m_bMergedComment = true; } - if (iRating >= 0 && (UINT)iRating != file->GetFileRating()) - iRating = -1; + if (m_iRating >= 0 && (UINT)m_iRating != file->GetFileRating()) + m_iRating = -1; } } m_bSelf = true; SetDlgItemText(IDC_CMT_TEXT, strComment); static_cast(GetDlgItem(IDC_CMT_TEXT))->SetLimitText(MAXFILECOMMENTLEN); - m_ratebox.SetCurSel(iRating); + m_ratebox.SetCurSel(m_iRating); m_bSelf = false; EnableDialog(bContainsSharedKnownFile); @@ -167,15 +168,15 @@ BOOL CCommentDialog::OnApply() if (m_bEnabled && !m_bDataChanged) { CString strComment; GetDlgItemText(IDC_CMT_TEXT, strComment); - int iRating = m_ratebox.GetCurSel(); + m_iRating = m_ratebox.GetCurSel(); for (int i = 0; i < m_paFiles->GetSize(); ++i) if ((*m_paFiles)[i]->IsKindOf(RUNTIME_CLASS(CKnownFile))) { CKnownFile *file = static_cast((*m_paFiles)[i]); if (theApp.sharedfiles->GetFileByID(file->GetFileHash()) != NULL) { if (!strComment.IsEmpty() || !m_bMergedComment) file->SetFileComment(strComment); - if (iRating >= 0) - file->SetFileRating(iRating); + if (m_iRating >= 0) + file->SetFileRating(m_iRating); } } } @@ -218,8 +219,8 @@ void CCommentDialog::Localize() m_ratebox.AddItem(GetResString(IDS_CMT_FAIR), 3); m_ratebox.AddItem(GetResString(IDS_CMT_GOOD), 4); m_ratebox.AddItem(GetResString(IDS_CMT_EXCELLENT), 5); - UpdateHorzExtent(m_ratebox, 16); // adjust dropped width to ensure all strings are fully visible - + UpdateHorzExtent(m_ratebox, 16); // adjust dropdown width to ensure all strings are fully visible + m_ratebox.SetCurSel(m_iRating); RefreshData(); } @@ -263,7 +264,7 @@ void CCommentDialog::RefreshData(bool deleteOld) for (int i = 0; i < m_paFiles->GetSize(); ++i) { CAbstractFile *file = static_cast((*m_paFiles)[i]); if (file->IsPartFile()) { - for (POSITION pos = static_cast(file)->srclist.GetHeadPosition(); pos != NULL; ) { + for (POSITION pos = static_cast(file)->srclist.GetHeadPosition(); pos != NULL;) { CUpDownClient *cur_src = static_cast(file)->srclist.GetNext(pos); if (cur_src->HasFileRating() || !cur_src->GetFileComment().IsEmpty()) m_lstComments.AddItem(cur_src); @@ -318,12 +319,12 @@ void CCommentDialog::OnBnClickedSearchKad() void CCommentDialog::EnableDialog(bool bEnabled) { - if (m_bEnabled == bEnabled) - return; - m_bEnabled = bEnabled; - GetDlgItem(IDC_LST)->EnableWindow(static_cast(m_bEnabled)); - GetDlgItem(IDC_CMT_TEXT)->EnableWindow(static_cast(m_bEnabled)); - GetDlgItem(IDC_RATELIST)->EnableWindow(static_cast(m_bEnabled)); - GetDlgItem(IDC_RESET)->EnableWindow(static_cast(m_bEnabled)); - GetDlgItem(IDC_SEARCHKAD)->EnableWindow(static_cast(m_bEnabled)); + if (m_bEnabled != bEnabled) { + m_bEnabled = bEnabled; + GetDlgItem(IDC_LST)->EnableWindow(bEnabled); + GetDlgItem(IDC_CMT_TEXT)->EnableWindow(bEnabled); + GetDlgItem(IDC_RATELIST)->EnableWindow(bEnabled); + GetDlgItem(IDC_RESET)->EnableWindow(bEnabled); + GetDlgItem(IDC_SEARCHKAD)->EnableWindow(bEnabled); + } } \ No newline at end of file diff --git a/srchybrid/CommentDialog.h b/srchybrid/CommentDialog.h index bda166f5..da625cec 100644 --- a/srchybrid/CommentDialog.h +++ b/srchybrid/CommentDialog.h @@ -17,7 +17,7 @@ class CCommentDialog : public CResizablePage { IDD = IDD_COMMENT }; - + int m_iRating; public: CCommentDialog(); // standard constructor virtual ~CCommentDialog() = default; diff --git a/srchybrid/CommentDialogLst.cpp b/srchybrid/CommentDialogLst.cpp index 9179f7c9..2b2f929d 100644 --- a/srchybrid/CommentDialogLst.cpp +++ b/srchybrid/CommentDialogLst.cpp @@ -95,7 +95,6 @@ BOOL CCommentDialogLst::OnSetActive() if (!CResizablePage::OnSetActive()) return FALSE; if (m_bDataChanged) { - RefreshData(); RefreshData(); m_bDataChanged = false; } @@ -197,7 +196,7 @@ void CCommentDialogLst::OnBnClickedFilter() CString strNewCommentFilters; for (int iPos = 0; iPos >= 0;) { CString strFilter = strCommentFilters.Tokenize(_T("|"), iPos); - if (!strFilter.IsEmpty()) { + if (!strFilter.Trim().IsEmpty()) { if (!strNewCommentFilters.IsEmpty()) strNewCommentFilters += _T('|'); strNewCommentFilters += strFilter.Trim(); diff --git a/srchybrid/CreditsThread.cpp b/srchybrid/CreditsThread.cpp index 6806cb1d..971c2098 100644 --- a/srchybrid/CreditsThread.cpp +++ b/srchybrid/CreditsThread.cpp @@ -388,7 +388,7 @@ void CCreditsThread::InitText() m_arCredits.Add(_T("03:00:eMule")); m_arCredits.Add(_T("02:01:Version ") + theApp.m_strCurVersionLong); - m_arCredits.Add(_T("01:06:Copyright (C) 2002-2020 Merkur")); + m_arCredits.Add(_T("01:06:Copyright (C) 2002-2021 Merkur")); m_arCredits.Add(_T("S:50")); m_arCredits.Add(_T("02:04:Developers")); m_arCredits.Add(_T("S:5")); diff --git a/srchybrid/DirectoryTreeCtrl.cpp b/srchybrid/DirectoryTreeCtrl.cpp index 11b065dd..305b6b39 100644 --- a/srchybrid/DirectoryTreeCtrl.cpp +++ b/srchybrid/DirectoryTreeCtrl.cpp @@ -342,7 +342,7 @@ bool CDirectoryTreeCtrl::HasSubdirectories(const CString &strDir) void CDirectoryTreeCtrl::GetSharedDirectories(CStringList &list) { - for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL; ) + for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL;) list.AddTail(m_lstShared.GetNext(pos)); } @@ -350,12 +350,10 @@ void CDirectoryTreeCtrl::SetSharedDirectories(CStringList &list) { m_lstShared.RemoveAll(); - for (POSITION pos = list.GetHeadPosition(); pos != NULL; ) { - CString str = list.GetNext(pos); - if (str.Left(2) != _T("\\\\")) - slosh(str); - m_lstShared.AddTail(str); - + for (POSITION pos = list.GetHeadPosition(); pos != NULL;) { + const CString &sDir(list.GetNext(pos)); + if (!::PathIsUNC(sDir)) + m_lstShared.AddTail(sDir); } Init(); } diff --git a/srchybrid/DownloadClient.cpp b/srchybrid/DownloadClient.cpp index de1ec9e0..39c17f03 100644 --- a/srchybrid/DownloadClient.cpp +++ b/srchybrid/DownloadClient.cpp @@ -103,14 +103,12 @@ void CUpDownClient::DrawStatusBar(CDC *dc, const CRect &rect, bool onlygreyrect, for (UINT i = 0; i < m_nPartCount; ++i) { if (m_abyPartStatus[i]) { uint64 uBegin = PARTSIZE * i; - uint64 uEnd = uBegin + PARTSIZE - 1; - if (uEnd >= (uint64)m_reqfile->GetFileSize()) - uEnd = (uint64)m_reqfile->GetFileSize(); + uint64 uEnd = min(uBegin + PARTSIZE, (uint64)m_reqfile->GetFileSize()); COLORREF colour; if (m_reqfile->IsComplete(uBegin, uEnd - 1, false)) colour = crBoth; - else if (m_eDownloadState == DS_DOWNLOADING && GetSessionDown() > 0 && m_nLastBlockOffset >= uBegin && m_nLastBlockOffset <= uEnd) + else if (m_eDownloadState == DS_DOWNLOADING && GetSessionDown() && m_nLastBlockOffset >= uBegin && m_nLastBlockOffset < uEnd) colour = crPending; else if (pcNextPendingBlks != NULL && pcNextPendingBlks[i] == 'Y') colour = crNextPending; @@ -298,10 +296,11 @@ void CUpDownClient::SendFileRequest() if (thePrefs.GetDebugClientTCPLevel() > 0) DebugSend("OP_MPReqFileName", this, m_reqfile->GetFileHash()); dataFileReq.WriteUInt8(OP_REQUESTFILENAME); - if (GetExtendedRequestsVersion() > 0) + if (GetExtendedRequestsVersion() > 0) { m_reqfile->WritePartStatus(&dataFileReq); - if (GetExtendedRequestsVersion() > 1) - m_reqfile->WriteCompleteSourcesCount(&dataFileReq); + if (GetExtendedRequestsVersion() > 1) + m_reqfile->WriteCompleteSourcesCount(&dataFileReq); + } // OP_SETREQFILEID if (thePrefs.GetDebugClientTCPLevel() > 0) @@ -357,10 +356,11 @@ void CUpDownClient::SendFileRequest() CSafeMemFile dataFileReq(96); dataFileReq.WriteHash16(m_reqfile->GetFileHash()); //This is extended information - if (GetExtendedRequestsVersion() > 0) + if (GetExtendedRequestsVersion() > 0) { m_reqfile->WritePartStatus(&dataFileReq); - if (GetExtendedRequestsVersion() > 1) - m_reqfile->WriteCompleteSourcesCount(&dataFileReq); + if (GetExtendedRequestsVersion() > 1) + m_reqfile->WriteCompleteSourcesCount(&dataFileReq); + } if (thePrefs.GetDebugClientTCPLevel() > 0) DebugSend("OP_FileRequest", this, m_reqfile->GetFileHash()); Packet *packet = new Packet(&dataFileReq); @@ -640,7 +640,7 @@ void CUpDownClient::SetDownloadState(EDownloadState nNewState, LPCTSTR pszReason } break; case DS_NONEEDEDPARTS: - // Since TCP asks never sets re-ask time if the result is DS_NONEEDEDPARTS + // Since TCP asks never set re-ask time if the result is DS_NONEEDEDPARTS // If we set this, we will not re-ask for that file until some time has passed. SetLastAskedTime(); //DontSwapTo(m_reqfile); @@ -676,16 +676,15 @@ void CUpDownClient::SetDownloadState(EDownloadState nNewState, LPCTSTR pszReason if (nNewState == DS_NONEEDEDPARTS) pszReason = _T("NNP. You don't need any parts from this client."); - if (thePrefs.GetLogUlDlEvents()) - AddDebugLogLine(DLP_VERYLOW, false - , _T("Download session ended: %s User: %s in SetDownloadState(). New State: %i, Length: %s, Payload: %s, Transferred: %s, Req blocks not yet completed: %i.") - , pszReason - , (LPCTSTR)DbgGetClientInfo() - , nNewState - , (LPCTSTR)CastSecondsToHM(GetDownTimeDifference(false) / SEC2MS(1)) - , (LPCTSTR)CastItoXBytes(GetSessionPayloadDown()) - , (LPCTSTR)CastItoXBytes(GetSessionDown()) - , m_PendingBlocks_list.GetCount()); + AddDebugLogLine(DLP_VERYLOW, false + , _T("Download session ended: %s User: %s in SetDownloadState(). New State: %i, Length: %s, Payload: %s, Transferred: %s, Req blocks not yet completed: %i.") + , pszReason + , (LPCTSTR)DbgGetClientInfo() + , nNewState + , (LPCTSTR)CastSecondsToHM(GetDownTimeDifference(false) / SEC2MS(1)) + , (LPCTSTR)CastItoXBytes(GetSessionPayloadDown()) + , (LPCTSTR)CastItoXBytes(GetSessionDown()) + , m_PendingBlocks_list.GetCount()); } ResetSessionDown(); diff --git a/srchybrid/DownloadQueue.cpp b/srchybrid/DownloadQueue.cpp index 69af5cd9..cb019261 100644 --- a/srchybrid/DownloadQueue.cpp +++ b/srchybrid/DownloadQueue.cpp @@ -1660,7 +1660,7 @@ void CDownloadQueue::ExportPartMetFilesOverview() const file.printf(_T("--------------------------------------------------------------------------------\r\n")); for (POSITION pos = filelist.GetHeadPosition(); pos != NULL;) { const CPartFile *pPartFile = filelist.GetNext(pos); - if (pPartFile && pPartFile->GetStatus(true) != PS_COMPLETE) { + if (pPartFile->GetStatus(true) != PS_COMPLETE) { CString strPartFilePath(pPartFile->GetFilePath()); TCHAR szNam[_MAX_FNAME]; TCHAR szExt[_MAX_EXT]; diff --git a/srchybrid/ED2kLinkDlg.cpp b/srchybrid/ED2kLinkDlg.cpp index 1808b4dc..76968fc5 100644 --- a/srchybrid/ED2kLinkDlg.cpp +++ b/srchybrid/ED2kLinkDlg.cpp @@ -181,7 +181,7 @@ void CED2kLinkDlg::UpdateLink() CString strLinks; for (int i = 0; i != m_paFiles->GetSize(); ++i) - if ((*m_paFiles)[i] && (*m_paFiles)[i]->IsKindOf(RUNTIME_CLASS(CKnownFile))) { + if ((*m_paFiles)[i]->IsKindOf(RUNTIME_CLASS(CKnownFile))) { if (!strLinks.IsEmpty()) strLinks += _T("\r\n\r\n"); const CKnownFile *file = static_cast((*m_paFiles)[i]); diff --git a/srchybrid/FileDetailDialogInfo.cpp b/srchybrid/FileDetailDialogInfo.cpp index 3dad3705..e844060d 100644 --- a/srchybrid/FileDetailDialogInfo.cpp +++ b/srchybrid/FileDetailDialogInfo.cpp @@ -72,6 +72,8 @@ BOOL CFileDetailDialogInfo::OnInitDialog() CResizablePage::OnInitDialog(); InitWindowStyles(this); + AddAnchor(IDC_FNAME, TOP_LEFT, TOP_RIGHT); + AddAnchor(IDC_METFILE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FD_X0, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FD_X6, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FD_X8, TOP_LEFT, TOP_RIGHT); diff --git a/srchybrid/ListenSocket.cpp b/srchybrid/ListenSocket.cpp index f96259e3..8feb2ed0 100644 --- a/srchybrid/ListenSocket.cpp +++ b/srchybrid/ListenSocket.cpp @@ -1744,7 +1744,7 @@ bool CClientReqSocket::ProcessExtPacket(const BYTE *packet, uint32 size, UINT op DebugRecv(sOp, client, (size >= 16) ? packet : NULL); } - theStats.AddDownDataOverheadFileRequest(16 + 2 * (opcode == OP_COMPRESSEDPART ? 4 : 8)); + theStats.AddDownDataOverheadFileRequest(16 + (opcode == OP_COMPRESSEDPART ? 4 : 8) + (opcode == OP_SENDINGPART_I64 ? 8 : 4)); client->CheckHandshakeFinished(); const CPartFile *creqfile = client->GetRequestFile(); if (creqfile && !creqfile->IsStopped() && (creqfile->GetStatus() == PS_READY || creqfile->GetStatus() == PS_EMPTY)) { @@ -2367,7 +2367,7 @@ void CListenSocket::UpdateConnectionsStatus() if (averageconnections < 0.001f) averageconnections = 0.001f; // avoid floating point underflow } - } +} float CListenSocket::GetMaxConperFiveModifier() { diff --git a/srchybrid/OtherFunctions.cpp b/srchybrid/OtherFunctions.cpp index a198ae38..4a94575a 100644 --- a/srchybrid/OtherFunctions.cpp +++ b/srchybrid/OtherFunctions.cpp @@ -3320,15 +3320,29 @@ bool IsUnicodeFile(LPCTSTR pszFilePath) return bResult; } +bool IsRegExpValid(const CString & regexpr) +{ + try { + std::basic_regex reFN(regexpr); + } catch (const std::regex_error&) { + return false; + } + return true; +} + bool RegularExpressionMatch(const CString ®expr, const CString &teststring) { - std::basic_regex reFN(regexpr); + try { + std::basic_regex reFN(regexpr); #ifdef UNICODE - std::wcmatch mcUrl; + std::wcmatch mcUrl; #else - std::cmatch mcUrl; + std::cmatch mcUrl; #endif - return std::regex_match((LPCTSTR)teststring, mcUrl, reFN); + return std::regex_match((LPCTSTR)teststring, mcUrl, reFN); + } catch (const std::regex_error&) { + return false; + } } ULONGLONG GetModuleVersion(LPCTSTR pszFilePath) diff --git a/srchybrid/OtherFunctions.h b/srchybrid/OtherFunctions.h index 9b37a723..16b369dc 100644 --- a/srchybrid/OtherFunctions.h +++ b/srchybrid/OtherFunctions.h @@ -132,6 +132,7 @@ CString GetFormatedUInt(ULONG ulVal); CString GetFormatedUInt64(ULONGLONG ullVal); void SecToTimeLength(unsigned long ulSec, CStringA &rstrTimeLength); void SecToTimeLength(unsigned long ulSec, CStringW &rstrTimeLength); +bool IsRegExpValid(const CString ®expr); bool RegularExpressionMatch(const CString ®expr, const CString &teststring); // Print hash in a format which is similar to CertMgr's diff --git a/srchybrid/PartFile.cpp b/srchybrid/PartFile.cpp index b5dfff43..2c48de63 100644 --- a/srchybrid/PartFile.cpp +++ b/srchybrid/PartFile.cpp @@ -3649,6 +3649,8 @@ bool CPartFile::IsReadyForPreview() const case PS_EMPTY: case PS_PAUSED: case PS_INSUFFICIENT: + break; + default: return false; } diff --git a/srchybrid/PartFileConvert.cpp b/srchybrid/PartFileConvert.cpp index 0ddb9e9d..c040f892 100644 --- a/srchybrid/PartFileConvert.cpp +++ b/srchybrid/PartFileConvert.cpp @@ -116,6 +116,7 @@ void CPartFileConvert::ConvertToeMule(const CString &folder, bool deletesource) m_convertgui->AddJob(newjob); StartThread(); + m_convertgui->SetForegroundWindow(); } void CPartFileConvert::StartThread() @@ -502,8 +503,8 @@ void CPartFileConvert::RemoveAllJobs() void CPartFileConvert::RemoveJob(ConvertJob *job) { - POSITION pos = NULL; - while ((pos = m_jobs.Find(job, pos)) != NULL) { + POSITION pos = m_jobs.Find(job); + if (pos) { ConvertJob *del = m_jobs.GetAt(pos); if (m_convertgui) m_convertgui->RemoveJob(del); @@ -639,10 +640,11 @@ void CPartFileConvertDlg::OnAddFolder() // Now cause the dialog to appear. LPITEMIDLIST pidlRoot; if ((pidlRoot = SHBrowseForFolder(&bi)) != NULL) { - int reply = IDNO; - + int reply; if (thePrefs.IsExtControlsEnabled()) reply = LocMessageBox(IDS_IMP_DELSRC, MB_YESNOCANCEL | MB_DEFBUTTON2, 0); + else + reply = IDNO; if (reply != IDCANCEL) { bool removesrc = (reply == IDYES); @@ -676,7 +678,7 @@ void CPartFileConvertDlg::UpdateJobInfo(ConvertJob *job) return; } - // search jobitem in listctrl + // search job item in listctrl LVFINDINFO find; find.flags = LVFI_PARAM; find.lParam = (LPARAM)job; @@ -689,8 +691,7 @@ void CPartFileConvertDlg::UpdateJobInfo(ConvertJob *job) buffer.Format(GetResString(IDS_IMP_SIZE), (LPCTSTR)CastItoXBytes(job->size), (LPCTSTR)CastItoXBytes(job->spaceneeded)); joblist.SetItemText(iItem, 2, buffer); joblist.SetItemText(iItem, 3, job->filehash); - }// else - // AddJob(job); why??? + } } void CPartFileConvertDlg::RemoveJob(ConvertJob *job) @@ -717,13 +718,10 @@ void CPartFileConvertDlg::RemoveSel() for (POSITION pos = joblist.GetFirstSelectedItemPosition(); pos != NULL;) { int index = joblist.GetNextSelectedItem(pos); - if (index > -1) { + if (index >= 0) { ConvertJob *job = reinterpret_cast(joblist.GetItemData(index)); - if (job->state != CONV_INPROGRESS) { - RemoveJob(job); // from list + if (job->state != CONV_INPROGRESS) CPartFileConvert::RemoveJob(job); - pos = joblist.GetFirstSelectedItemPosition(); - } } } } @@ -735,7 +733,7 @@ void CPartFileConvertDlg::RetrySel() for (POSITION pos = joblist.GetFirstSelectedItemPosition(); pos != NULL;) { int index = joblist.GetNextSelectedItem(pos); - if (index > -1) { + if (index >= 0) { ConvertJob *job = reinterpret_cast(joblist.GetItemData(index)); if (job->state != CONV_OK && job->state != CONV_INPROGRESS) { UpdateJobInfo(job); diff --git a/srchybrid/Quantize.cpp b/srchybrid/Quantize.cpp index 440c99bf..99d255c4 100644 --- a/srchybrid/Quantize.cpp +++ b/srchybrid/Quantize.cpp @@ -102,7 +102,7 @@ void CQuantizer::AddColor(NODE **ppNode, BYTE r, BYTE g, BYTE b, void* CQuantizer::CreateNode(UINT nLevel, UINT nColorBits, UINT *pLeafCount, NODE **pReducibleNodes) { - NODE *pNode = (NODE*)malloc(sizeof(NODE)); + NODE *pNode = (NODE*)calloc(1, sizeof(NODE)); if (pNode == NULL) return NULL; diff --git a/srchybrid/SearchFile.cpp b/srchybrid/SearchFile.cpp index 49eca58a..f99ff173 100644 --- a/srchybrid/SearchFile.cpp +++ b/srchybrid/SearchFile.cpp @@ -305,10 +305,9 @@ void CSearchFile::StoreToFile(CFileDataIO &rFile) const rFile.WriteUInt32(nTagCount); for (INT_PTR pos = 0; pos < m_taglist.GetCount(); ++pos) { const CTag *tag = m_taglist[pos]; - if (tag->GetNameID() == FT_FILERATING && tag->IsInt()) { - tag = new CTag(FT_FILERATING, (tag->GetInt() * (255 / 5)) & 0xFF); - tag->WriteNewEd2kTag(&rFile); - } else + if (tag->GetNameID() == FT_FILERATING && tag->IsInt()) + CTag(FT_FILERATING, (tag->GetInt() * (255 / 5)) & 0xFF).WriteNewEd2kTag(&rFile); + else tag->WriteNewEd2kTag(&rFile, UTF8strRaw); } if (m_FileIdentifier.HasAICHHash()) { diff --git a/srchybrid/SharedFileList.cpp b/srchybrid/SharedFileList.cpp index 871af14d..ee1f0ed9 100644 --- a/srchybrid/SharedFileList.cpp +++ b/srchybrid/SharedFileList.cpp @@ -1370,7 +1370,7 @@ void CSharedFileList::Publish() if (Kademlia::CKademlia::GetTotalStoreSrc() < KADEMLIATOTALSTORESRC) { if (tNow >= m_lastPublishKadSrc) { - if (m_currFileSrc > GetCount()) + if (m_currFileSrc >= GetCount()) m_currFileSrc = 0; CKnownFile *pCurKnownFile = GetFileByIndex(m_currFileSrc); if (pCurKnownFile && pCurKnownFile->PublishSrc()) @@ -1387,7 +1387,7 @@ void CSharedFileList::Publish() if (Kademlia::CKademlia::GetTotalStoreNotes() < KADEMLIATOTALSTORENOTES) { if (tNow >= m_lastPublishKadNotes) { - if (m_currFileNotes > GetCount()) + if (m_currFileNotes >= GetCount()) m_currFileNotes = 0; CKnownFile *pCurKnownFile = GetFileByIndex(m_currFileNotes); if (pCurKnownFile && pCurKnownFile->PublishNotes()) diff --git a/srchybrid/SplashScreen.cpp b/srchybrid/SplashScreen.cpp index f240d49b..aec4ff8b 100644 --- a/srchybrid/SplashScreen.cpp +++ b/srchybrid/SplashScreen.cpp @@ -125,7 +125,7 @@ void CSplashScreen::OnPaint() _tcscpy(lf.lfFaceName, _T("Arial")); font.CreateFontIndirect(&lf); pOldFont = dc.SelectObject(&font); - dc.DrawText(_T("Copyright (C) 2002-2020 Merkur"), &rc, DT_CENTER | DT_NOPREFIX); + dc.DrawText(_T("Copyright (C) 2002-2021 Merkur"), &rc, DT_CENTER | DT_NOPREFIX); if (pOldFont) dc.SelectObject(pOldFont); font.DeleteObject(); diff --git a/srchybrid/UPnPImplMiniLib.cpp b/srchybrid/UPnPImplMiniLib.cpp index c056f629..a89c96c1 100644 --- a/srchybrid/UPnPImplMiniLib.cpp +++ b/srchybrid/UPnPImplMiniLib.cpp @@ -147,7 +147,7 @@ void CUPnPImplMiniLib::DeletePorts(bool bSkipLock) void CUPnPImplMiniLib::StartDiscovery(uint16 nTCPPort, uint16 nUDPPort, uint16 nTCPWebPort) { DebugLog(_T("Using MiniUPnPLib based implementation")); - DebugLog(_T("miniupnpc (c) 2005-2020 Thomas Bernard - http://miniupnp.free.fr/")); + DebugLog(_T("miniupnpc (c) 2005-2021 Thomas Bernard - http://miniupnp.free.fr/")); GetOldPorts(); m_nUDPPort = nUDPPort; m_nTCPPort = nTCPPort; diff --git a/srchybrid/UploadClient.cpp b/srchybrid/UploadClient.cpp index a7e7f3d3..0d98575e 100644 --- a/srchybrid/UploadClient.cpp +++ b/srchybrid/UploadClient.cpp @@ -87,7 +87,7 @@ void CUpDownClient::DrawUpStatusBar(CDC *dc, const CRect &rect, bool onlygreyrec if (!onlygreyrect && m_abyUpPartStatus) for (UINT i = 0; i < m_nUpPartCount; ++i) if (m_abyUpPartStatus[i]) - s_UpStatusBar.FillRange(i * PARTSIZE, i * PARTSIZE + PARTSIZE - 1, crBoth); + s_UpStatusBar.FillRange(i * PARTSIZE, i * PARTSIZE + PARTSIZE, crBoth); UploadingToClient_Struct *pUpClientStruct = theApp.uploadqueue->GetUploadingClientStructByClient(this); // ASSERT( pUpClientStruct != NULL || theApp.uploadqueue->IsOnUploadQueue((CUpDownClient*)this) != NULL); @@ -99,14 +99,14 @@ void CUpDownClient::DrawUpStatusBar(CDC *dc, const CRect &rect, bool onlygreyrec block = pUpClientStruct->m_BlockRequests_queue.GetHead(); if (block) { uint32 start = (uint32)(block->StartOffset / PARTSIZE); - s_UpStatusBar.FillRange(start * PARTSIZE, start * PARTSIZE + PARTSIZE - 1, crNextSending); + s_UpStatusBar.FillRange(start * PARTSIZE, start * PARTSIZE + PARTSIZE, crNextSending); } } if (!pUpClientStruct->m_DoneBlocks_list.IsEmpty()) { block = pUpClientStruct->m_DoneBlocks_list.GetHead(); if (block) { uint32 start = (uint32)(block->StartOffset / PARTSIZE); - s_UpStatusBar.FillRange(start * PARTSIZE, start * PARTSIZE + PARTSIZE - 1, crNextSending); + s_UpStatusBar.FillRange(start * PARTSIZE, start * PARTSIZE + PARTSIZE, crNextSending); } for (POSITION pos = pUpClientStruct->m_DoneBlocks_list.GetHeadPosition();pos != 0;) { block = pUpClientStruct->m_DoneBlocks_list.GetNext(pos); diff --git a/srchybrid/Version.h b/srchybrid/Version.h index f3f852ad..e1460757 100644 --- a/srchybrid/Version.h +++ b/srchybrid/Version.h @@ -30,8 +30,8 @@ // #define VERSION_MJR 0 #define VERSION_MIN 60 -#define VERSION_UPDATE 0 -#define VERSION_BUILD 8 +#define VERSION_UPDATE 1 +#define VERSION_BUILD 3 #ifdef _M_X64 #define VERSION_X64 _T(" x64") #else diff --git a/srchybrid/emule.rc b/srchybrid/emule.rc index 8f29982e..943a280b 100644 --- a/srchybrid/emule.rc +++ b/srchybrid/emule.rc @@ -1221,7 +1221,7 @@ BEGIN ICON "",IDC_COLLECTIONSOURCELISTICON,7,6,20,20 CONTROL "Sign collection with name and key",IDC_COLLECTIONCREATESIGNCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,168,367,10 - CONTROL "Save collection in a simple text format",IDC_COLLECTIONCREATEFORMAT, + CONTROL "Save collection in plain text format",IDC_COLLECTIONCREATEFORMAT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,158,368,10 RTEXT "Static",IDC_CCOLL_STATIC_NAME,14,128,75,10,0 GROUPBOX "Basic Options",IDC_CCOLL_BASICOPTIONS,7,117,389,27 @@ -1236,7 +1236,7 @@ BEGIN DEFPUSHBUTTON "Exit",IDC_VCOLL_CLOSE,361,232,50,14 CONTROL "",IDC_COLLECTIONVEWLIST,"SysListView32",LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_OWNERDRAWFIXED | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,17,404,140 PUSHBUTTON "Download",IDC_VIEWCOLLECTIONDL,305,232,50,14 - CONTROL "Add new downloads in a collection category",IDC_COLLECTIONVIEWCATEGORYCHECK, + CONTROL "Add new downloads into the collection category",IDC_COLLECTIONVIEWCATEGORYCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,211,377,10 LTEXT "Collection List",IDC_COLLECTIONVIEWLISTLABEL,24,7,99,8 ICON "",IDC_COLLECTIONVIEWLISTICON,7,6,20,20 @@ -1916,7 +1916,7 @@ BEGIN IDS_ERR_BADHASHSET "Corrupted or invalid hashset received" IDS_ERR_BADDATABLOCK "Corrupted or invalid data block received" IDS_ERR_ILLFORMEDHASH "Ill-formed hash" - IDS_ERR_BADED2KLINK "Not a well-formed eD2K link" + IDS_ERR_BADED2KLINK "Ill-formed eD2K link" IDS_ERR_NOSLLINK "Not an eD2K server or file link" IDS_ERR_WRONGPACKETSIZE "Invalid OP_REQUESTFILENAME packet size" IDS_ERR_WRONGHPACKETSIZE "Invalid OP_HASHSETREQUEST packet size" @@ -2272,7 +2272,7 @@ END STRINGTABLE BEGIN IDS_WS_PASS "Password" - IDS_WS_ERR_LOADTEMPLATE "Can't load templates: replace file %s with a newer version!" + IDS_WS_ERR_LOADTEMPLATE "Can't load templates: replace the file %s with a newer version!" IDS_WEB_CONLIMITS "Connection Limits" IDS_INFLST_USER_TOTALDOWNLOAD "Downloaded total" IDS_INFLST_USER_TOTALUPLOAD "Uploaded total" @@ -2542,7 +2542,7 @@ BEGIN IDS_HARDLIMIT "Hard limit" IDS_COL_MORECOLORS "more..." IDS_TOOMANYCONNS "Too many connections" - IDS_DOWNLOADRENAMED "A file with that name already exists, the file has been saved as %s" + IDS_DOWNLOADRENAMED "A file with this name already exists, the file has been saved as %s" IDS_TBN_DOWNLOADDONE "Downloaded:" IDS_PW_TBN_USESOUND "Play sound" IDS_PW_TBN_ONLOG "Log entry added" @@ -2576,7 +2576,7 @@ BEGIN IDS_RAU_RUNNING "eMule running as unprivileged user ""%s""" IDS_RAU_FAILED "Failed to start eMule as unprivileged user ""eMule_Secure"". Keeping the privileges of the current user (""%s"")." IDS_KADCONTACTSREAD "Read %u contacts from file." - IDS_ERR_KADCONTACTS "No contacts found, please bootstrap, or download a nodes.dat file." + IDS_ERR_KADCONTACTS "No contacts found, please bootstrap, or download nodes.dat file." IDS_METATAGS "Meta tag count:" IDS_FILEFORMAT "Format" IDS_UDPREASKS "UDP File Re-asks" @@ -2703,7 +2703,7 @@ BEGIN IDS_STATS_FRATIO "Session UL:DL Ratio (Friends UL excluded):" IDS_STATS_UDATA_FRIENDS "Uploaded Data to Friend Slots (Session): %s" IDS_IMP_ERR_BADFORMAT "Unknown or bad format of temporary file." - IDS_SEARCH_INVALIDCHAR "Search expression contains invalid characters. You either entered a '?' character or entered characters which can not be used in this network." + IDS_SEARCH_INVALIDCHAR "Search expression contains invalid characters. You either entered '?' character or entered characters which can not be used in this network." IDS_PORTSCON "Ports and Connection" IDS_PORTINFO "eMule uses two ports for communication with servers and clients. These ports must be free and available for remote clients. The TCP port must be available to ensure the main functionality of eMule. The UDP port is used for Kad (serverless network) and to reduce network usage (Overhead).\n\nYou can change the ports here while no network activities have started." IDS_IRC_BAN "Ban" @@ -2800,7 +2800,7 @@ BEGIN IDS_STATS_MAXDL "max. Downloadrate: %s" IDS_IRC_EMULEPROTO_IGNOREADDFRIEND "Ignore eMule add friend protocol messages" IDS_PW_FASTSRVCON "Safe Connect" - IDS_SOURCELINKFAILED "You need a HighID to create a valid source link" + IDS_SOURCELINKFAILED "You need a high ID to create a valid source link" IDS_ERR_LOADSERVERMET "Failed to load server.met!" IDS_ERR_CORRUPTCOMPRPKG "Corrupted compressed packet for %s received (error %u)" IDS_ERR_EMFRIENDSINVALID "The file 'emfriends.met' is invalid or corrupted!" @@ -2813,7 +2813,7 @@ STRINGTABLE BEGIN IDS_WIZ_UP "Up (kbit/s)" IDS_SELECT_INCOMINGDIR "Choose a folder for incoming files" - IDS_SELECT_TEMPDIR "Choose a folder for temp files" + IDS_SELECT_TEMPDIR "Choose a folder for temporary files" IDS_PRIOAUTO "Auto" IDS_PRIOAUTONORMAL "Auto [No]" IDS_PRIOAUTOHIGH "Auto [Hi]" @@ -3233,7 +3233,7 @@ STRINGTABLE BEGIN IDS_FD_DOWNLOADSTARTED "Download added:" IDS_FAILEDREOPEN "Fatal Error: Failed to reopen part file '%s' (%s)!" - IDS_ERR_PREVIEWALREADY "There is already a preview request pending from this client" + IDS_ERR_PREVIEWALREADY "There is already a pending preview request from this client" IDS_ERR_PREVIEWFAILED "Preview from user '%s' failed" IDS_DWTOT "Disk Space" IDS_DWTOT_NR "Number of Downloads: %u" @@ -3454,7 +3454,7 @@ BEGIN IDS_STATS_MINORCLIENTS "Minor" IDS_AICH_SYNCTOTAL "Found %u files without valid AICH Hashset, going to rehash those files now" IDS_AICH_CALCFILE "Calculating AICH Hash for file %s" - IDS_AICH_WARNUSER "Since version 0.44a eMule uses an additional file hash which helps to greatly reduce the data loss when a corruption is detected. Because your are updating from an earlier version, eMule needs to rehash all your shared files to calculate the new hash. This may take a while but is an one-time action. " + IDS_AICH_WARNUSER "Since version 0.44a eMule uses an additional file hash which helps to greatly reduce the data loss when corruption is detected. Because your are updating from an earlier version, eMule needs to rehash all your shared files to calculate the new hash. This may take a while but is a one-time action." IDS_AICH_WORKED "AICH successfully recovered %s of %s from part %u for %s" IDS_SOURCECLIENT "Source Client" IDS_USERSIP "User's IP" @@ -3525,13 +3525,13 @@ BEGIN IDS_COLL_SIGN "Sign collection with name and key" IDS_AUTHOR "Author" IDS_AUTHORKEY "Author Key" - IDS_COLL_ADDINCAT "Add new downloads in a collection category" + IDS_COLL_ADDINCAT "Add new downloads into the collection category" IDS_VIEWCOLLECTION "View Collection..." END STRINGTABLE BEGIN - IDS_COLL_TEXTFORMAT "Save collection in a simple text format" + IDS_COLL_TEXTFORMAT "Save collection in plain text format" IDS_RUNNINGRESTRICTED "eMule is running with reduced privileges" IDS_USS_MANUALUPLOADLIMITDETECTED "UploadSpeedSense: Raised upload limit in Options detected. Going into fast reaction mode for 60 seconds." IDS_USS_STATE_PREPARING "Preparing..." @@ -3561,7 +3561,7 @@ BEGIN IDS_CONVERTINGKNOWN2DONE "... done, finished converting" IDS_ERR_MET_BAD "Error: the file %s is corrupted, unable to load known files" IDS_SRV_LARGEFILES "Support for large files" - IDS_ERR_FSCANTHANDLEFILE "You cannot download this file because your file system doesn't supports files which are larger than 4GB, consider converting it to NTFS" + IDS_ERR_FSCANTHANDLEFILE "You cannot download this file because your file system doesn't support files which are larger than 4GB, consider converting it to NTFS" IDS_NEWVERSIONAVLBETA "This Beta version is out of date. Due to the nature of Beta versions, which often contain bugs it is very important that you update to a stable release as soon as possible!" IDS_BOLD "Toggles bold text" IDS_UNDERLINE "Toggles underlined text" @@ -3651,7 +3651,7 @@ END STRINGTABLE BEGIN - IDS_SHAREEMULEWARNING "Changing this option will let eMule to use another configuration. Your current settings will be ignored and already started downloads might not be visible any more. You can switch back to your current configuration by changing this option again anytime.\n\nYou need to restart eMule for this change to take effect." + IDS_SHAREEMULEWARNING "Changing this option will let eMule use another configuration. Your current settings will be ignored and already started downloads might not be visible any more. You can switch back to your current configuration by changing this option again anytime.\n\nYou need to restart eMule for this change to take effect." IDS_SPAM "Spam" IDS_MARKSPAM "Mark as Spam" IDS_MARKNOTSPAM "Mark as not Spam" @@ -3695,7 +3695,7 @@ BEGIN IDS_WEBUPNPINCLUDE "Include port into UPnP setup" IDS_ADDEDON "Added On" IDS_RESOLVELINKS "Resolve shell links in shared directories" - IDS_PAUSEONPREVIEW "Pause when preview possible" + IDS_PAUSEONPREVIEW "Pause when preview is possible" IDS_PREVIEWWITH "Preview with" IDS_DOWNLOADCOMMANDS "Download Commands" IDS_CLOSETOOLBAR "Close Toolbar" diff --git a/srchybrid/kademlia/kademlia/Entry.cpp b/srchybrid/kademlia/kademlia/Entry.cpp index 181c7249..3a7a4302 100644 --- a/srchybrid/kademlia/kademlia/Entry.cpp +++ b/srchybrid/kademlia/kademlia/Entry.cpp @@ -715,7 +715,7 @@ void CKeyEntry::WriteTagListWithPublishInfo(CDataIO *pData) uint8 nSize = (uint8)fileAICHTag.GetLength(); BYTE *byBuffer = fileAICHTag.Detach(); const CKadTagBsob tag1(TAG_KADAICHHASHRESULT, byBuffer, nSize); - pData->WriteTag(&tag); + pData->WriteTag(&tag1); free(byBuffer); } } diff --git a/srchybrid/kademlia/utils/UInt128.cpp b/srchybrid/kademlia/utils/UInt128.cpp index 874ae8f2..f7d66499 100644 --- a/srchybrid/kademlia/utils/UInt128.cpp +++ b/srchybrid/kademlia/utils/UInt128.cpp @@ -8,7 +8,7 @@ version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. m_u64Data[0]See the +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License diff --git a/srchybrid/lang/ar_AE.vcxproj.user b/srchybrid/lang/ar_AE.vcxproj.user deleted file mode 100644 index be250787..00000000 --- a/srchybrid/lang/ar_AE.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/srchybrid/res/emule.rc2 b/srchybrid/res/emule.rc2 index 17c1c89e..cb4a492d 100644 --- a/srchybrid/res/emule.rc2 +++ b/srchybrid/res/emule.rc2 @@ -38,7 +38,7 @@ BEGIN VALUE "FileDescription", "eMule" VALUE "FileVersion", SZ_VERSION_NAME " Unicode" VALUE "InternalName", "emule.exe" - VALUE "LegalCopyright", "Copyright © 2002-2020 Merkur - Read license.txt for more infos." + VALUE "LegalCopyright", "Copyright © 2002-2021 Merkur - Read license.txt for more infos." VALUE "OriginalFilename", "emule.exe" VALUE "ProductName", "eMule" VALUE "ProductVersion", SZ_VERSION_NAME " Unicode" diff --git a/srchybrid/res/emuleWin32.manifest b/srchybrid/res/emuleWin32.manifest index 06c65961..05e84563 100644 --- a/srchybrid/res/emuleWin32.manifest +++ b/srchybrid/res/emuleWin32.manifest @@ -4,7 +4,7 @@ name="eMule" processorArchitecture="x86" publicKeyToken="0000000000000000" - version="0.60.0.8" + version="0.60.1.3" /> eMule by https://www.emule-project.net diff --git a/srchybrid/res/emulex64.manifest b/srchybrid/res/emulex64.manifest index b638b4b2..b1b6de66 100644 --- a/srchybrid/res/emulex64.manifest +++ b/srchybrid/res/emulex64.manifest @@ -4,7 +4,7 @@ name="eMule" processorArchitecture="ia64" publicKeyToken="0000000000000000" - version="0.60.0.8" + version="0.60.1.3" /> eMule by https://www.emule-project.net