From 854574569e17c1d6c5719426fe4f9926e28cb1a0 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Sun, 22 May 2011 11:25:53 +0000 Subject: [PATCH] Fixed creation of ed2k links with source or crypt options with wx 2.9 (solving issue #1671) uint8 behaves as unsigned char with wx 2.9. So "wxString << uint8" appends a (probably strange) char instead of a number. I wonder why this works with wx 2.8. --- .svn-revision | 2 +- src/amuleAppCommon.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.svn-revision b/.svn-revision index f6a15fb2..3d644fe9 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10567 +10568 diff --git a/src/amuleAppCommon.cpp b/src/amuleAppCommon.cpp index 183cc1b4..f8f60962 100644 --- a/src/amuleAppCommon.cpp +++ b/src/amuleAppCommon.cpp @@ -162,20 +162,22 @@ wxString CamuleAppCommon::CreateED2kLink(const CAbstractFile *f, bool add_source strURL << thePrefs::GetYourHostname(); } else { uint32 clientID = theApp->GetID(); - strURL << (uint8) clientID << wxT(".") << - (uint8)(clientID >> 8) << wxT(".") << - (uint8)(clientID >> 16) << wxT(".") << - (uint8)(clientID >> 24); + strURL = CFormat(wxT("%s%u.%u.%u.%u")) + % strURL + % (clientID & 0xff) + % ((clientID >> 8) & 0xff) + % ((clientID >> 16) & 0xff) + % ((clientID >> 24) & 0xff); } strURL << wxT(":") << thePrefs::GetPort(); if (addcryptoptions) { - const uint8 uSupportsCryptLayer = thePrefs::IsClientCryptLayerSupported() ? 1 : 0; - const uint8 uRequestsCryptLayer = thePrefs::IsClientCryptLayerRequested() ? 1 : 0; - const uint8 uRequiresCryptLayer = thePrefs::IsClientCryptLayerRequired() ? 1 : 0; - const uint8 byCryptOptions = (uRequiresCryptLayer << 2) | (uRequestsCryptLayer << 1) | (uSupportsCryptLayer << 0) | (uSupportsCryptLayer ? 0x80 : 0x00); + uint8 uSupportsCryptLayer = thePrefs::IsClientCryptLayerSupported() ? 1 : 0; + uint8 uRequestsCryptLayer = thePrefs::IsClientCryptLayerRequested() ? 1 : 0; + uint8 uRequiresCryptLayer = thePrefs::IsClientCryptLayerRequired() ? 1 : 0; + uint16 byCryptOptions = (uRequiresCryptLayer << 2) | (uRequestsCryptLayer << 1) | (uSupportsCryptLayer << 0) | (uSupportsCryptLayer ? 0x80 : 0x00); strURL << wxT(":") << byCryptOptions; -- 2.11.4.GIT