diff options
Diffstat (limited to 'SwifTools')
| -rw-r--r-- | SwifTools/Application/WindowsApplicationPathProvider.cpp | 17 | ||||
| -rw-r--r-- | SwifTools/Application/WindowsApplicationPathProvider.h | 15 | ||||
| -rw-r--r-- | SwifTools/Cocoa/CocoaAction.mm | 4 | ||||
| -rw-r--r-- | SwifTools/CrashReporter.cpp | 14 | ||||
| -rw-r--r-- | SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp | 3 | ||||
| -rw-r--r-- | SwifTools/Idle/MacOSXIdleQuerier.cpp | 3 | ||||
| -rw-r--r-- | SwifTools/URIHandler/MacOSXURIHandler.mm | 4 | ||||
| -rw-r--r-- | SwifTools/URIHandler/UnitTest/XMPPURITest.cpp | 8 | ||||
| -rw-r--r-- | SwifTools/UnitTest/LastLineTrackerTest.cpp | 2 | ||||
| -rw-r--r-- | SwifTools/UnitTest/TabCompleteTest.cpp | 2 | 
10 files changed, 41 insertions, 31 deletions
| diff --git a/SwifTools/Application/WindowsApplicationPathProvider.cpp b/SwifTools/Application/WindowsApplicationPathProvider.cpp index 8514fa7..730a57a 100644 --- a/SwifTools/Application/WindowsApplicationPathProvider.cpp +++ b/SwifTools/Application/WindowsApplicationPathProvider.cpp @@ -7,6 +7,7 @@  #include <SwifTools/Application/WindowsApplicationPathProvider.h>  #include <windows.h> +#include <cassert>  namespace Swift { @@ -15,4 +16,20 @@ WindowsApplicationPathProvider::WindowsApplicationPathProvider(const std::string  	resourceDirs.push_back(getExecutableDir() / "../resources"); // Development  } +boost::filesystem::path WindowsApplicationPathProvider::getDataDir() const { +	char* appDirRaw = getenv("APPDATA"); +	assert(appDirRaw); +	boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName()); +	boost::filesystem::create_directory(result); +	return result; +} + +boost::filesystem::path WindowsApplicationPathProvider::getHomeDir() const { +	//FIXME: This should be My Documents  +	char* homeDirRaw = getenv("USERPROFILE"); +	assert(homeDirRaw); +	return boost::filesystem::path(homeDirRaw); +} + +  } diff --git a/SwifTools/Application/WindowsApplicationPathProvider.h b/SwifTools/Application/WindowsApplicationPathProvider.h index f288326..a4e8668 100644 --- a/SwifTools/Application/WindowsApplicationPathProvider.h +++ b/SwifTools/Application/WindowsApplicationPathProvider.h @@ -13,19 +13,8 @@ namespace Swift {  		public:  			WindowsApplicationPathProvider(const std::string& name); -			boost::filesystem::path getDataDir() const { -				char* appDirRaw = getenv("APPDATA"); -				boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName()); -				boost::filesystem::create_directory(result); -				return result; -			} - -			boost::filesystem::path getHomeDir() const { -				//FIXME: This should be My Documents  -				 -				char* homeDirRaw = getenv("USERPROFILE"); -				return boost::filesystem::path(homeDirRaw); -			} +			boost::filesystem::path getDataDir() const; +			boost::filesystem::path getHomeDir() const;  			virtual std::vector<boost::filesystem::path> getResourceDirs() const {  				return resourceDirs; diff --git a/SwifTools/Cocoa/CocoaAction.mm b/SwifTools/Cocoa/CocoaAction.mm index d560787..d315caf 100644 --- a/SwifTools/Cocoa/CocoaAction.mm +++ b/SwifTools/Cocoa/CocoaAction.mm @@ -1,5 +1,5 @@  /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ @@ -9,7 +9,7 @@  @implementation CocoaAction  - (id) initWithFunction: (boost::function<void()>*) f { -    if ([super init]) { +    if ((self = [super init])) {  			function = f;  		}      return self; diff --git a/SwifTools/CrashReporter.cpp b/SwifTools/CrashReporter.cpp index 4a07e40..42a98d8 100644 --- a/SwifTools/CrashReporter.cpp +++ b/SwifTools/CrashReporter.cpp @@ -52,12 +52,14 @@ CrashReporter::CrashReporter(const boost::filesystem::path& path) {  #if defined(SWIFTEN_PLATFORM_WINDOWS)  	// FIXME: Need UTF8 conversion from string to wstring  	std::string pathString = path.string(); -	p->handler = boost::make_shared<google_breakpad::ExceptionHandler>( -			std::wstring(pathString.begin(), pathString.end()),  -			(google_breakpad::ExceptionHandler::FilterCallback) 0,  -			handleDump,  -			(void*) 0,  -			google_breakpad::ExceptionHandler::HANDLER_ALL); +	p->handler = boost::shared_ptr<google_breakpad::ExceptionHandler>( +			// Not using make_shared, because 'handleDump' seems to have problems with VC2010 +			new google_breakpad::ExceptionHandler( +				std::wstring(pathString.begin(), pathString.end()),  +				(google_breakpad::ExceptionHandler::FilterCallback) 0,  +				handleDump,  +				(void*) 0,  +				google_breakpad::ExceptionHandler::HANDLER_ALL));  // Turning it off for Mac, because it doesn't really help us  //#elif defined(SWIFTEN_PLATFORM_MACOSX)  //	p->handler = boost::make_shared<google_breakpad::ExceptionHandler>(path.string(), (google_breakpad::ExceptionHandler::FilterCallback) 0, handleDump, (void*) 0, true, (const char*) 0); diff --git a/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp b/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp index df233a2..41238a0 100644 --- a/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp +++ b/SwifTools/Idle/IdleQuerierTest/IdleQuerierTest.cpp @@ -5,6 +5,7 @@   */  #include <iostream> +#include <cassert>  #include <SwifTools/Idle/PlatformIdleQuerier.h>  #include <Swiften/Base/sleep.h> @@ -17,6 +18,6 @@ int main() {  		std::cout << "Idle time: " << querier.getIdleTimeSeconds() << std::endl;  		Swift::sleep(1000);  	} - +	assert(false);  	return 0;  } diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp index 233d7c6..8eaece6 100644 --- a/SwifTools/Idle/MacOSXIdleQuerier.cpp +++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp @@ -10,6 +10,7 @@  #include <cassert>  #include <iostream> +#include <boost/numeric/conversion/cast.hpp>  #include <CoreFoundation/CoreFoundation.h>  namespace Swift { @@ -28,7 +29,7 @@ int MacOSXIdleQuerier::getIdleTimeSeconds() {  	assert(result);  	(void) result;  	CFRelease(property); -	return idle / 1000000000; +	return boost::numeric_cast<int>(idle / 1000000000);  }  } diff --git a/SwifTools/URIHandler/MacOSXURIHandler.mm b/SwifTools/URIHandler/MacOSXURIHandler.mm index 0575d47..d386c86 100644 --- a/SwifTools/URIHandler/MacOSXURIHandler.mm +++ b/SwifTools/URIHandler/MacOSXURIHandler.mm @@ -1,5 +1,5 @@  /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2013 Remko Tronçon   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ @@ -20,7 +20,7 @@ using namespace Swift;  @end  @implementation MacOSXURIEventHandler  	- (id) initWithHandler: (URIHandler*) h { -		if ([super init]) { +		if ((self = [super init])) {  			handler = h;  		}  		return self; diff --git a/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp b/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp index 8d03b60..35020da 100644 --- a/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp +++ b/SwifTools/URIHandler/UnitTest/XMPPURITest.cpp @@ -65,9 +65,9 @@ class XMPPURITest : public CppUnit::TestFixture {  		}  		void testFromString_AuthorityWithIntlChars() { -			XMPPURI testling = XMPPURI::fromString("xmpp://nasty!%23$%25()*+,-.;=\%3F\%5B\%5C\%5D\%5E_\%60\%7B\%7C\%7D~node@example.com"); +			XMPPURI testling = XMPPURI::fromString("xmpp://nasty!%23$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%7D~node@example.com"); -			CPPUNIT_ASSERT_EQUAL(JID("nasty!#$\%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getAuthority()); +			CPPUNIT_ASSERT_EQUAL(JID("nasty!#$%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getAuthority());  		}  		void testFromString_AuthorityWithQueryWithoutParameters() { @@ -118,9 +118,9 @@ class XMPPURITest : public CppUnit::TestFixture {  		}  		void testFromString_PathWithIntlChars() { -			XMPPURI testling = XMPPURI::fromString("xmpp:nasty!%23$%25()*+,-.;=\%3F\%5B\%5C\%5D\%5E_\%60\%7B\%7C\%7D~node@example.com"); +			XMPPURI testling = XMPPURI::fromString("xmpp:nasty!%23$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%7D~node@example.com"); -			CPPUNIT_ASSERT_EQUAL(JID("nasty!#$\%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getPath()); +			CPPUNIT_ASSERT_EQUAL(JID("nasty!#$%()*+,-.;=?[\\]^_`{|}~node@example.com"), testling.getPath());  		}  		void testFromString_PathWithInvalidEscapedChar() { diff --git a/SwifTools/UnitTest/LastLineTrackerTest.cpp b/SwifTools/UnitTest/LastLineTrackerTest.cpp index a7046ed..97790e5 100644 --- a/SwifTools/UnitTest/LastLineTrackerTest.cpp +++ b/SwifTools/UnitTest/LastLineTrackerTest.cpp @@ -21,7 +21,7 @@ class LastLineTrackerTest : public CppUnit::TestFixture {  	CPPUNIT_TEST_SUITE_END();  	public:  	LastLineTrackerTest () { -	}; +	}  	void testFocusNormal() {  		LastLineTracker testling;  		testling.setHasFocus(true); diff --git a/SwifTools/UnitTest/TabCompleteTest.cpp b/SwifTools/UnitTest/TabCompleteTest.cpp index 0466484..cdb0296 100644 --- a/SwifTools/UnitTest/TabCompleteTest.cpp +++ b/SwifTools/UnitTest/TabCompleteTest.cpp @@ -24,7 +24,7 @@ class TabCompleteTest : public CppUnit::TestFixture {  	CPPUNIT_TEST_SUITE_END();  public: -	TabCompleteTest() {}; +	TabCompleteTest() {}  	void setUp() {  		completer_ = TabComplete(); | 
 Swift
 Swift