diff options
| -rw-r--r-- | cocoa/PlatCocoa.mm | 51 | ||||
| -rwxr-xr-x | gtk/PlatGTK.cxx | 40 | ||||
| -rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 44 | ||||
| -rw-r--r-- | src/Platform.h | 17 | ||||
| -rw-r--r-- | win32/PlatWin.cxx | 36 | 
5 files changed, 0 insertions, 188 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 3939147c2..ff1e3d013 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -2136,55 +2136,4 @@ void Platform::Assert(const char *c, const char *file, int line) noexcept {  #endif  } -//----------------- DynamicLibrary ----------------------------------------------------------------- - -/** - * Platform-specific module loading and access. - * Uses POSIX calls dlopen, dlsym, dlclose. - */ - -class DynamicLibraryImpl : public DynamicLibrary { -protected: -	void *m; -public: -	explicit DynamicLibraryImpl(const char *modulePath) noexcept { -		m = dlopen(modulePath, RTLD_LAZY); -	} -	// Deleted so DynamicLibraryImpl objects can not be copied. -	DynamicLibraryImpl(const DynamicLibraryImpl&) = delete; -	DynamicLibraryImpl(DynamicLibraryImpl&&) = delete; -	DynamicLibraryImpl&operator=(const DynamicLibraryImpl&) = delete; -	DynamicLibraryImpl&operator=(DynamicLibraryImpl&&) = delete; - -	~DynamicLibraryImpl() override { -		if (m) -			dlclose(m); -	} - -	// Use dlsym to get a pointer to the relevant function. -	Function FindFunction(const char *name) override { -		if (m) { -			return dlsym(m, name); -		} else { -			return nullptr; -		} -	} - -	bool IsValid() override { -		return m != nullptr; -	} -}; - -/** -* Implements the platform specific part of library loading. -* -* @param modulePath The path to the module to load. -* @return A library instance or nullptr if the module could not be found or another problem occurred. -*/ - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { -	return static_cast<DynamicLibrary *>(new DynamicLibraryImpl(modulePath)); -} -  //-------------------------------------------------------------------------------------------------- - diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index d055ac241..5ea2af191 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1955,46 +1955,6 @@ void Menu::Show(Point pt, Window &w) {  #endif  } -class DynamicLibraryImpl : public DynamicLibrary { -protected: -	GModule *m; -public: -	explicit DynamicLibraryImpl(const char *modulePath) noexcept { -		m = g_module_open(modulePath, G_MODULE_BIND_LAZY); -	} -	// Deleted so DynamicLibraryImpl objects can not be copied. -	DynamicLibraryImpl(const DynamicLibraryImpl&) = delete; -	DynamicLibraryImpl(DynamicLibraryImpl&&) = delete; -	DynamicLibraryImpl&operator=(const DynamicLibraryImpl&) = delete; -	DynamicLibraryImpl&operator=(DynamicLibraryImpl&&) = delete; -	~DynamicLibraryImpl() override { -		if (m != nullptr) -			g_module_close(m); -	} - -	// Use g_module_symbol to get a pointer to the relevant function. -	Function FindFunction(const char *name) override { -		if (m != nullptr) { -			gpointer fn_address = nullptr; -			const gboolean status = g_module_symbol(m, name, &fn_address); -			if (status) -				return static_cast<Function>(fn_address); -			else -				return nullptr; -		} else { -			return nullptr; -		} -	} - -	bool IsValid() override { -		return m != nullptr; -	} -}; - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { -	return static_cast<DynamicLibrary *>(new DynamicLibraryImpl(modulePath)); -} -  ColourDesired Platform::Chrome() {  	return ColourDesired(0xe0, 0xe0, 0xe0);  } diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 72f2b8d5f..d41dbfbf3 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -1134,50 +1134,6 @@ void Menu::Show(Point pt, Window & /*w*/)  //---------------------------------------------------------------------- -class DynamicLibraryImpl : public DynamicLibrary { -protected: -	QLibrary *lib; -public: -	explicit DynamicLibraryImpl(const char *modulePath) { -		QString path = QString::fromUtf8(modulePath); -		lib = new QLibrary(path); -	} -	// Deleted so DynamicLibraryImpl objects can not be copied -	DynamicLibraryImpl(const DynamicLibraryImpl &) = delete; -	DynamicLibraryImpl(DynamicLibraryImpl &&) = delete; -	DynamicLibraryImpl &operator=(const DynamicLibraryImpl &) = delete; -	DynamicLibraryImpl &operator=(DynamicLibraryImpl &&) = delete; - -	virtual ~DynamicLibraryImpl() { -		if (lib) -			lib->unload(); -		lib = nullptr; -	} -	Function FindFunction(const char *name) override { -		if (lib) { -			// Use memcpy as it doesn't invoke undefined or conditionally defined behaviour. -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -			QFunctionPointer fp {}; -#else -			void *fp = nullptr; -#endif -			fp = lib->resolve(name); -			Function f = nullptr; -			static_assert(sizeof(f) == sizeof(fp)); -			memcpy(&f, &fp, sizeof(f)); -			return f; -		} -		return nullptr; -	} -	bool IsValid() override { -		return lib != nullptr; -	} -}; -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) -{ -	return static_cast<DynamicLibrary *>(new DynamicLibraryImpl(modulePath)); -} -  ColourDesired Platform::Chrome()  {  	QColor c(Qt::gray); diff --git a/src/Platform.h b/src/Platform.h index 346e057b1..19898a1c4 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -514,23 +514,6 @@ public:  	void Show(Point pt, Window &w);  }; -/** - * Dynamic Library (DLL/SO/...) loading - */ -class DynamicLibrary { -public: -	virtual ~DynamicLibrary() = default; - -	/// @return Pointer to function "name", or NULL on failure. -	virtual Function FindFunction(const char *name) = 0; - -	/// @return true if the library was loaded successfully. -	virtual bool IsValid() = 0; - -	/// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. -	static DynamicLibrary *Load(const char *modulePath); -}; -  #if defined(__clang__)  # if __has_feature(attribute_analyzer_noreturn)  #  define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 6fbd05cea..e9f451bfb 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -3410,42 +3410,6 @@ void Menu::Show(Point pt, Window &w) {  	Destroy();  } -class DynamicLibraryImpl : public DynamicLibrary { -protected: -	HMODULE h; -public: -	explicit DynamicLibraryImpl(const char *modulePath) noexcept { -		h = ::LoadLibraryA(modulePath); -	} - -	~DynamicLibraryImpl() override { -		if (h) -			::FreeLibrary(h); -	} - -	// Use GetProcAddress to get a pointer to the relevant function. -	Function FindFunction(const char *name) noexcept override { -		if (h) { -			// Use memcpy as it doesn't invoke undefined or conditionally defined behaviour. -			FARPROC fp = ::GetProcAddress(h, name); -			Function f = nullptr; -			static_assert(sizeof(f) == sizeof(fp)); -			memcpy(&f, &fp, sizeof(f)); -			return f; -		} else { -			return nullptr; -		} -	} - -	bool IsValid() noexcept override { -		return h != NULL; -	} -}; - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { -	return static_cast<DynamicLibrary *>(new DynamicLibraryImpl(modulePath)); -} -  ColourDesired Platform::Chrome() {  	return ColourDesired(::GetSysColor(COLOR_3DFACE));  }  | 
