From 436b1d183d29591858192df1c136de5035c196d5 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 30 Jan 2019 19:15:18 +0200 Subject: [PATCH] Remove partial exception specifiers These are deprecated in newer C++ versions. --- include/core/advdumper.hpp | 23 +-- include/core/audioapi-driver.hpp | 7 +- include/core/controllerframe.hpp | 2 +- include/core/framebuffer.hpp | 6 +- include/core/mainloop.hpp | 3 +- include/core/memorymanip.hpp | 2 +- include/core/misc.hpp | 2 +- include/core/movie.hpp | 14 +- include/core/moviedata.hpp | 11 +- include/core/moviefile.hpp | 17 +- include/core/queue.hpp | 9 +- include/core/random.hpp | 6 +- include/core/rom.hpp | 16 +- include/core/romimage.hpp | 10 +- include/core/window.hpp | 6 +- include/interface/romtype.hpp | 12 +- include/interface/setting.hpp | 11 +- include/library/command.hpp | 52 ++--- include/library/fileimage-patch.hpp | 6 +- include/library/fileimage.hpp | 6 +- include/library/framebuffer-font2.hpp | 5 +- include/library/framebuffer-pixfmt-lrgb.hpp | 4 +- include/library/framebuffer-pixfmt-rgb15.hpp | 4 +- include/library/framebuffer-pixfmt-rgb16.hpp | 4 +- include/library/framebuffer-pixfmt-rgb24.hpp | 4 +- include/library/framebuffer-pixfmt-rgb32.hpp | 4 +- include/library/framebuffer-pixfmt.hpp | 6 +- include/library/framebuffer.hpp | 36 ++-- include/library/globalwrap.hpp | 4 +- include/library/hex.hpp | 18 +- include/library/integer-pool.hpp | 2 +- include/library/json.hpp | 206 +++++++++---------- include/library/keyboard-mapper.hpp | 66 +++--- include/library/keyboard.hpp | 55 +++-- include/library/loadlib.hpp | 15 +- include/library/lua-base.hpp | 8 +- include/library/lua-class.hpp | 4 +- include/library/lua-framebuffer.hpp | 6 +- include/library/lua-function.hpp | 2 +- include/library/memorysearch.hpp | 6 +- include/library/messagebuffer.hpp | 24 +-- include/library/movie.hpp | 26 ++- include/library/ogg.hpp | 18 +- include/library/opus-ogg.hpp | 9 +- include/library/portctrl-data.hpp | 56 +++-- include/library/portctrl-parse.hpp | 2 +- include/library/rrdata.hpp | 10 +- include/library/settingvar.hpp | 43 ++-- include/library/sha256.hpp | 12 +- include/library/skein.hpp | 6 +- include/library/stateobject.hpp | 2 +- include/library/string.hpp | 26 ++- include/library/triplebuffer.hpp | 8 +- include/library/zip.hpp | 63 +++--- include/lua/lua.hpp | 6 +- include/platform/wxwidgets/platform.hpp | 10 +- include/video/sox.hpp | 5 +- src/core/actions.cpp | 2 +- src/core/advdumper.cpp | 14 +- src/core/audioapi-driver.cpp | 14 +- src/core/controllerframe.cpp | 4 +- src/core/disassemble.cpp | 2 +- src/core/framebuffer.cpp | 6 +- src/core/instance.cpp | 2 +- src/core/keymapper.cpp | 4 +- src/core/loadlib.cpp | 6 +- src/core/mainloop.cpp | 103 +++++----- src/core/memorymanip.cpp | 30 ++- src/core/misc.cpp | 2 +- src/core/movie.cpp | 10 +- src/core/moviedata.cpp | 16 +- src/core/moviefile-binary.cpp | 4 +- src/core/moviefile-text-load.cpp | 6 +- src/core/moviefile-text-save.cpp | 6 +- src/core/moviefile.cpp | 7 +- src/core/queue.cpp | 7 +- src/core/random.cpp | 6 +- src/core/rom.cpp | 8 +- src/core/romimage.cpp | 8 +- src/core/subtitles.cpp | 2 +- src/core/window.cpp | 20 +- src/emulation/bsnes-legacy/core.cpp | 13 +- src/emulation/gambatte/core.cpp | 10 +- src/emulation/sky/sky.cpp | 4 +- src/emulation/test/test.cpp | 4 +- src/interface/c-interface.cpp | 4 +- src/interface/romtype.cpp | 4 +- src/interface/setting.cpp | 10 +- src/library/command.cpp | 37 ++-- src/library/fileimage-patch-bps.cpp | 4 +- src/library/fileimage-patch-ips.cpp | 4 +- src/library/fileimage-patch.cpp | 4 +- src/library/fileimage.cpp | 6 +- src/library/framebuffer-font2.cpp | 3 +- src/library/framebuffer-pixfmt-lrgb.cpp | 4 +- src/library/framebuffer-pixfmt-rgb15.cpp | 4 +- src/library/framebuffer-pixfmt-rgb16.cpp | 4 +- src/library/framebuffer-pixfmt-rgb24.cpp | 4 +- src/library/framebuffer-pixfmt-rgb32.cpp | 4 +- src/library/framebuffer.cpp | 36 ++-- src/library/hex.cpp | 10 +- src/library/integer-pool.cpp | 2 +- src/library/json.cpp | 114 +++++----- src/library/keyboard-mapper.cpp | 60 +++--- src/library/keyboard.cpp | 42 ++-- src/library/loadlib.cpp | 8 +- src/library/lua-framebuffer.cpp | 4 +- src/library/lua.cpp | 6 +- src/library/memorysearch.cpp | 6 +- src/library/memorywatch-fb.cpp | 4 +- src/library/messagebuffer.cpp | 22 +- src/library/movie.cpp | 23 +-- src/library/ogg.cpp | 14 +- src/library/opus-ogg.cpp | 8 +- src/library/portctrl-data.cpp | 31 ++- src/library/portctrl-parse.cpp | 2 +- src/library/rrdata.cpp | 11 +- src/library/settingvar.cpp | 27 ++- src/library/skein.cpp | 6 +- src/library/string.cpp | 9 +- src/library/triplebuffer.cpp | 4 +- src/library/zip.cpp | 46 ++--- src/lua/gui-arrow.cpp | 2 +- src/lua/gui-bitmap.cpp | 2 +- src/lua/gui-box.cpp | 2 +- src/lua/gui-circle.cpp | 2 +- src/lua/gui-crosshair.cpp | 2 +- src/lua/gui-line.cpp | 2 +- src/lua/gui-pixel.cpp | 2 +- src/lua/gui-rectangle.cpp | 2 +- src/lua/gui-text-cf.cpp | 2 +- src/lua/gui-text.cpp | 2 +- src/lua/gui-tilemap.cpp | 2 +- src/lua/ibind.cpp | 2 +- src/lua/lua.cpp | 6 +- src/lua/memory.cpp | 2 +- src/platform/libao/sound.cpp | 2 +- src/platform/wxwidgets/main.cpp | 10 +- src/platform/wxwidgets/mainwindow.cpp | 2 +- src/video/avi.cpp | 7 +- src/video/jmd.cpp | 7 +- src/video/null.cpp | 7 +- src/video/pipedec.cpp | 7 +- src/video/raw.cpp | 7 +- src/video/sox.cpp | 5 +- 145 files changed, 949 insertions(+), 1054 deletions(-) diff --git a/include/core/advdumper.hpp b/include/core/advdumper.hpp index 06e176dd..5925eb7d 100644 --- a/include/core/advdumper.hpp +++ b/include/core/advdumper.hpp @@ -41,7 +41,7 @@ public: * Parameter id: The ID of dumper. * Throws std::bad_alloc: Not enough memory. */ - dumper_factory_base(const std::string& id) throw(std::bad_alloc); + dumper_factory_base(const std::string& id); /** * Unregister a dumper. */ @@ -58,14 +58,14 @@ public: * Returns: The set. * Throws std::bad_alloc: Not enough memory. */ - static std::set get_dumper_set() throw(std::bad_alloc); + static std::set get_dumper_set(); /** * List all valid submodes. * * Returns: List of all valid submodes. Empty list means this dumper has no submodes. * Throws std::bad_alloc: Not enough memory. */ - virtual std::set list_submodes() throw(std::bad_alloc) = 0; + virtual std::set list_submodes() = 0; /** * Get mode details * @@ -86,7 +86,7 @@ public: * Returns: The name. * Throws std::bad_alloc: Not enough memory. */ - virtual std::string name() throw(std::bad_alloc) = 0; + virtual std::string name() = 0; /** * Get human-readable name for submode. * @@ -94,7 +94,7 @@ public: * Returns: The name. * Throws std::bad_alloc: Not enough memory. */ - virtual std::string modename(const std::string& mode) throw(std::bad_alloc) = 0; + virtual std::string modename(const std::string& mode) = 0; /** * Start dump. * @@ -105,7 +105,7 @@ public: * Throws std::runtime_error: Can't start dump. */ virtual dumper_base* start(master_dumper& _mdumper, const std::string& mode, const std::string& targetname) - throw(std::bad_alloc, std::runtime_error) = 0; + = 0; /** * Is hidden? */ @@ -142,7 +142,7 @@ public: /** * Construct game info. */ - gameinfo() throw(std::bad_alloc); + gameinfo(); /** * Game name. */ @@ -167,7 +167,7 @@ public: * Returns: The time formated. * Throws std::bad_alloc: Not enough memory. */ - std::string get_readable_time(unsigned digits) const throw(std::bad_alloc); + std::string get_readable_time(unsigned digits) const; /** * Get number of authors. * @@ -181,7 +181,7 @@ public: * Returns: The short name. * Throws std::bad_alloc: Not enough memory. */ - std::string get_author_short(size_t idx) const throw(std::bad_alloc); + std::string get_author_short(size_t idx) const; /** * Get long name of author (full name and nickname if present). * @@ -189,7 +189,7 @@ public: * Returns: The long name. * Throws std::bad_alloc: Not enough memory. */ - std::string get_author_long(size_t idx) const throw(std::bad_alloc); + std::string get_author_long(size_t idx) const; /** * Get rerecord count as a number. If rerecord count is too high, returns the maximum representatible count. * @@ -224,8 +224,7 @@ public: /** * Call start on dumper. */ - dumper_base* start(dumper_factory_base& factory, const std::string& mode, const std::string& targetname) - throw(std::bad_alloc, std::runtime_error); + dumper_base* start(dumper_factory_base& factory, const std::string& mode, const std::string& targetname); /** * Add dumper update notifier object. */ diff --git a/include/core/audioapi-driver.hpp b/include/core/audioapi-driver.hpp index 2e51e24b..6fd60e10 100644 --- a/include/core/audioapi-driver.hpp +++ b/include/core/audioapi-driver.hpp @@ -59,22 +59,21 @@ bool audioapi_driver_initialized(); * Parameter pdev: The new sound device (playback). * Parameter rdev: The new sound device (recording) */ -void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev) throw(std::bad_alloc, - std::runtime_error); +void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev); /** * Get current sound device (playback). * * Returns: The current sound device. */ -std::string audioapi_driver_get_device(bool rec) throw(std::bad_alloc); +std::string audioapi_driver_get_device(bool rec); /** * Get available sound devices (playback). * * Returns: The map of devices. Keyed by name of the device, values are human-readable names for devices. */ -std::map audioapi_driver_get_devices(bool rec) throw(std::bad_alloc); +std::map audioapi_driver_get_devices(bool rec); /** * Identification for sound plugin. diff --git a/include/core/controllerframe.hpp b/include/core/controllerframe.hpp index 9ba11f9d..e31ffb5e 100644 --- a/include/core/controllerframe.hpp +++ b/include/core/controllerframe.hpp @@ -65,7 +65,7 @@ public: * Parameter ptype: The new types for ports. * Throws std::runtime_error: Illegal port type. */ - void set_ports(const portctrl::type_set& ptype) throw(std::runtime_error); + void set_ports(const portctrl::type_set& ptype); /** * Get status of current controls (with autohold/autofire factored in). * diff --git a/include/core/framebuffer.hpp b/include/core/framebuffer.hpp index cb7cc953..1975cba4 100644 --- a/include/core/framebuffer.hpp +++ b/include/core/framebuffer.hpp @@ -50,7 +50,7 @@ public: * * throws std::bad_alloc: Not enough memory. */ - static void init_special_screens() throw(std::bad_alloc); + static void init_special_screens(); /** * Copy framebuffer to backing store, running Lua hooks if any. */ @@ -62,7 +62,7 @@ public: /** * Return last complete framebuffer. */ - framebuffer::raw get_framebuffer() throw(std::bad_alloc); + framebuffer::raw get_framebuffer(); /** * Render framebuffer to main screen. */ @@ -74,7 +74,7 @@ public: /** * Take a screenshot to specified file. */ - void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error); + void take_screenshot(const std::string& file); /** * Kill pending requests associated with object. */ diff --git a/include/core/mainloop.hpp b/include/core/mainloop.hpp index 3cb4e883..4fcc403c 100644 --- a/include/core/mainloop.hpp +++ b/include/core/mainloop.hpp @@ -9,8 +9,7 @@ /** * \brief Emulator main loop. */ -void main_loop(struct loaded_rom& rom, struct moviefile& settings, bool load_has_to_succeed = false) - throw(std::bad_alloc, std::runtime_error); +void main_loop(struct loaded_rom& rom, struct moviefile& settings, bool load_has_to_succeed = false); std::vector get_jukebox_names(); void set_jukebox_names(const std::vector& newj); void init_main_callbacks(); diff --git a/include/core/memorymanip.hpp b/include/core/memorymanip.hpp index 73ce51e9..2aeb6d0d 100644 --- a/include/core/memorymanip.hpp +++ b/include/core/memorymanip.hpp @@ -15,7 +15,7 @@ class cart_mappings_refresher { public: cart_mappings_refresher(memory_space& _mspace, movie_logic& _mlogic, loaded_rom& _rom); - void operator()() throw(std::bad_alloc); + void operator()(); private: memory_space& mspace; movie_logic& mlogic; diff --git a/include/core/misc.hpp b/include/core/misc.hpp index ac2d45ba..2059db05 100644 --- a/include/core/misc.hpp +++ b/include/core/misc.hpp @@ -20,7 +20,7 @@ void fatal_error() throw(); * \return The config directory path. * \throw std::bad_alloc Not enough memory. */ -std::string get_config_path() throw(std::bad_alloc); +std::string get_config_path(); /** * \brief Panic on OOM. diff --git a/include/core/movie.hpp b/include/core/movie.hpp index fd09fe74..95e6d42a 100644 --- a/include/core/movie.hpp +++ b/include/core/movie.hpp @@ -29,7 +29,7 @@ public: * * returns: The movie instance. */ - movie& get_movie() throw(std::runtime_error); + movie& get_movie(); /** * Set the movie instance associated. @@ -39,7 +39,7 @@ public: /** * Get the current movie file. */ - moviefile& get_mfile() throw(std::runtime_error); + moviefile& get_mfile(); /** * Set the current movie file. @@ -48,7 +48,7 @@ public: /** * Get current rrdata. */ - rrdata_set& get_rrdata() throw(std::runtime_error); + rrdata_set& get_rrdata(); /** * Set current rrdata. @@ -58,7 +58,7 @@ public: /** * Notify about new frame starting. */ - void new_frame_starting(bool dont_poll) throw(std::bad_alloc, std::runtime_error); + void new_frame_starting(bool dont_poll); /** * Poll for input. @@ -70,21 +70,21 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Error polling for input. */ - short input_poll(unsigned port, unsigned dev, unsigned id) throw(std::bad_alloc, std::runtime_error); + short input_poll(unsigned port, unsigned dev, unsigned id); /** * Called when movie code needs new controls snapshot. * * parameter subframe: True if this is for subframe update, false if for frame update. */ - portctrl::frame update_controls(bool subframe, bool forced = false) throw(std::bad_alloc, std::runtime_error); + portctrl::frame update_controls(bool subframe, bool forced = false); /** * Notify user poll (exit poll advance). * * returns: If true, update_controls is forced. */ - bool notify_user_poll() throw(std::bad_alloc, std::runtime_error); + bool notify_user_poll(); /** * Release memory for mov, mf and rrd. */ diff --git a/include/core/moviedata.hpp b/include/core/moviedata.hpp index 11e9b153..45c218ff 100644 --- a/include/core/moviedata.hpp +++ b/include/core/moviedata.hpp @@ -31,13 +31,12 @@ #define SAVE_MOVIE 1 std::string resolve_relative_path(const std::string& path); -std::pair split_author(const std::string& author) throw(std::bad_alloc, - std::runtime_error); +std::pair split_author(const std::string& author); -void do_save_state(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error); -void do_save_movie(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error); -void do_load_rom() throw(std::bad_alloc, std::runtime_error); -void do_load_rewind() throw(std::bad_alloc, std::runtime_error); +void do_save_state(const std::string& filename, int binary); +void do_save_movie(const std::string& filename, int binary); +void do_load_rom(); +void do_load_rewind(); void do_load_state(struct moviefile& _movie, int lmode, bool& used); bool do_load_state(const std::string& filename, int lmode); std::string translate_name_mprefix(std::string original, int& binary, int save); diff --git a/include/core/moviefile.hpp b/include/core/moviefile.hpp index d9ac02f8..0e9b9a98 100644 --- a/include/core/moviefile.hpp +++ b/include/core/moviefile.hpp @@ -138,7 +138,7 @@ struct moviefile * * throws std::bad_alloc: Not enough memory. */ - moviefile() throw(std::bad_alloc); + moviefile(); /** * This constructor loads a movie/savestate file and fills structure accordingly. @@ -148,7 +148,7 @@ struct moviefile * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Can't load the movie file */ - moviefile(const std::string& filename, core_type& romtype) throw(std::bad_alloc, std::runtime_error); + moviefile(const std::string& filename, core_type& romtype); /** * Fill a stub movie with specified loaded ROM. @@ -171,12 +171,11 @@ struct moviefile * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Can't save the movie file. */ - void save(const std::string& filename, unsigned compression, bool binary, rrdata_set& rrd, bool as_state) - throw(std::bad_alloc, std::runtime_error); + void save(const std::string& filename, unsigned compression, bool binary, rrdata_set& rrd, bool as_state); /** * Reads this movie structure and saves it to stream (uncompressed ZIP). */ - void save(std::ostream& outstream, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error); + void save(std::ostream& outstream, rrdata_set& rrd, bool as_state); /** * Force loading as corrupt. */ @@ -322,10 +321,10 @@ struct moviefile private: moviefile(const moviefile&); moviefile& operator=(const moviefile&); - void binary_io(int stream, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error); - void binary_io(int stream, struct core_type& romtype) throw(std::bad_alloc, std::runtime_error); - void save(zip::writer& w, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error); - void load(zip::reader& r, core_type& romtype) throw(std::bad_alloc, std::runtime_error); + void binary_io(int stream, rrdata_set& rrd, bool as_state); + void binary_io(int stream, struct core_type& romtype); + void save(zip::writer& w, rrdata_set& rrd, bool as_state); + void load(zip::reader& r, core_type& romtype); memtracker::autorelease tracker; std::string filename; }; diff --git a/include/core/queue.hpp b/include/core/queue.hpp index dcdbbc4a..d6688181 100644 --- a/include/core/queue.hpp +++ b/include/core/queue.hpp @@ -83,7 +83,7 @@ struct input_queue * * Parameter k: The keypress to queue. */ - void queue(const keypress_info& k) throw(std::bad_alloc); + void queue(const keypress_info& k); /** * Queue command. * @@ -91,7 +91,7 @@ struct input_queue * * Parameter c: The command to queue. */ - void queue(const std::string& c) throw(std::bad_alloc); + void queue(const std::string& c); /** * Queue command and arguments. * @@ -100,7 +100,7 @@ struct input_queue * Parameter c: The command to queue. * Parameter a: The arguments for function. */ - void queue(const char* c, const std::string& a) throw(std::bad_alloc); + void queue(const char* c, const std::string& a); /** * Queue function to be called in emulation thread. * @@ -111,8 +111,7 @@ struct input_queue * Parameter arg: Argument to pass to the function. * Parameter sync: If true, execute function call synchronously, else asynchronously. */ - void queue(std::function f, std::function onerror, bool sync) - throw(std::bad_alloc); + void queue(std::function f, std::function onerror, bool sync); /** * Run all queues. */ diff --git a/include/core/random.hpp b/include/core/random.hpp index 81ed7f89..db404934 100644 --- a/include/core/random.hpp +++ b/include/core/random.hpp @@ -15,7 +15,7 @@ * \return The random hexadecimal string. * \throws std::bad_alloc Not enough memory. */ -std::string get_random_hexstring(size_t length) throw(std::bad_alloc); +std::string get_random_hexstring(size_t length); /** * \brief Set random seed @@ -25,7 +25,7 @@ std::string get_random_hexstring(size_t length) throw(std::bad_alloc); * \param seed The value to use as seed. * \throw std::bad_alloc Not enough memory. */ -void set_random_seed(const std::string& seed) throw(std::bad_alloc); +void set_random_seed(const std::string& seed); /** * \brief Set random seed to (hopefully) unique value @@ -35,7 +35,7 @@ void set_random_seed(const std::string& seed) throw(std::bad_alloc); * * \throw std::bad_alloc Not enough memory. */ -void set_random_seed() throw(std::bad_alloc); +void set_random_seed(); /** * Mix some entropy. diff --git a/include/core/rom.hpp b/include/core/rom.hpp index 37e399b4..d03ba8b4 100644 --- a/include/core/rom.hpp +++ b/include/core/rom.hpp @@ -27,7 +27,7 @@ struct loaded_rom * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Loading ROM file failed. */ - loaded_rom(rom_image_handle _image) throw(std::bad_alloc, std::runtime_error); + loaded_rom(rom_image_handle _image); /** * Switches the active cartridge to this cartridge. The compatiblity between selected region and original region * is checked. Region is updated after cartridge has been loaded. @@ -35,8 +35,7 @@ struct loaded_rom * throws std::bad_alloc: Not enough memory * throws std::runtime_error: Switching cartridges failed. */ - void load(std::map& settings, uint64_t rtc_sec, uint64_t rtc_subsec) - throw(std::bad_alloc, std::runtime_error); + void load(std::map& settings, uint64_t rtc_sec, uint64_t rtc_subsec); /** * Reset the emulation state to state just before last load. */ @@ -47,7 +46,7 @@ struct loaded_rom * returns: The saved state. * throws std::bad_alloc: Not enough memory. */ - std::vector save_core_state(bool nochecksum = false) throw(std::bad_alloc, std::runtime_error); + std::vector save_core_state(bool nochecksum = false); /** * Loads core state from buffer. @@ -55,7 +54,7 @@ struct loaded_rom * parameter buf: The buffer containing the state. * throws std::runtime_error: Loading state failed. */ - void load_core_state(const std::vector& buf, bool nochecksum = false) throw(std::runtime_error); + void load_core_state(const std::vector& buf, bool nochecksum = false); /** * Get internal type representation. @@ -130,8 +129,8 @@ struct loaded_rom std::pair get_bus_map() { return rtype().get_bus_map(); } std::list get_regions() { return image->get_regions(); } const std::string& get_iname() { return rtype().get_iname(); } - std::map> save_sram() throw(std::bad_alloc) { return rtype().save_sram(); } - void load_sram(std::map>& sram) throw(std::bad_alloc) + std::map> save_sram() { return rtype().save_sram(); } + void load_sram(std::map>& sram) { rtype().load_sram(sram); } @@ -188,8 +187,7 @@ std::pair get_current_rom_info() throw(); * throws std::bad_alloc: Out of memory. * throws std::runtime_error: Failed to load. */ -std::map> load_sram_commandline(const std::vector& cmdline) - throw(std::bad_alloc, std::runtime_error); +std::map> load_sram_commandline(const std::vector& cmdline); struct romload_request { diff --git a/include/core/romimage.hpp b/include/core/romimage.hpp index 021d233b..015b5605 100644 --- a/include/core/romimage.hpp +++ b/include/core/romimage.hpp @@ -43,8 +43,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Loading ROM file failed. */ - rom_image(const std::string& file, const std::string& tmpprefer = "") throw(std::bad_alloc, - std::runtime_error); + rom_image(const std::string& file, const std::string& tmpprefer = ""); /** * Take a ROM and load it. */ @@ -63,7 +62,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Loading ROM file failed. */ - rom_image(const std::string& file, core_type& ctype) throw(std::bad_alloc, std::runtime_error); + rom_image(const std::string& file, core_type& ctype); /** * Destroy ROM image. */ @@ -112,7 +111,7 @@ public: * retruns: True if gamepak, false if not. * throws std::runtime_error: No such file. */ - static bool is_gamepak(const std::string& filename) throw(std::bad_alloc, std::runtime_error); + static bool is_gamepak(const std::string& filename); //ROM functions. std::list get_regions() { return rtype->get_regions(); } const std::string& get_hname() { return rtype->get_hname(); } @@ -144,8 +143,7 @@ private: bool put() { threads::alock l(usage_lock); return !--usage_count; } friend class rom_image_handle; //Handle bundle load case. - void load_bundle(const std::string& file, std::istream& spec, const std::string& tmpprefer) - throw(std::bad_alloc, std::runtime_error); + void load_bundle(const std::string& file, std::istream& spec, const std::string& tmpprefer); //Tracker. memtracker::autorelease tracker; }; diff --git a/include/core/window.hpp b/include/core/window.hpp index 47fdedfa..f7f28171 100644 --- a/include/core/window.hpp +++ b/include/core/window.hpp @@ -93,7 +93,7 @@ struct platform * returns: The output stream. * throws std::bad_alloc: Not enough memory. */ - static std::ostream& out() throw(std::bad_alloc); + static std::ostream& out(); /** * Message buffer. */ @@ -110,7 +110,7 @@ struct platform * parameter msg: The messages to add (split by '\n'). * throws std::bad_alloc: Not enough memory. */ - static void message(const std::string& msg) throw(std::bad_alloc); + static void message(const std::string& msg); /** * Displays fatal error message, quitting after the user acks it (called by fatal_error()). * @@ -140,7 +140,7 @@ struct platform /** * Get sound device description. */ - static std::string get_sound_device_description(bool rec) throw(std::bad_alloc); + static std::string get_sound_device_description(bool rec); /** * Show error message dialog after UI thread becomes free. * diff --git a/include/interface/romtype.hpp b/include/interface/romtype.hpp index eb5c86fd..a069dd19 100644 --- a/include/interface/romtype.hpp +++ b/include/interface/romtype.hpp @@ -324,8 +324,8 @@ struct core_core double get_PAR(); std::pair get_audio_rate(); std::string get_core_identifier() const; - std::map> save_sram() throw(std::bad_alloc); - void load_sram(std::map>& sram) throw(std::bad_alloc); + std::map> save_sram(); + void load_sram(std::map>& sram); void serialize(std::vector& out); void unserialize(const char* in, size_t insize); core_region& get_region(); @@ -393,13 +393,13 @@ protected: /** * Save all SRAMs. */ - virtual std::map> c_save_sram() throw(std::bad_alloc) = 0; + virtual std::map> c_save_sram() = 0; /** * Load all SRAMs. * * Note: Must handle SRAM being missing or shorter or longer than expected. */ - virtual void c_load_sram(std::map>& sram) throw(std::bad_alloc) = 0; + virtual void c_load_sram(std::map>& sram) = 0; /** * Serialize the system state. */ @@ -578,8 +578,8 @@ public: std::pair get_audio_rate() { return core->get_audio_rate(); } std::string get_core_identifier() { return core->get_core_identifier(); } std::string get_core_shortname() const { return core->get_core_shortname(); } - std::map> save_sram() throw(std::bad_alloc) { return core->save_sram(); } - void load_sram(std::map>& sram) throw(std::bad_alloc) + std::map> save_sram() { return core->save_sram(); } + void load_sram(std::map>& sram) { core->load_sram(sram); } diff --git a/include/interface/setting.hpp b/include/interface/setting.hpp index e41eaebb..db4e379f 100644 --- a/include/interface/setting.hpp +++ b/include/interface/setting.hpp @@ -40,7 +40,7 @@ struct core_setting_value /** * Create a new setting value. */ - core_setting_value(const core_setting_value_param& p) throw(std::bad_alloc); + core_setting_value(const core_setting_value_param& p); /** * Internal value. */ @@ -95,15 +95,15 @@ struct core_setting /** * Get set of human-readable strings. */ - std::vector hvalues() const throw(std::runtime_error); + std::vector hvalues() const; /** * Translate hvalue to ivalue. */ - std::string hvalue_to_ivalue(const std::string& hvalue) const throw(std::runtime_error); + std::string hvalue_to_ivalue(const std::string& hvalue) const; /** * Translate ivalue to index. */ - signed ivalue_to_index(const std::string& ivalue) const throw(std::runtime_error); + signed ivalue_to_index(const std::string& ivalue) const; /** * Validate a value. * @@ -138,14 +138,13 @@ struct core_setting_group * Translate ivalue to index. */ signed ivalue_to_index(std::map& values, const std::string& name) const - throw(std::runtime_error) { return settings.find(name)->second.ivalue_to_index(values[name]); } /** * Fill a map of settings with defaults. */ - void fill_defaults(std::map& values) throw(std::bad_alloc); + void fill_defaults(std::map& values); /** * Get set of settings. */ diff --git a/include/library/command.hpp b/include/library/command.hpp index c8c3cbe9..c12d2838 100644 --- a/include/library/command.hpp +++ b/include/library/command.hpp @@ -46,7 +46,7 @@ public: /** * Create a new set. */ - set() throw(std::bad_alloc); + set(); /** * Destroy a set. */ @@ -54,17 +54,17 @@ public: /** * Add a command to set. */ - void do_register(const std::string& name, factory_base& cmd) throw(std::bad_alloc); + void do_register(const std::string& name, factory_base& cmd); /** * Remove a command from set. */ - void do_unregister(const std::string& name, factory_base& cmd) throw(std::bad_alloc); + void do_unregister(const std::string& name, factory_base& cmd); /** * Add a notification callback and call ccb on all. * * Parameter listener: The listener to add. */ - void add_callback(listener& listener) throw(std::bad_alloc); + void add_callback(listener& listener); /** * Drop a notification callback and call dcb on all. * @@ -84,7 +84,7 @@ public: /** * Create a new command group. This also places some builtin commands in that new group. */ - group() throw(std::bad_alloc); + group(); /** * Destroy a group. */ @@ -105,31 +105,31 @@ public: /** * Get set of aliases. */ - std::set get_aliases() throw(std::bad_alloc); + std::set get_aliases(); /** * Get alias */ - std::string get_alias_for(const std::string& aname) throw(std::bad_alloc); + std::string get_alias_for(const std::string& aname); /** * Set alias */ - void set_alias_for(const std::string& aname, const std::string& avalue) throw(std::bad_alloc); + void set_alias_for(const std::string& aname, const std::string& avalue); /** * Is alias name valid. */ - bool valid_alias_name(const std::string& aname) throw(std::bad_alloc); + bool valid_alias_name(const std::string& aname); /** * Register a command. */ - void do_register(const std::string& name, base& cmd) throw(std::bad_alloc); + void do_register(const std::string& name, base& cmd); /** * Unregister a command. */ - void do_unregister(const std::string& name, base& cmd) throw(std::bad_alloc); + void do_unregister(const std::string& name, base& cmd); /** * Add all commands (including future ones) in given set. */ - void add_set(set& s) throw(std::bad_alloc); + void add_set(set& s); /** * Drop a set of commands. */ @@ -175,7 +175,7 @@ public: * parameter dynamic: Should the object be freed when its parent group dies? * throws std::bad_alloc: Not enough memory. */ - base(group& group, const std::string& cmd, bool dynamic) throw(std::bad_alloc); + base(group& group, const std::string& cmd, bool dynamic); /** * Deregister a command. @@ -189,16 +189,16 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Command execution failed. */ - virtual void invoke(const std::string& arguments) throw(std::bad_alloc, std::runtime_error) = 0; + virtual void invoke(const std::string& arguments) = 0; /** * Get short help for command. */ - virtual std::string get_short_help() throw(std::bad_alloc); + virtual std::string get_short_help(); /** * Get long help for command. */ - virtual std::string get_long_help() throw(std::bad_alloc); + virtual std::string get_long_help(); /** * Get name of command. */ @@ -231,7 +231,7 @@ public: * parameter cmd: The command to register. * throws std::bad_alloc: Not enough memory. */ - void _factory_base(set& _set, const std::string& cmd) throw(std::bad_alloc); + void _factory_base(set& _set, const std::string& cmd); /** * Destructor. */ @@ -316,7 +316,7 @@ public: * parameter dynamic: Should the object be freed when its parent group dies? */ _fnptr(group& group, const std::string& name, const std::string& _description, - const std::string& _help, void (*_fn)(args... arguments), bool dynamic = false) throw(std::bad_alloc) + const std::string& _help, void (*_fn)(args... arguments), bool dynamic = false) : base(group, name, dynamic) { shorthelp = _description; @@ -331,7 +331,7 @@ public: * parameter fn: Function to call on command. * parameter description Description&Help for the command */ - _fnptr(group& _group, stub _name, std::function _fn) throw(std::bad_alloc) + _fnptr(group& _group, stub _name, std::function _fn) : base(_group, _name.name, false) { shorthelp = _name.desc; @@ -349,7 +349,7 @@ public: * * parameter a: Arguments to function. */ - void invoke(const std::string& a) throw(std::bad_alloc, std::runtime_error) + void invoke(const std::string& a) { invoke_fn(fn, a); } @@ -359,7 +359,7 @@ public: * returns: Description. * throw std::bad_alloc: Not enough memory. */ - std::string get_short_help() throw(std::bad_alloc) + std::string get_short_help() { return shorthelp; } @@ -369,7 +369,7 @@ public: * returns: help. * throw std::bad_alloc: Not enough memory. */ - std::string get_long_help() throw(std::bad_alloc) + std::string get_long_help() { return help; } @@ -393,7 +393,7 @@ public: * parameter desc: Command descriptor. * parameter fn: Function to call on command. */ - fnptr(set& _set, stub _name, void (*_fn)(args... arguments)) throw(std::bad_alloc) + fnptr(set& _set, stub _name, void (*_fn)(args... arguments)) { shorthelp = _name.desc; name = _name.name; @@ -411,7 +411,7 @@ public: * parameter fn: Function to call on command. */ fnptr(set& _set, const std::string& _name, const std::string& _description, - const std::string& _help, void (*_fn)(args... arguments)) throw(std::bad_alloc) + const std::string& _help, void (*_fn)(args... arguments)) { shorthelp = _description; name = _name; @@ -428,7 +428,7 @@ public: /** * Make a command. */ - base* make(group& grp) throw(std::bad_alloc) + base* make(group& grp) { return new _fnptr(grp, name, shorthelp, help, fn, true); } @@ -463,7 +463,7 @@ public: /** * Make a command. */ - base* make(group& grp) throw(std::bad_alloc) + base* make(group& grp) { return new T(grp, name); } diff --git a/include/library/fileimage-patch.hpp b/include/library/fileimage-patch.hpp index adc778cf..ad5bf87a 100644 --- a/include/library/fileimage-patch.hpp +++ b/include/library/fileimage-patch.hpp @@ -10,7 +10,7 @@ namespace fileimage { std::vector patch(const std::vector& original, const std::vector& patch, - int32_t offset) throw(std::bad_alloc, std::runtime_error); + int32_t offset); /** * ROM patcher. @@ -20,7 +20,7 @@ struct patcher /** * Constructor. */ - patcher() throw(std::bad_alloc); + patcher(); /** * Destructor. */ @@ -36,7 +36,7 @@ struct patcher * Do the patch. */ virtual void dopatch(std::vector& out, const std::vector& original, - const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error) = 0; + const std::vector& patch, int32_t offset) = 0; }; } diff --git a/include/library/fileimage.hpp b/include/library/fileimage.hpp index 19696f56..743d5cd7 100644 --- a/include/library/fileimage.hpp +++ b/include/library/fileimage.hpp @@ -161,7 +161,7 @@ struct image * * throws std::bad_alloc: Not enough memory. */ - image() throw(std::bad_alloc); + image(); /** * This constructor construct slot by reading data from file. If filename is "", constructs an empty slot. @@ -174,7 +174,7 @@ struct image * throws std::runtime_error: Can't load the data. */ image(hash& hasher, const std::string& filename, const std::string& base, - const struct info& imginfo) throw(std::bad_alloc, std::runtime_error); + const struct info& imginfo); /** * This method patches this slot using specified IPS patch. @@ -186,7 +186,7 @@ struct image * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Bad IPS patch, or trying to patch file image. */ - void patch(const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error); + void patch(const std::vector& patch, int32_t offset); /** * Type. */ diff --git a/include/library/framebuffer-font2.hpp b/include/library/framebuffer-font2.hpp index 9be943e1..8e8ab44c 100644 --- a/include/library/framebuffer-font2.hpp +++ b/include/library/framebuffer-font2.hpp @@ -31,9 +31,8 @@ public: font2(); font2(const std::string& file); font2(struct font& bfont); - void add(const std::u32string& key, const glyph& fglyph) throw(std::bad_alloc); - std::u32string best_ligature_match(const std::u32string& codepoints, size_t start) const - throw(std::bad_alloc); + void add(const std::u32string& key, const glyph& fglyph); + std::u32string best_ligature_match(const std::u32string& codepoints, size_t start) const; const glyph& lookup_glyph(const std::u32string& key) const throw(); unsigned get_rowadvance() const throw() { return rowadvance; } std::pair get_metrics(const std::u32string& str, uint32_t xalign) const; diff --git a/include/library/framebuffer-pixfmt-lrgb.hpp b/include/library/framebuffer-pixfmt-lrgb.hpp index 72220dc5..a4e53bb8 100644 --- a/include/library/framebuffer-pixfmt-lrgb.hpp +++ b/include/library/framebuffer-pixfmt-lrgb.hpp @@ -19,9 +19,9 @@ public: void decode(uint64_t* target, const uint8_t* src, size_t width, const auxpalette& auxp) throw(); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); uint8_t get_bpp() throw(); uint8_t get_ss_bpp() throw(); uint32_t get_magic() throw(); diff --git a/include/library/framebuffer-pixfmt-rgb15.hpp b/include/library/framebuffer-pixfmt-rgb15.hpp index 1a79f663..7126fc8a 100644 --- a/include/library/framebuffer-pixfmt-rgb15.hpp +++ b/include/library/framebuffer-pixfmt-rgb15.hpp @@ -20,9 +20,9 @@ public: void decode(uint64_t* target, const uint8_t* src, size_t width, const auxpalette& auxp) throw(); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); uint8_t get_bpp() throw(); uint8_t get_ss_bpp() throw(); uint32_t get_magic() throw(); diff --git a/include/library/framebuffer-pixfmt-rgb16.hpp b/include/library/framebuffer-pixfmt-rgb16.hpp index 3b3e21ef..3c49a7ee 100644 --- a/include/library/framebuffer-pixfmt-rgb16.hpp +++ b/include/library/framebuffer-pixfmt-rgb16.hpp @@ -20,9 +20,9 @@ public: void decode(uint64_t* target, const uint8_t* src, size_t width, const auxpalette& auxp) throw(); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); uint8_t get_bpp() throw(); uint8_t get_ss_bpp() throw(); uint32_t get_magic() throw(); diff --git a/include/library/framebuffer-pixfmt-rgb24.hpp b/include/library/framebuffer-pixfmt-rgb24.hpp index f92cf732..86c013f5 100644 --- a/include/library/framebuffer-pixfmt-rgb24.hpp +++ b/include/library/framebuffer-pixfmt-rgb24.hpp @@ -20,9 +20,9 @@ public: void decode(uint64_t* target, const uint8_t* src, size_t width, const auxpalette& auxp) throw(); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); uint8_t get_bpp() throw(); uint8_t get_ss_bpp() throw(); uint32_t get_magic() throw(); diff --git a/include/library/framebuffer-pixfmt-rgb32.hpp b/include/library/framebuffer-pixfmt-rgb32.hpp index 80042ba8..9e25abae 100644 --- a/include/library/framebuffer-pixfmt-rgb32.hpp +++ b/include/library/framebuffer-pixfmt-rgb32.hpp @@ -19,9 +19,9 @@ public: void decode(uint64_t* target, const uint8_t* src, size_t width, const auxpalette& auxp) throw(); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc); + uint8_t bshift); uint8_t get_bpp() throw(); uint8_t get_ss_bpp() throw(); uint32_t get_magic() throw(); diff --git a/include/library/framebuffer-pixfmt.hpp b/include/library/framebuffer-pixfmt.hpp index 3fa218b8..677113f5 100644 --- a/include/library/framebuffer-pixfmt.hpp +++ b/include/library/framebuffer-pixfmt.hpp @@ -19,7 +19,7 @@ public: /** * Register the pixel format. */ - pixfmt() throw(std::bad_alloc); + pixfmt(); /** * Decode pixel format data into RGB data (0, R, G, B). */ @@ -39,12 +39,12 @@ public: * Create aux palette. */ virtual void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) = 0; + uint8_t bshift) = 0; /** * Create aux palette. */ virtual void set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) = 0; + uint8_t bshift) = 0; /** * Bytes per pixel in data. */ diff --git a/include/library/framebuffer.hpp b/include/library/framebuffer.hpp index a6545339..44b57838 100644 --- a/include/library/framebuffer.hpp +++ b/include/library/framebuffer.hpp @@ -100,13 +100,13 @@ struct raw * * Parameter info: The framebuffer info. */ - raw(const info& finfo) throw(std::bad_alloc); + raw(const info& finfo); /** * Create a new framebuffer backed by memory buffer. * * The resulting framebuffer can be written to. */ - raw() throw(std::bad_alloc); + raw(); /** * Copy a framebuffer. * @@ -114,34 +114,34 @@ struct raw * * Parameter f: The framebuffer. */ - raw(const raw& f) throw(std::bad_alloc); + raw(const raw& f); /** * Assign a framebuffer. * * Parameter f: The framebuffer. * Throws std::runtime_error: The target framebuffer is not writable. */ - raw& operator=(const raw& f) throw(std::bad_alloc, std::runtime_error); + raw& operator=(const raw& f); /** * Load contents of framebuffer. * * parameter data: The data to load. * throws std::runtime_error: The target framebuffer is not writable. */ - void load(const std::vector& data) throw(std::bad_alloc, std::runtime_error); + void load(const std::vector& data); /** * Save contents of framebuffer. * * parameter data: The vector to write the data to (in format compatible with load()). */ - void save(std::vector& data) throw(std::bad_alloc); + void save(std::vector& data); /** * Save contents of framebuffer as a PNG. * * parameter file: The filename to save to. * throws std::runtime_error: Can't save the PNG. */ - void save_png(const std::string& file) throw(std::bad_alloc, std::runtime_error); + void save_png(const std::string& file); /** * Get width. * @@ -226,7 +226,7 @@ struct fb * parameter upside_down: If true, image is upside down in memory. * throws std::bad_alloc: Not enough memory. */ - void reallocate(size_t _width, size_t _height, bool upside_down = false) throw(std::bad_alloc); + void reallocate(size_t _width, size_t _height, bool upside_down = false); /** * Set origin @@ -278,7 +278,7 @@ struct fb * parameter g Shift for green component * parameter b Shift for blue component */ - void set_palette(uint32_t r, uint32_t g, uint32_t b) throw(std::bad_alloc); + void set_palette(uint32_t r, uint32_t g, uint32_t b); /** * Get stride of image. * @@ -375,7 +375,7 @@ struct object /** * Clone the object. */ - virtual void clone(struct queue& q) const throw(std::bad_alloc) = 0; + virtual void clone(struct queue& q) const = 0; }; /** @@ -422,7 +422,7 @@ struct color set_palette(default_shift_r << 1, default_shift_g << 1, default_shift_b << 1, true); //std::cerr << "Color " << color << " -> hi=" << hi << " lo=" << lo << " inv=" << inv << std::endl; } - color(const std::string& color) throw(std::bad_alloc, std::runtime_error); + color(const std::string& color); static std::string stringify(int64_t number); void set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool X) throw(); template void set_palette(struct fb& s) throw() @@ -518,7 +518,7 @@ struct font /** * Constructor. */ - font() throw(std::bad_alloc); + font(); /** * Load a .hex format font. * @@ -526,7 +526,7 @@ struct font * Parameter size: The font data size in bytes. * Throws std::runtime_error: Bad font data. */ - void load_hex(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error); + void load_hex(const char* data, size_t size); /** * Locate glyph. * @@ -548,7 +548,7 @@ struct font * Parameter string: The string to get layout of. * Returns: String layout. */ - std::vector dolayout(const std::string& string) throw(std::bad_alloc); + std::vector dolayout(const std::string& string); /** * Get width of string. * @@ -604,7 +604,7 @@ private: std::map glyphs; size_t tabstop; std::vector memory; - void load_hex_glyph(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error); + void load_hex_glyph(const char* data, size_t size); }; @@ -633,7 +633,7 @@ struct queue /** * Get memory from internal allocator. */ - void* alloc(size_t block) throw(std::bad_alloc); + void* alloc(size_t block); /** * Call object constructor on internal memory. @@ -645,7 +645,7 @@ struct queue /** * Copy objects from another render queue. */ - void copy_from(queue& q) throw(std::bad_alloc); + void copy_from(queue& q); /** * Helper for clone. */ @@ -675,7 +675,7 @@ struct queue */ ~queue() throw(); private: - void add(struct object& obj) throw(std::bad_alloc); + void add(struct object& obj); struct node { struct object* obj; struct node* next; bool killed; }; struct page { char content[RENDER_PAGE_SIZE]; diff --git a/include/library/globalwrap.hpp b/include/library/globalwrap.hpp index ac712d52..e0f05431 100644 --- a/include/library/globalwrap.hpp +++ b/include/library/globalwrap.hpp @@ -13,7 +13,7 @@ public: /** * Ctor, forces the object to be constructed (to avoid races). */ - globalwrap() throw(std::bad_alloc) + globalwrap() { (*this)(); } @@ -23,7 +23,7 @@ public: * returns: The wrapped object. * throws std::bad_alloc: Not enough memory. */ - T& operator()() throw(std::bad_alloc) + T& operator()() { if(!storage) { if(!state) //State initializes to 0. diff --git a/include/library/hex.hpp b/include/library/hex.hpp index 56724494..d27a57e8 100644 --- a/include/library/hex.hpp +++ b/include/library/hex.hpp @@ -17,7 +17,7 @@ namespace hex * Returns: Hex string. * Throws std::bad_alloc: Not enough memory. */ -std::string b_to(const uint8_t* data, size_t datalen, bool uppercase = false) throw(std::bad_alloc); +std::string b_to(const uint8_t* data, size_t datalen, bool uppercase = false); /** * Transform unsigned integer into full-width hexadecimal. @@ -27,7 +27,7 @@ std::string b_to(const uint8_t* data, size_t datalen, bool uppercase = false) th * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -template std::string to(T data, bool prefix = false) throw(std::bad_alloc); +template std::string to(T data, bool prefix = false); /** * Transform uint8 into full-width hexadecimal. @@ -37,7 +37,7 @@ template std::string to(T data, bool prefix = false) throw(std::bad_ * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -inline std::string to8(uint8_t data, bool prefix = false) throw(std::bad_alloc) { return to(data, prefix); } +inline std::string to8(uint8_t data, bool prefix = false) { return to(data, prefix); } /** * Transform uint16 into full-width hexadecimal. @@ -47,7 +47,7 @@ inline std::string to8(uint8_t data, bool prefix = false) throw(std::bad_alloc) * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -inline std::string to16(uint16_t data, bool prefix = false) throw(std::bad_alloc) +inline std::string to16(uint16_t data, bool prefix = false) { return to(data, prefix); } @@ -60,7 +60,7 @@ inline std::string to16(uint16_t data, bool prefix = false) throw(std::bad_alloc * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -std::string to24(uint32_t data, bool prefix = false) throw(std::bad_alloc); +std::string to24(uint32_t data, bool prefix = false); /** * Transform uint32 into full-width hexadecimal. @@ -70,7 +70,7 @@ std::string to24(uint32_t data, bool prefix = false) throw(std::bad_alloc); * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -inline std::string to32(uint32_t data, bool prefix = false) throw(std::bad_alloc) +inline std::string to32(uint32_t data, bool prefix = false) { return to(data, prefix); } @@ -83,7 +83,7 @@ inline std::string to32(uint32_t data, bool prefix = false) throw(std::bad_alloc * Returns: The hex string. * Throws std::bad_alloc: Not enough memory. */ -inline std::string to64(uint64_t data, bool prefix = false) throw(std::bad_alloc) +inline std::string to64(uint64_t data, bool prefix = false) { return to(data, prefix); } @@ -95,7 +95,7 @@ inline std::string to64(uint64_t data, bool prefix = false) throw(std::bad_alloc * Parameter hex: The hexadecimal string. * Throws std::runtime_error: Bad hexadecimal character in string. */ -void b_from(uint8_t* buf, const std::string& hex) throw(std::runtime_error); +void b_from(uint8_t* buf, const std::string& hex); /** * Transform hexadecimal into unsigned integer. @@ -103,7 +103,7 @@ void b_from(uint8_t* buf, const std::string& hex) throw(std::runtime_error); * Parameter hex: The hexadecimal string. * Throws std::runtime_error: Bad hexadecimal character in string. */ -template T from(const std::string& hex) throw(std::runtime_error); +template T from(const std::string& hex); } #endif diff --git a/include/library/integer-pool.hpp b/include/library/integer-pool.hpp index 45a2b8cf..b81bd9e5 100644 --- a/include/library/integer-pool.hpp +++ b/include/library/integer-pool.hpp @@ -21,7 +21,7 @@ public: * Returns: The number drawn. * Throws std::bad_alloc: Not enough memory. */ - uint64_t operator()() throw(std::bad_alloc); + uint64_t operator()(); /** * Return a number into the pool. * diff --git a/include/library/json.hpp b/include/library/json.hpp index a4e76aa7..692aa809 100644 --- a/include/library/json.hpp +++ b/include/library/json.hpp @@ -182,21 +182,21 @@ class pointer { public: pointer(); - pointer(const std::string& ptr) throw(std::bad_alloc); - pointer(const std::u32string& ptr) throw(std::bad_alloc); - pointer pastend() const throw(std::bad_alloc) { return field(U"-"); } - pointer& pastend_inplace() throw(std::bad_alloc) { return field_inplace(U"-"); } - pointer index(uint64_t idx) const throw(std::bad_alloc); - pointer& index_inplace(uint64_t idx) throw(std::bad_alloc); - pointer field(const std::string& fld) const throw(std::bad_alloc) { return field(utf8::to32(fld)); } - pointer& field_inplace(const std::string& fld) throw(std::bad_alloc) + pointer(const std::string& ptr); + pointer(const std::u32string& ptr); + pointer pastend() const { return field(U"-"); } + pointer& pastend_inplace() { return field_inplace(U"-"); } + pointer index(uint64_t idx) const; + pointer& index_inplace(uint64_t idx); + pointer field(const std::string& fld) const { return field(utf8::to32(fld)); } + pointer& field_inplace(const std::string& fld) { return field_inplace(utf8::to32(fld)); } - pointer field(const std::u32string& fld) const throw(std::bad_alloc); - pointer& field_inplace(const std::u32string& fld) throw(std::bad_alloc); - pointer remove() const throw(std::bad_alloc); - pointer& remove_inplace() throw(std::bad_alloc); + pointer field(const std::u32string& fld) const; + pointer& field_inplace(const std::u32string& fld); + pointer remove() const; + pointer& remove_inplace(); std::string as_string8() const { return utf8::to8(_pointer); } std::u32string as_string() const { return _pointer; } friend std::ostream& operator<<(std::ostream& s, const pointer& p); @@ -299,8 +299,8 @@ public: */ node(null_tag) throw(); node(boolean_tag, bool b) throw(); - node(string_tag, const std::u32string& str) throw(std::bad_alloc); - node(string_tag, const std::string& str) throw(std::bad_alloc); + node(string_tag, const std::u32string& str); + node(string_tag, const std::string& str); node(number_tag, double n) throw(); node(number_tag, int64_t n) throw(); node(number_tag, uint64_t n) throw(); @@ -314,15 +314,15 @@ public: /** * Copy Constructor. */ - node(const node& _node) throw(std::bad_alloc); + node(const node& _node); /** * Construct object from description. */ - node(const std::string& doc) throw(std::bad_alloc, error); + node(const std::string& doc); /** * Serialize document. */ - std::string serialize(printer* printer = NULL) const throw(std::bad_alloc, error); + std::string serialize(printer* printer = NULL) const; /** * Get type of node. */ @@ -330,68 +330,68 @@ public: /** * Get type of node by pointer. */ - int type_of(const std::u32string& pointer) const throw(std::bad_alloc); - int type_of(const std::string& pointer) const throw(std::bad_alloc) + int type_of(const std::u32string& pointer) const; + int type_of(const std::string& pointer) const { return type_of(utf8::to32(pointer)); } - int type_of(const pointer& ptr) const throw(std::bad_alloc) + int type_of(const pointer& ptr) const { return type_of(ptr._pointer); } /** * Get type of node by pointer (indirect). */ - int type_of_indirect(const std::u32string& pointer) const throw(std::bad_alloc); - int type_of_indirect(const std::string& pointer) const throw(std::bad_alloc) + int type_of_indirect(const std::u32string& pointer) const; + int type_of_indirect(const std::string& pointer) const { return type_of_indirect(utf8::to32(pointer)); } - int type_of_indirect(const pointer& ptr) const throw(std::bad_alloc) + int type_of_indirect(const pointer& ptr) const { return type_of_indirect(ptr._pointer); } /** * Resolve an indirect pointer */ - std::u32string resolve_indirect(const std::u32string& pointer) const throw(std::bad_alloc); - std::string resolve_indirect(const std::string& pointer) const throw(std::bad_alloc) + std::u32string resolve_indirect(const std::u32string& pointer) const; + std::string resolve_indirect(const std::string& pointer) const { return utf8::to8(resolve_indirect(utf8::to32(pointer))); } - pointer resolve_indirect(const pointer& ptr) const throw(std::bad_alloc) + pointer resolve_indirect(const pointer& ptr) const { return pointer(resolve_indirect(ptr._pointer)); } /** * Get double numeric value (NT_NUMBER). */ - double as_double() const throw(error); + double as_double() const; /** * Get int64_t value (NT_NUMBER). */ - int64_t as_int() const throw(error); + int64_t as_int() const; /** * Get uint64_t value (NT_NUMBER). */ - uint64_t as_uint() const throw(error); + uint64_t as_uint() const; /** * Read the string as UTF-8 (NT_STRING). */ - const std::u32string& as_string() const throw(std::bad_alloc, error); - std::string as_string8() const throw(std::bad_alloc, error) { return utf8::to8(as_string()); } + const std::u32string& as_string() const; + std::string as_string8() const { return utf8::to8(as_string()); } /** * Get boolean value (NT_BOOLEAN). */ - bool as_bool() const throw(error); + bool as_bool() const; /** * Read number of indices in array (NT_ARRAY). */ - size_t index_count() const throw(error); + size_t index_count() const; /** * Read specified index from array (NT_ARRAY). */ - const node& index(size_t idx) const throw(error) + const node& index(size_t idx) const { const node* n; auto e = index_soft(idx, n); @@ -401,30 +401,30 @@ public: /** * Read number of indices in object key (NT_OBJECT). */ - size_t field_count(const std::u32string& key) const throw(error); - size_t field_count(const std::string& key) const throw(std::bad_alloc, error) + size_t field_count(const std::u32string& key) const; + size_t field_count(const std::string& key) const { return field_count(utf8::to32(key)); } /** * Specified field exists (NT_OBJECT) */ - bool field_exists(const std::u32string& key) const throw(error); - bool field_exists(const std::string& key) const throw(std::bad_alloc, error) + bool field_exists(const std::u32string& key) const; + bool field_exists(const std::string& key) const { return field_exists(utf8::to32(key)); } /** * Read specified key from object (NT_OBJECT). */ - const node& field(const std::u32string& key, size_t subindex = 0) const throw(error) + const node& field(const std::u32string& key, size_t subindex = 0) const { const node* n; auto e = field_soft(key, subindex, n); if(e != ERR_OK) throw error(e); return *n; } - const node& field(const std::string& key, size_t subindex = 0) const throw(std::bad_alloc, error) + const node& field(const std::string& key, size_t subindex = 0) const { return field(utf8::to32(key), subindex); } @@ -432,40 +432,40 @@ public: /** * Apply JSON pointer (RFC 6901). */ - const node& follow(const std::u32string& pointer) const throw(std::bad_alloc, error) + const node& follow(const std::u32string& pointer) const { const node* n; auto e = follow_soft(pointer, n); if(e != ERR_OK) throw error(e); return *n; } - const node& follow(const std::string& pointer) const throw(std::bad_alloc, error) + const node& follow(const std::string& pointer) const { return follow(utf8::to32(pointer)); } - const node& follow(const pointer& ptr) const throw(std::bad_alloc, error) + const node& follow(const pointer& ptr) const { return follow(ptr._pointer); } /** * Apply JSON pointer (RFC 6901) following strings as indirect references. */ - const node& follow_indirect(const std::u32string& pointer) const throw(std::bad_alloc, error) + const node& follow_indirect(const std::u32string& pointer) const { return follow(resolve_indirect(pointer)); } - const node& follow_indirect(const std::string& pointer) const throw(std::bad_alloc, error) + const node& follow_indirect(const std::string& pointer) const { return follow_indirect(utf8::to32(pointer)); } - const node& follow_indirect(const pointer& ptr) const throw(std::bad_alloc, error) + const node& follow_indirect(const pointer& ptr) const { return follow_indirect(ptr._pointer); } /** * Set value of node (any). */ - node& operator=(const node& node) throw(std::bad_alloc); + node& operator=(const node& node); /** * Set value of node. */ @@ -474,15 +474,15 @@ public: node& set(number_tag, double number) throw(); node& set(number_tag, int64_t number) throw(); node& set(number_tag, uint64_t number) throw(); - node& set(string_tag, const std::u32string& key) throw(std::bad_alloc); - node& set(string_tag tag, const std::string& key) throw(std::bad_alloc) + node& set(string_tag, const std::u32string& key); + node& set(string_tag tag, const std::string& key) { return set(tag, utf8::to32(key)); } /** * Read/Write specified index from array (NT_ARRAY). */ - node& index(size_t idx) throw(error) + node& index(size_t idx) { node* n; auto e = index_soft(idx, n); @@ -492,141 +492,141 @@ public: /** * Append new element to array (NT_ARRAY). */ - node& append(const node& node) throw(std::bad_alloc, error); + node& append(const node& node); /** * Read/Write specified key from object (NT_OBJECT). */ - node& field(const std::u32string& key, size_t subindex = 0) throw(error) + node& field(const std::u32string& key, size_t subindex = 0) { node* n; auto e = field_soft(key, subindex, n); if(e != ERR_OK) throw error(e); return *n; } - node& field(const std::string& key, size_t subindex = 0) throw(std::bad_alloc, error) + node& field(const std::string& key, size_t subindex = 0) { return field(utf8::to32(key), subindex); } /** * Insert new element to object (NT_OBJECT). */ - node& insert(const std::u32string& key, const node& node) throw(std::bad_alloc, error); - node& insert(const std::string& key, const node& node) throw(std::bad_alloc, error) + node& insert(const std::u32string& key, const node& node); + node& insert(const std::string& key, const node& node) { return insert(utf8::to32(key), node); } /** * Apply JSON pointer (RFC 6901). */ - node& follow(const std::u32string& pointer) throw(std::bad_alloc, error) + node& follow(const std::u32string& pointer) { node* n; auto e = follow_soft(pointer, n); if(e != ERR_OK) throw error(e); return *n; } - node& follow(const std::string& pointer) throw(std::bad_alloc, error) + node& follow(const std::string& pointer) { return follow(utf8::to32(pointer)); } - node& follow(const pointer& ptr) throw(std::bad_alloc, error) + node& follow(const pointer& ptr) { return follow(ptr._pointer); } /** * Apply JSON pointer (RFC 6901) following strings as indirect references. */ - node& follow_indirect(const std::u32string& pointer) throw(std::bad_alloc, error) + node& follow_indirect(const std::u32string& pointer) { return follow(resolve_indirect(pointer)); } - node& follow_indirect(const std::string& pointer) throw(std::bad_alloc, error) + node& follow_indirect(const std::string& pointer) { return follow_indirect(utf8::to32(pointer)); } - node& follow_indirect(const pointer& ptr) throw(std::bad_alloc, error) + node& follow_indirect(const pointer& ptr) { return follow_indirect(ptr._pointer); } /** * Return node specified by JSON pointer (RFC 6901). If the last component doesn't exist, it is created as NULL. */ - node& operator[](const std::u32string& pointer) throw(std::bad_alloc, error); - node& operator[](const std::string& pointer) throw(std::bad_alloc, error) + node& operator[](const std::u32string& pointer); + node& operator[](const std::string& pointer) { return (*this)[utf8::to32(pointer)]; } - node& operator[](const pointer& ptr) throw(std::bad_alloc, error) + node& operator[](const pointer& ptr) { return (*this)[ptr._pointer]; } /** * Create node at specified pointer and return it. */ - node& insert_node(const std::u32string& pointer, const node& nwn) throw(std::bad_alloc, error); - node& insert_node(const std::string& pointer, const node& nwn) throw(std::bad_alloc, error) + node& insert_node(const std::u32string& pointer, const node& nwn); + node& insert_node(const std::string& pointer, const node& nwn) { return insert_node(utf8::to32(pointer), nwn); } - node& insert_node(const pointer& ptr, const node& nwn) throw(std::bad_alloc, error) + node& insert_node(const pointer& ptr, const node& nwn) { return insert_node(ptr._pointer, nwn); } /** * Delete a node by pointer and return what was deleted. */ - node delete_node(const std::u32string& pointer) throw(std::bad_alloc, error); - node delete_node(const std::string& pointer) throw(std::bad_alloc, error) + node delete_node(const std::u32string& pointer); + node delete_node(const std::string& pointer) { return delete_node(utf8::to32(pointer)); } - node delete_node(const pointer& ptr) throw(std::bad_alloc, error) + node delete_node(const pointer& ptr) { return delete_node(ptr._pointer); } /** * Synonym for follow(). */ - const node& operator[](const std::u32string& pointer) const throw(std::bad_alloc, error) + const node& operator[](const std::u32string& pointer) const { return follow(pointer); } - const node& operator[](const std::string& pointer) const throw(std::bad_alloc, error) + const node& operator[](const std::string& pointer) const { return follow(pointer); } - const node& operator[](const pointer& ptr) const throw(std::bad_alloc, error) + const node& operator[](const pointer& ptr) const { return follow(ptr._pointer); } /** * Delete an array index. The rest are shifted. */ - void erase_index(size_t idx) throw(error); + void erase_index(size_t idx); /** * Delete an array field. The rest are shifted. */ - void erase_field(const std::u32string& fld, size_t idx = 0) throw(error); - void erase_field(const std::string& fld, size_t idx = 0) throw(std::bad_alloc, error) + void erase_field(const std::u32string& fld, size_t idx = 0); + void erase_field(const std::string& fld, size_t idx = 0) { erase_field(utf8::to32(fld), idx); } /** * Delete an entiere array field. */ - void erase_field_all(const std::u32string& fld) throw(error); - void erase_field_all(const std::string& fld) throw(std::bad_alloc, error) + void erase_field_all(const std::u32string& fld); + void erase_field_all(const std::string& fld) { erase_field_all(utf8::to32(fld)); } /** * Apply a JSON patch. */ - node patch(const node& patch) const throw(std::bad_alloc, error); + node patch(const node& patch) const; /** * Clear entiere array or object. */ - void clear() throw(error); + void clear(); /** * Iterator. */ @@ -639,14 +639,14 @@ public: typedef node& reference; typedef node* pointer; iterator() throw(); - iterator(node& n) throw(error); - std::u32string key() throw(std::bad_alloc, error); - std::string key8() throw(std::bad_alloc, error) { return utf8::to8(key()); } - size_t index() throw(error); - node& operator*() throw(error); - node* operator->() throw(error); - iterator operator++(int) throw(error); - iterator& operator++() throw(error); + iterator(node& n); + std::u32string key(); + std::string key8() { return utf8::to8(key()); } + size_t index(); + node& operator*(); + node* operator->(); + iterator operator++(int); + iterator& operator++(); bool operator==(const iterator& i) throw(); bool operator!=(const iterator& i) throw(); private: @@ -667,14 +667,14 @@ public: typedef const node& reference; typedef const node* pointer; const_iterator() throw(); - const_iterator(const node& n) throw(error); - std::u32string key() throw(std::bad_alloc, error); - std::string key8() throw(std::bad_alloc, error) { return utf8::to8(key()); } - size_t index() throw(error); - const node& operator*() throw(error); - const node* operator->() throw(error); - const_iterator operator++(int) throw(error); - const_iterator& operator++() throw(error); + const_iterator(const node& n); + std::u32string key(); + std::string key8() { return utf8::to8(key()); } + size_t index(); + const node& operator*(); + const node* operator->(); + const_iterator operator++(int); + const_iterator& operator++(); bool operator==(const const_iterator& i) throw(); bool operator!=(const const_iterator& i) throw(); private: @@ -685,14 +685,14 @@ public: /** * Iterators */ - const_iterator begin() const throw(error) { return const_iterator(*this); } + const_iterator begin() const { return const_iterator(*this); } const_iterator end() const throw() { return const_iterator(); } - iterator begin() throw(error) { return iterator(*this); } + iterator begin() { return iterator(*this); } iterator end() throw() { return iterator(); } /** * Delete item pointed by iterator. The rest are shifted and new iterator is returned. */ - iterator erase(iterator itr) throw(error); + iterator erase(iterator itr); private: class number_holder { @@ -723,8 +723,8 @@ private: friend class iterator; friend class const_iterator; void fixup_nodes(const node& _node); - void ctor(const std::string& doc, size_t& ptr, size_t len) throw(std::bad_alloc, error); - node(const std::string& doc, size_t& ptr, size_t len) throw(std::bad_alloc, error); + void ctor(const std::string& doc, size_t& ptr, size_t len); + node(const std::string& doc, size_t& ptr, size_t len); template void set_helper(T v) { std::u32string tmp; @@ -748,8 +748,8 @@ private: std::list xarray; std::vector xarray_index; std::map> xobject; - errorcode follow_soft(const std::u32string& pointer, const node*& out) const throw(std::bad_alloc); - errorcode follow_soft(const std::u32string& pointer, node*& out) throw(std::bad_alloc); + errorcode follow_soft(const std::u32string& pointer, const node*& out) const; + errorcode follow_soft(const std::u32string& pointer, node*& out); errorcode field_soft(const std::u32string& key, size_t subindex, node*& out) throw(); errorcode field_soft(const std::u32string& key, size_t subindex, const node*& out) const throw(); errorcode index_soft(size_t index, node*& out) throw(); diff --git a/include/library/keyboard-mapper.hpp b/include/library/keyboard-mapper.hpp index 7cb71586..c4d47711 100644 --- a/include/library/keyboard-mapper.hpp +++ b/include/library/keyboard-mapper.hpp @@ -18,7 +18,7 @@ class invbind; class ctrlrkey; std::pair keymapper_lookup_subkey(keyboard& kbd, const std::string& name, - bool axis) throw(std::bad_alloc, std::runtime_error); + bool axis); /** * Key specifier @@ -28,17 +28,17 @@ struct keyspec /** * Create a new key specifier (invalid). */ - keyspec() throw(std::bad_alloc); + keyspec(); /** * Create a new key specifier from keyspec. * * Parameter keyspec: The key specifier. */ - keyspec(const std::string& keyspec) throw(std::bad_alloc, std::runtime_error); + keyspec(const std::string& keyspec); /** * Get the key specifier as a keyspec. */ - operator std::string() throw(std::bad_alloc); + operator std::string(); /** * Is valid? */ @@ -126,7 +126,7 @@ public: /** * Add a callback on new invese bind. */ - void add_callback(listener& listener) throw(std::bad_alloc); + void add_callback(listener& listener); /** * Drop a callback on new inverse bind. */ @@ -142,7 +142,7 @@ public: /** * Create new keyboard mapper. */ - mapper(keyboard& kbd, command::group& domain) throw(std::bad_alloc); + mapper(keyboard& kbd, command::group& domain); /** * Destroy a keyboard mapper. */ @@ -157,8 +157,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: The binding would conflict with existing one or invalid modifier/key. */ - void bind(std::string mod, std::string modmask, std::string keyname, std::string command) - throw(std::bad_alloc, std::runtime_error); + void bind(std::string mod, std::string modmask, std::string keyname, std::string command); /** * Unbinds a key, erroring out if binding does not exist. * @@ -168,68 +167,67 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: The binding does not exist. */ - void unbind(std::string mod, std::string modmask, std::string keyname) throw(std::bad_alloc, - std::runtime_error); + void unbind(std::string mod, std::string modmask, std::string keyname); /** * Get keys bound. * * Returns: The set of keyspecs that are bound. */ - std::list get_bindings() throw(std::bad_alloc); + std::list get_bindings(); /** * Get command for key. */ - std::string get(const keyspec& keyspec) throw(std::bad_alloc); + std::string get(const keyspec& keyspec); /** * Bind command for key. * * Parameter keyspec: The key specifier to bind to. * Parameter cmd: The command to bind. If "", the key is unbound. */ - void set(const keyspec& keyspec, const std::string& cmd) throw(std::bad_alloc, std::runtime_error); + void set(const keyspec& keyspec, const std::string& cmd); /** * Get set of inverse binds. * * Returns: The set of all inverses. */ - std::set get_inverses() throw(std::bad_alloc); + std::set get_inverses(); /** * Find inverse bind by command. * * Parameter command: The command. * Returns: The inverse bind, or NULL if none. */ - invbind* get_inverse(const std::string& command) throw(std::bad_alloc); + invbind* get_inverse(const std::string& command); /** * Get set of controller keys. * * Returns: The set of all controller keys. */ - std::set get_controller_keys() throw(std::bad_alloc); + std::set get_controller_keys(); /** * Get specific controller key. */ - ctrlrkey* get_controllerkey(const std::string& command) throw(std::bad_alloc); + ctrlrkey* get_controllerkey(const std::string& command); /** * Get list of controller keys for specific keyboard key. */ - std::list get_controllerkeys_kbdkey(key* kbdkey) throw(std::bad_alloc); + std::list get_controllerkeys_kbdkey(key* kbdkey); /** * Register inverse bind. */ - void do_register(const std::string& name, invbind& bind) throw(std::bad_alloc); + void do_register(const std::string& name, invbind& bind); /** * Unregister inverse bind. */ - void do_unregister(const std::string& name, invbind& bind) throw(std::bad_alloc); + void do_unregister(const std::string& name, invbind& bind); /** * Register controller key. */ - void do_register(const std::string& name, ctrlrkey& ckey) throw(std::bad_alloc); + void do_register(const std::string& name, ctrlrkey& ckey); /** * Unregister inverse bind. */ - void do_unregister(const std::string& name, ctrlrkey& ckey) throw(std::bad_alloc); + void do_unregister(const std::string& name, ctrlrkey& ckey); /** * Get keyboard. */ @@ -245,7 +243,7 @@ public: * Parameter polarity: Polarity (true is rising edge, false is falling edge). * Returns: The fixed command, or "" if nothing should be run. */ - static std::string fixup_command_polarity(std::string cmd, bool polarity) throw(std::bad_alloc); + static std::string fixup_command_polarity(std::string cmd, bool polarity); /** * Add a set of inverse binds. */ @@ -268,7 +266,7 @@ public: bool operator!=(const struct triplet& a) const { return !(a == *this); } bool operator>=(const struct triplet& a) const { return !(a < *this); } bool operator>(const struct triplet& a) const { return (a < *this); } - keyspec as_keyspec() const throw(std::bad_alloc); + keyspec as_keyspec() const; bool index; modifier_set mod; modifier_set mask; @@ -311,8 +309,7 @@ public: * Parameter _command: Command this is for. * Parameter _name: Name of inverse key. */ - invbind_info(invbind_set& set, const std::string& _command, const std::string& _name) - throw(std::bad_alloc); + invbind_info(invbind_set& set, const std::string& _command, const std::string& _name); /** * Destructor. */ @@ -344,8 +341,7 @@ public: * Parameter command: Command this is for. * Parameter name: Name of inverse key. */ - invbind(mapper& kmapper, const std::string& command, const std::string& name, bool dynamic = false) - throw(std::bad_alloc); + invbind(mapper& kmapper, const std::string& command, const std::string& name, bool dynamic = false); /** * Destructor. */ @@ -356,25 +352,25 @@ public: * Parameter index: Index of the keyspec to get. * Returns: The keyspec. */ - keyspec get(unsigned index) throw(std::bad_alloc); + keyspec get(unsigned index); /** * Clear key (subsequent keys fill the gap). * * Parameter index: Index of key to clear. */ - void clear(unsigned index) throw(std::bad_alloc); + void clear(unsigned index); /** * Add key to set. * * Parameter keyspec: The new keyspec. */ - void append(const keyspec& keyspec) throw(std::bad_alloc); + void append(const keyspec& keyspec); /** * Get name for command. * * Returns: The name. */ - std::string getname() throw(std::bad_alloc); + std::string getname(); /** * Notify mapper dying. */ @@ -408,7 +404,7 @@ public: * Parameter axis: If true, create a axis-type key. */ ctrlrkey(mapper& kmapper, const std::string& command, const std::string& name, - bool axis = false) throw(std::bad_alloc); + bool axis = false); /** * Destructor. */ @@ -420,7 +416,7 @@ public: /** * Get the trigger key. */ - std::string get_string(unsigned index) throw(std::bad_alloc); + std::string get_string(unsigned index); /** * Set the trigger key (appends). */ @@ -428,7 +424,7 @@ public: /** * Set the trigger key (appends). */ - void append(const std::string& key) throw(std::bad_alloc, std::runtime_error); + void append(const std::string& key); /** * Remove the trigger key. */ diff --git a/include/library/keyboard.hpp b/include/library/keyboard.hpp index 0beff5c4..f9395302 100644 --- a/include/library/keyboard.hpp +++ b/include/library/keyboard.hpp @@ -27,7 +27,7 @@ public: /** * Create a new instance. */ - keyboard() throw(std::bad_alloc); + keyboard(); /** * Destroy an instance. * @@ -41,7 +41,7 @@ public: * Returns: The modifier. * Throws std::runtime_error: No such modifier. */ - modifier& lookup_modifier(const std::string& name) throw(std::runtime_error); + modifier& lookup_modifier(const std::string& name); /** * Try lookup modifier by name. * @@ -54,14 +54,14 @@ public: * * Returns: The set of modifiers. */ - std::list all_modifiers() throw(std::bad_alloc); + std::list all_modifiers(); /** * Register a modifier. * * Parameter name: The name of the modifier. * Parameter mod: The modifier. */ - void do_register(const std::string& name, modifier& mod) throw(std::bad_alloc); + void do_register(const std::string& name, modifier& mod); /** * Unregister a modifier. * @@ -75,7 +75,7 @@ public: * Returns: The key. * Throws std::runtime_error: No such key. */ - key& lookup_key(const std::string& name) throw(std::runtime_error); + key& lookup_key(const std::string& name); /** * Try lookup key by name. * @@ -88,14 +88,14 @@ public: * * Returns: The set of keys. */ - std::list all_keys() throw(std::bad_alloc); + std::list all_keys(); /** * Register a key. * * Parameter name: The name of the key. * Parameter mod: The key. */ - void do_register(const std::string& name, key& mod) throw(std::bad_alloc); + void do_register(const std::string& name, key& mod); /** * Unregister a key. * @@ -132,7 +132,7 @@ public: * Parameter keyb: The keyboard these will be on. * Parameter _name: The name of the modifier. */ - modifier(keyboard& keyb, const std::string& _name) throw(std::bad_alloc) + modifier(keyboard& keyb, const std::string& _name) : kbd(keyb), name(_name) { keyb.do_register(name, *this); @@ -144,7 +144,7 @@ public: * Parameter _name: The name of the modifier. * Parameter _link: The name of the modifier group this is in. */ - modifier(keyboard& keyb, const std::string& _name, const std::string& _link) throw(std::bad_alloc) + modifier(keyboard& keyb, const std::string& _name, const std::string& _link) : kbd(keyb), name(_name), link(_link) { keyb.do_register(name, *this); @@ -195,7 +195,7 @@ public: * parameter really: If true, actually add the key. If false, do nothing. * throws std::bad_alloc: Not enough memory. */ - void add(modifier& mod, bool really = true) throw(std::bad_alloc); + void add(modifier& mod, bool really = true); /** * Remove a modifier from the set. * @@ -203,7 +203,7 @@ public: * parameter really: If true, actually remove the key. If false, do nothing. * throws std::bad_alloc: Not enough memory. */ - void remove(modifier& mod, bool really = true) throw(std::bad_alloc); + void remove(modifier& mod, bool really = true); /** * Construct modifier set from comma-separated string. * @@ -213,8 +213,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Illegal modifier or wrong syntax. */ - static modifier_set construct(keyboard& kbd, const std::string& modifiers) throw(std::bad_alloc, - std::runtime_error); + static modifier_set construct(keyboard& kbd, const std::string& modifiers); /** * Check modifier against its mask for validity. * @@ -226,7 +225,7 @@ public: * returns: True if set is valid, false if not. * throws std::bad_alloc: Not enough memory. */ - bool valid(modifier_set& mask) throw(std::bad_alloc); + bool valid(modifier_set& mask); /** * Check if this modifier set triggers the action. * @@ -236,11 +235,11 @@ public: * - Modifiers with this linkage group do not appear in either set nor trigger. * */ - bool triggers(const modifier_set& trigger, const modifier_set& mask) throw(std::bad_alloc); + bool triggers(const modifier_set& trigger, const modifier_set& mask); /** * Stringify. */ - operator std::string() const throw(std::bad_alloc); + operator std::string() const; /** * Equality check. * @@ -500,8 +499,7 @@ public: * Parameter clazz: The class of the key. * Parameter type: The type of key. */ - key(keyboard& keyb, const std::string& name, const std::string& clazz, keytype type) - throw(std::bad_alloc); + key(keyboard& keyb, const std::string& name, const std::string& clazz, keytype type); /** * Destructor. */ @@ -528,7 +526,7 @@ public: * Parameter listener: The listener. * Parameter analog: If true, also pass analog events. */ - void add_listener(event_listener& listener, bool analog) throw(std::bad_alloc); + void add_listener(event_listener& listener, bool analog); /** * Remove listener. * @@ -559,7 +557,7 @@ public: /** * Get the subkey suffixes. */ - virtual std::vector get_subkeys() throw(std::bad_alloc) = 0; + virtual std::vector get_subkeys() = 0; /** * Dynamic cast to axis type. */ @@ -601,7 +599,7 @@ public: * Parameter name: The base name of the key. * Parameter clazz: The class of the key. */ - key_key(keyboard& keyb, const std::string& name, const std::string& clazz) throw(std::bad_alloc); + key_key(keyboard& keyb, const std::string& name, const std::string& clazz); /** * Destructor. */ @@ -624,7 +622,7 @@ public: /** * Get the subkey suffixes. */ - std::vector get_subkeys() throw(std::bad_alloc); + std::vector get_subkeys(); private: key_key(key_key&); key_key& operator=(key_key&); @@ -644,7 +642,7 @@ public: * Parameter name: The base name of the key. * Parameter clazz: The class of the key. */ - key_hat(keyboard& keyb, const std::string& name, const std::string& clazz) throw(std::bad_alloc); + key_hat(keyboard& keyb, const std::string& name, const std::string& clazz); /** * Destructor. */ @@ -667,7 +665,7 @@ public: /** * Get the subkey suffixes. */ - std::vector get_subkeys() throw(std::bad_alloc); + std::vector get_subkeys(); private: key_hat(key_hat&); key_hat& operator=(key_hat&); @@ -688,8 +686,7 @@ public: * Parameter clazz: The class of the key. * Parameter mode: Initial mode: -1 => disabled, 0 => axis, 1 => pressure */ - key_axis(keyboard& keyb, const std::string& name, const std::string& clazz, int mode) - throw(std::bad_alloc); + key_axis(keyboard& keyb, const std::string& name, const std::string& clazz, int mode); /** * Destructor. */ @@ -712,7 +709,7 @@ public: /** * Get the subkey suffixes. */ - std::vector get_subkeys() throw(std::bad_alloc); + std::vector get_subkeys(); /** * Get mode. */ @@ -745,7 +742,7 @@ public: * Parameter cal: Initial calibration. */ key_mouse(keyboard& keyb, const std::string& name, const std::string& clazz, - mouse_calibration cal) throw(std::bad_alloc); + mouse_calibration cal); /** * Destructor. */ @@ -768,7 +765,7 @@ public: /** * Get the subkey suffixes. Returns empty list. */ - std::vector get_subkeys() throw(std::bad_alloc); + std::vector get_subkeys(); /** * Get calibration. */ diff --git a/include/library/loadlib.hpp b/include/library/loadlib.hpp index f5e11e04..9a57466c 100644 --- a/include/library/loadlib.hpp +++ b/include/library/loadlib.hpp @@ -32,7 +32,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Error loading shared library. */ - library(const std::string& filename) throw(std::bad_alloc, std::runtime_error) + library(const std::string& filename) { try { set_loading(this); @@ -60,7 +60,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Error looking up the symbol. */ - void* operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error) + void* operator[](const std::string& symbol) const { threads::alock h(global_mutex()); if(!lib) throw std::runtime_error("Symbol '" + symbol + "' not found"); @@ -106,12 +106,12 @@ public: */ static library* loading() throw(); private: - void set_loading(library* lib) throw(std::bad_alloc); + void set_loading(library* lib); struct internal { - internal(const std::string& filename) throw(std::bad_alloc, std::runtime_error); + internal(const std::string& filename); ~internal() throw(); - void* operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error); + void* operator[](const std::string& symbol) const; internal(const internal&); internal& operator=(const internal&); void* handle; @@ -158,11 +158,11 @@ public: /** * Symbol lookup. */ - void* operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error); + void* operator[](const std::string& symbol) const; /** * Variable symbol lookup. */ - template T* var(const std::string& symbol) const throw(std::bad_alloc, std::runtime_error) + template T* var(const std::string& symbol) const { return (T*)(*this)[symbol]; } @@ -170,7 +170,6 @@ public: * Function symbol lookup. */ template typename fntype::t fn(const std::string& symbol) const - throw(std::bad_alloc, std::runtime_error) { return (typename fntype::t)(*this)[symbol]; } diff --git a/include/library/lua-base.hpp b/include/library/lua-base.hpp index 1b9d8a4a..0902bd12 100644 --- a/include/library/lua-base.hpp +++ b/include/library/lua-base.hpp @@ -194,7 +194,7 @@ public: /** * Create a new state. */ - state() throw(std::bad_alloc); + state(); /** * Create a new state with specified master state. */ @@ -235,7 +235,7 @@ public: /** * Reset the state. */ - void reset() throw(std::runtime_error, std::bad_alloc); + void reset(); /** * Deinit the state. */ @@ -308,7 +308,7 @@ public: * Returns: The string. * Throws std::runtime_error: The specified argument is not a string. */ - std::string get_string(int argindex, const std::string& fname) throw(std::runtime_error, std::bad_alloc) + std::string get_string(int argindex, const std::string& fname) { if(isnone(argindex)) (stringfmt() << "argument #" << argindex << " to " << fname << " must be string").throwex(); @@ -326,7 +326,7 @@ public: * Returns: The string. * Throws std::runtime_error: The specified argument is not a boolean. */ - bool get_bool(int argindex, const std::string& fname) throw(std::runtime_error, std::bad_alloc) + bool get_bool(int argindex, const std::string& fname) { if(isnone(argindex) || !isboolean(argindex)) (stringfmt() << "argument #" << argindex << " to " << fname << " must be boolean").throwex(); diff --git a/include/library/lua-class.hpp b/include/library/lua-class.hpp index dccfe75c..0e30add0 100644 --- a/include/library/lua-class.hpp +++ b/include/library/lua-class.hpp @@ -377,7 +377,6 @@ public: * Throws std::runtime_error: Wrong type. */ static T* get(state& _state, int arg, const std::string& fname, bool optional = false) - throw(std::bad_alloc, std::runtime_error) { return objclass()._get(_state, arg, fname, optional); } @@ -433,8 +432,7 @@ public: * Parameter fname: Name of function for error message purposes. * Throws std::runtime_error: Wrong type. */ - static objpin pin(state& _state, int arg, const std::string& fname) throw(std::bad_alloc, - std::runtime_error) + static objpin pin(state& _state, int arg, const std::string& fname) { return objclass()._pin(_state, arg, fname); } diff --git a/include/library/lua-framebuffer.hpp b/include/library/lua-framebuffer.hpp index 61d3f71e..b65c2ff3 100644 --- a/include/library/lua-framebuffer.hpp +++ b/include/library/lua-framebuffer.hpp @@ -17,10 +17,8 @@ struct render_context uint32_t height; }; -framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname) - throw(std::bad_alloc, std::runtime_error); -framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname, int64_t dflt) - throw(std::bad_alloc, std::runtime_error); +framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname); +framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname, int64_t dflt); } #endif diff --git a/include/library/lua-function.hpp b/include/library/lua-function.hpp index c5cac413..aa341361 100644 --- a/include/library/lua-function.hpp +++ b/include/library/lua-function.hpp @@ -58,7 +58,7 @@ public: /** * Register function. */ - function(function_group& group, const std::string& name) throw(std::bad_alloc); + function(function_group& group, const std::string& name); /** * Unregister function. */ diff --git a/include/library/memorysearch.hpp b/include/library/memorysearch.hpp index bbb17b45..e32bc521 100644 --- a/include/library/memorysearch.hpp +++ b/include/library/memorysearch.hpp @@ -22,12 +22,12 @@ public: * * Parameter space: The memory space. */ - memory_search(memory_space& space) throw(std::bad_alloc); + memory_search(memory_space& space); /** * Reset the context so all addresses are candidates again. */ - void reset() throw(std::bad_alloc); + void reset(); /** * This searches the memory space, leaving those addresses for which condition object returns true. @@ -54,7 +54,7 @@ public: /** * Returns list of all candidates. This function isn't lazy, so be careful when calling with many candidates. */ - std::list get_candidates() throw(std::bad_alloc); + std::list get_candidates(); /** * Is specified address a candidate? */ diff --git a/include/library/messagebuffer.hpp b/include/library/messagebuffer.hpp index 537d4914..70701e70 100644 --- a/include/library/messagebuffer.hpp +++ b/include/library/messagebuffer.hpp @@ -23,7 +23,7 @@ public: /** * Handle update. */ - virtual void messagebuffer_update() throw(std::bad_alloc, std::runtime_error) = 0; + virtual void messagebuffer_update() = 0; }; /** * Create new message buffer with specified maximum message count. @@ -33,7 +33,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::logic_error: Windowsize is greater than maxmessages or maxmessages is zero. */ - messagebuffer(size_t maxmessages, size_t windowsize) throw(std::bad_alloc, std::logic_error); + messagebuffer(size_t maxmessages, size_t windowsize); /** * Add a new message to the buffer. @@ -42,7 +42,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void add_message(const std::string& msg) throw(std::bad_alloc, std::runtime_error); + void add_message(const std::string& msg); /** * Read a message. @@ -52,7 +52,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::logic_error: Invalid message number. */ - const std::string& get_message(size_t msgnum) throw(std::bad_alloc, std::logic_error); + const std::string& get_message(size_t msgnum); /** * Get the number of first message present. @@ -117,7 +117,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_beginning() throw(std::bad_alloc, std::runtime_error); + void scroll_beginning(); /** * Scroll up one page. @@ -125,7 +125,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_up_page() throw(std::bad_alloc, std::runtime_error); + void scroll_up_page(); /** * Scroll up one line. @@ -133,7 +133,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_up_line() throw(std::bad_alloc, std::runtime_error); + void scroll_up_line(); /** * Scroll down one line. @@ -141,7 +141,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_down_line() throw(std::bad_alloc, std::runtime_error); + void scroll_down_line(); /** * Scroll down one page. @@ -149,7 +149,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_down_page() throw(std::bad_alloc, std::runtime_error); + void scroll_down_page(); /** * Scroll to beginning. @@ -157,7 +157,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Thrown through from update handler. */ - void scroll_end() throw(std::bad_alloc, std::runtime_error); + void scroll_end(); /** * Register an update handler. @@ -165,7 +165,7 @@ public: * Parameter handler: The new handler. * Throws std::bad_alloc: Not enough memory. */ - void register_handler(update_handler& handler) throw(std::bad_alloc); + void register_handler(update_handler& handler); /** * Unregister an update handler. @@ -182,7 +182,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::logic_error: Windowsize is greater than maxmessages or maxmessages is zero. */ - void set_max_window_size(size_t windowsize) throw(std::bad_alloc, std::logic_error); + void set_max_window_size(size_t windowsize); /** * Read the window size. diff --git a/include/library/movie.hpp b/include/library/movie.hpp index 59f2ca7c..4cf393d4 100644 --- a/include/library/movie.hpp +++ b/include/library/movie.hpp @@ -18,7 +18,7 @@ public: * * throws std::bad_alloc: Not enough memory. */ - movie() throw(std::bad_alloc); + movie(); /** * Dtor. @@ -38,7 +38,7 @@ public: * parameter enable: If true, switch to read-only mode, else to read-write mode. * throws std::bad_alloc: Not enough memory. */ - void readonly_mode(bool enable) throw(std::bad_alloc); + void readonly_mode(bool enable); /** * Returns the movie rerecord count (this is not the same thing as global rerecord count). @@ -46,7 +46,7 @@ public: * returns: The movie rerecord count * throws std::bad_alloc: Not enough memory. */ - std::string rerecord_count() throw(std::bad_alloc); + std::string rerecord_count(); /** * Sets the movie rerecord count (this is not the same thing as global rerecord count). @@ -54,7 +54,7 @@ public: * parameter count: The new rerecord count * throws std::bad_alloc: Not enough memory. */ - void rerecord_count(const std::string& count) throw(std::bad_alloc); + void rerecord_count(const std::string& count); /** * Read project ID @@ -62,7 +62,7 @@ public: * returns: The project ID * throws std::bad_alloc: Not enough memory. */ - std::string project_id() throw(std::bad_alloc); + std::string project_id(); /** * brief Set project ID @@ -70,7 +70,7 @@ public: * parameter id: New project ID. * throws std::bad_alloc: Not enough memory. */ - void project_id(const std::string& id) throw(std::bad_alloc); + void project_id(const std::string& id); /** * Get number of frames in movie @@ -101,7 +101,7 @@ public: * * throws std::bad_alloc: Not enough memory. */ - void next_frame() throw(std::bad_alloc); + void next_frame(); /** * Reads the data ready flag. On new frame, all data ready flags are unset. On reading control, its data ready @@ -112,7 +112,7 @@ public: * returns: The read value. * throws std::logic_error: Invalid control index. */ - bool get_DRDY(unsigned port, unsigned controller, unsigned index) throw(std::logic_error); + bool get_DRDY(unsigned port, unsigned controller, unsigned index); /** * Set all data ready flags @@ -128,7 +128,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::logic_error: Invalid port, controller or index or before movie start. */ - short next_input(unsigned port, unsigned controller, unsigned index) throw(std::bad_alloc, std::logic_error); + short next_input(unsigned port, unsigned controller, unsigned index); /** * Set current control values. These are read in readwrite mode. @@ -154,8 +154,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Bad movie data. */ - void load(const std::string& rerecs, const std::string& project_id, portctrl::frame_vector& input) - throw(std::bad_alloc, std::runtime_error); + void load(const std::string& rerecs, const std::string& project_id, portctrl::frame_vector& input); /** * This method serializes the state of movie code. @@ -167,7 +166,7 @@ public: * throws std::bad_alloc: Not enough memory. */ void save_state(std::string& proj_id, uint64_t& curframe, uint64_t& lagframes, - std::vector& pcounters) throw(std::bad_alloc); + std::vector& pcounters); /** * Given previous serialized state from this movie, restore the state. @@ -183,8 +182,7 @@ public: * Throws std::runtime_error: Movie check failure. */ size_t restore_state(uint64_t curframe, uint64_t lagframe, const std::vector& pcounters, bool ro, - portctrl::frame_vector* old_movie, const std::string& old_projectid) throw(std::bad_alloc, - std::runtime_error); + portctrl::frame_vector* old_movie, const std::string& old_projectid); /** * Reset the state of movie to initial state. */ diff --git a/include/library/ogg.hpp b/include/library/ogg.hpp index 4a03ea1a..900d33bb 100644 --- a/include/library/ogg.hpp +++ b/include/library/ogg.hpp @@ -90,7 +90,7 @@ public: * Parameter advance: The number of bytes in packet is stored here. * Throws std::runtime_error: Bad packet. */ - page(const char* buffer, size_t& advance) throw(std::runtime_error); + page(const char* buffer, size_t& advance); /** * Scan a buffer for pages. * @@ -200,11 +200,11 @@ public: /** * Get debugging info for stream this page is from. */ - std::string stream_debug_id() const throw(std::bad_alloc); + std::string stream_debug_id() const; /** * Get debugging info for this page. */ - std::string page_debug_id() const throw(std::bad_alloc); + std::string page_debug_id() const; /** * The special granule pos for nothing. */ @@ -343,14 +343,14 @@ public: * Parameter size: The maximum size to read. * Returns: The number of bytes actually read. */ - virtual size_t read(char* buffer, size_t size) throw(std::exception) = 0; + virtual size_t read(char* buffer, size_t size) = 0; /** * Read a page from stream. * * Parameter page: The page is assigned here if successful. * Returns: True if page was obtained, false if not. */ - bool get_page(page& page) throw(std::exception); + bool get_page(page& page); /** * Set stream to report errors to. * @@ -391,7 +391,7 @@ public: */ ~stream_reader_iostreams() throw(); - size_t read(char* buffer, size_t size) throw(std::exception); + size_t read(char* buffer, size_t size); private: std::istream& is; }; @@ -416,13 +416,13 @@ public: * Parameter data: The data to write. * Parameter size: The size to write. */ - virtual void write(const char* buffer, size_t size) throw(std::exception) = 0; + virtual void write(const char* buffer, size_t size) = 0; /** * Write a page to stream. * * Parameter page: The page to write. */ - void put_page(const page& page) throw(std::exception); + void put_page(const page& page); private: stream_writer(const stream_writer&); stream_writer& operator=(const stream_writer&); @@ -445,7 +445,7 @@ public: */ ~stream_writer_iostreams() throw(); - void write(const char* buffer, size_t size) throw(std::exception); + void write(const char* buffer, size_t size); private: std::ostream& os; }; diff --git a/include/library/opus-ogg.hpp b/include/library/opus-ogg.hpp index a253cfe1..941fe48c 100644 --- a/include/library/opus-ogg.hpp +++ b/include/library/opus-ogg.hpp @@ -27,14 +27,14 @@ struct ogg_header * Parameter pacekt: The packet to parse. * Throws std::runtime_error: Not valid OggOpus header page. */ - void parse(struct ogg::packet& packet) throw(std::runtime_error); + void parse(struct ogg::packet& packet); /** * Serialize OggOpus header as an Ogg page. * * Returns: The serialized page. * Throws std::runtime_error: Not valid OggOpus header packet. */ - struct ogg::page serialize() throw(std::runtime_error); + struct ogg::page serialize(); }; /** @@ -50,7 +50,7 @@ struct ogg_tags * Parameter packet: The packet to parse. * Throws std::runtime_error: Not valid OggOpus comment packet. */ - void parse(struct ogg::packet& packet) throw(std::bad_alloc, std::runtime_error); + void parse(struct ogg::packet& packet); /** * Serialize OggOpus comments as Ogg pages. * @@ -59,8 +59,7 @@ struct ogg_tags * Returns: Next sequence number to use. * Throws std::runtime_error: Not valid OggOpus comments. */ - uint32_t serialize(std::function output, uint32_t strmid) - throw(std::bad_alloc, std::runtime_error); + uint32_t serialize(std::function output, uint32_t strmid); }; } #endif diff --git a/include/library/portctrl-data.hpp b/include/library/portctrl-data.hpp index 9eea4891..953a754c 100644 --- a/include/library/portctrl-data.hpp +++ b/include/library/portctrl-data.hpp @@ -288,7 +288,7 @@ public: * Parameter ssize: The storage size in bytes. * Throws std::bad_alloc: Not enough memory. */ - type(const std::string& iname, const std::string& hname, size_t ssize) throw(std::bad_alloc); + type(const std::string& iname, const std::string& hname, size_t ssize); /** * Unregister a port type. */ @@ -396,8 +396,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Illegal port types. */ - static type_set& make(std::vector types, struct index_map control_map) - throw(std::bad_alloc, std::runtime_error); + static type_set& make(std::vector types, struct index_map control_map); /** * Compare sets for equality. */ @@ -413,7 +412,7 @@ public: * Returns: The offset of port. * Throws std::runtime_error: Bad port number. */ - size_t port_offset(unsigned port) const throw(std::runtime_error) + size_t port_offset(unsigned port) const { if(port >= port_count) throw std::runtime_error("Invalid port index"); @@ -426,7 +425,7 @@ public: * Returns: The port type. * Throws std::runtime_error: Bad port number. */ - const class type& port_type(unsigned port) const throw(std::runtime_error) + const class type& port_type(unsigned port) const { if(port >= port_count) throw std::runtime_error("Invalid port index"); @@ -464,7 +463,7 @@ public: * Returns: The triplet (may not be valid). * Throws std::runtime_error: Index out of range. */ - index_triple index_to_triple(unsigned index) const throw(std::runtime_error) + index_triple index_to_triple(unsigned index) const { if(index >= _indices.size()) throw std::runtime_error("Invalid index"); @@ -478,7 +477,7 @@ public: * Parameter _index: The control index. * Returns: The index, or 0xFFFFFFFFUL if specified triple is not valid. */ - unsigned triple_to_index(unsigned port, unsigned controller, unsigned _index) const throw(std::runtime_error) + unsigned triple_to_index(unsigned port, unsigned controller, unsigned _index) const { size_t place = port * port_multiplier + controller * controller_multiplier + _index; if(place >= indices_size) @@ -507,7 +506,7 @@ public: * Returns: Physical controller index (port, controller). * Throws std::runtime_error: No such controller. */ - std::pair lcid_to_pcid(unsigned lcid) const throw(std::runtime_error) + std::pair lcid_to_pcid(unsigned lcid) const { if(lcid >= controllers.size()) throw std::runtime_error("Bad logical controller"); @@ -527,7 +526,7 @@ public: * Returns: The controller index. * Throws std::runtime_error: No such controller. */ - std::pair legacy_pcid_to_pair(unsigned pcid) const throw(std::runtime_error) + std::pair legacy_pcid_to_pair(unsigned pcid) const { if(pcid >= legacy_pcids.size()) throw std::runtime_error("Bad legacy PCID"); @@ -560,14 +559,14 @@ public: * * Throws std::bad_alloc: Not enough memory. */ - counters() throw(std::bad_alloc); + counters(); /** * Create new pollcounter vector suitably sized for given type set. * * Parameter p: The port types. * Throws std::bad_alloc: Not enough memory. */ - counters(const type_set& p) throw(std::bad_alloc); + counters(const type_set& p); /** * Destructor. */ @@ -575,11 +574,11 @@ public: /** * Copy the counters. */ - counters(const counters& v) throw(std::bad_alloc); + counters(const counters& v); /** * Assign the counters. */ - counters& operator=(const counters& v) throw(std::bad_alloc); + counters& operator=(const counters& v); /** * Zero all poll counters and clear all DRDY bits. System flag is cleared. */ @@ -696,7 +695,7 @@ public: * Parameter mem: The memory block to save to. * Throws std::bad_alloc: Not enough memory. */ - void save_state(std::vector& mem) throw(std::bad_alloc); + void save_state(std::vector& mem); /** * Load state from memory block. * @@ -744,7 +743,7 @@ public: * * Parameter p: Types of ports. */ - frame(const type_set& p) throw(std::runtime_error); + frame(const type_set& p); /** * Create subframe of controls with specified controller types and specified memory. * @@ -754,8 +753,7 @@ public: * * Throws std::runtime_error: NULL memory. */ - frame(unsigned char* memory, const type_set& p, frame_vector* host = NULL) - throw(std::runtime_error); + frame(unsigned char* memory, const type_set& p, frame_vector* host = NULL); /** * Copy construct a frame. The memory will be dedicated. * @@ -769,7 +767,7 @@ public: * Returns: Reference to this. * Throws std::runtime_error: The types don't match and memory is not dedicated. */ - frame& operator=(const frame& obj) throw(std::runtime_error); + frame& operator=(const frame& obj); /** * Get type of port. * @@ -800,7 +798,7 @@ public: * Parameter ptype: New port types. * Throws std::runtime_error: Memory is mapped. */ - void set_types(const type_set& ptype) throw(std::runtime_error) + void set_types(const type_set& ptype) { if(memory != backing) throw std::runtime_error("Can't change type of mapped frame"); @@ -832,7 +830,7 @@ public: * Returns: The XOR result (dedicated memory). * Throws std::runtime_error: Type mismatch. */ - frame operator^(const frame& another) throw(std::runtime_error) + frame operator^(const frame& another) { frame x(*this); if(types != another.types) @@ -959,7 +957,7 @@ public: * Parameter buf: The buffer containing text representation. Terminated by NUL, CR or LF. * Throws std::runtime_error: Bad serialized representation. */ - inline void deserialize(const char* buf) throw(std::runtime_error); + inline void deserialize(const char* buf); /** * Serialize frame to text format. * @@ -1063,7 +1061,7 @@ public: * Parameter obj: The object to copy. * Throws std::bad_alloc: Not enough memory. */ - frame_vector(const frame_vector& vector) throw(std::bad_alloc); + frame_vector(const frame_vector& vector); /** * Assign controller frame vector. * @@ -1071,13 +1069,13 @@ public: * Returns: Reference to this. * Throws std::bad_alloc: Not enough memory. */ - frame_vector& operator=(const frame_vector& vector) throw(std::bad_alloc); + frame_vector& operator=(const frame_vector& vector); /** * Blank vector and change the type of ports. * * Parameter p: The port types. */ - void clear(const type_set& p) throw(std::runtime_error); + void clear(const type_set& p); /** * Blank vector. */ @@ -1125,7 +1123,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Port type mismatch. */ - void append(frame frame) throw(std::bad_alloc, std::runtime_error); + void append(frame frame); /** * Change length of vector. * @@ -1135,7 +1133,7 @@ public: * Parameter newsize: New size of vector. * Throws std::bad_alloc: Not enough memory. */ - void resize(size_t newsize) throw(std::bad_alloc); + void resize(size_t newsize); /** * Walk the indexes of sync subframes. * @@ -1221,7 +1219,7 @@ public: * Parameter stream: The stream to save to. * Throws std::runtime_error: Error saving. */ - void save_binary(binarystream::output& stream) const throw(std::runtime_error); + void save_binary(binarystream::output& stream) const; /** * Load from binary form. May partially overwrite on failure. * @@ -1229,7 +1227,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Error saving. */ - void load_binary(binarystream::input& stream) throw(std::bad_alloc, std::runtime_error); + void load_binary(binarystream::input& stream); /** * Check that the movies are compatible up to a point. * @@ -1365,7 +1363,7 @@ void frame::sync(bool x) throw() if(host) host->notify_sync_change((backing[0] & 1) - old); } -void frame::deserialize(const char* buf) throw(std::runtime_error) +void frame::deserialize(const char* buf) { short old = sync(); size_t offset = 0; diff --git a/include/library/portctrl-parse.hpp b/include/library/portctrl-parse.hpp index f63da1fb..74f29f01 100644 --- a/include/library/portctrl-parse.hpp +++ b/include/library/portctrl-parse.hpp @@ -21,7 +21,7 @@ std::string pcs_write_classes(const std::vector& p, unsigned& t struct type_generic : public type { - type_generic(const JSON::node& root, const std::string& ptr) throw(std::exception); + type_generic(const JSON::node& root, const std::string& ptr); ~type_generic() throw(); struct ser_instruction { diff --git a/include/library/rrdata.hpp b/include/library/rrdata.hpp index 5e8c0487..4b52dc6f 100644 --- a/include/library/rrdata.hpp +++ b/include/library/rrdata.hpp @@ -127,7 +127,7 @@ public: * parameter lazy: If true, just switch to project, don't read the IDs. * throws std::bad_alloc: Not enough memory */ - void read_base(const std::string& projectfile, bool lazy) throw(std::bad_alloc); + void read_base(const std::string& projectfile, bool lazy); /** * Is lazy? */ @@ -143,7 +143,7 @@ public: * * parameter i: The load ID to add. */ - void add(const struct instance& i) throw(std::bad_alloc); + void add(const struct instance& i); /** * Write compressed representation of current load ID set to stream. * @@ -151,7 +151,7 @@ public: * returns: Rerecord count. * throws std::bad_alloc: Not enough memory. */ - uint64_t write(std::vector& strm) throw(std::bad_alloc); + uint64_t write(std::vector& strm); /** * Get size for compressed representation. * @@ -178,7 +178,7 @@ public: * returns: Rerecord count. * throws std::bad_alloc: Not enough memory. */ - uint64_t read(std::vector& strm) throw(std::bad_alloc); + uint64_t read(std::vector& strm); /** * Load compressed representation of load ID set from stream, but don't do anything to it. * @@ -186,7 +186,7 @@ public: * returns: Rerecord count. * throws std::bad_alloc: Not enough memory. */ - static uint64_t count(std::vector& strm) throw(std::bad_alloc); + static uint64_t count(std::vector& strm); /** * Count number of rerecords. * diff --git a/include/library/settingvar.hpp b/include/library/settingvar.hpp index aa161845..33a9f137 100644 --- a/include/library/settingvar.hpp +++ b/include/library/settingvar.hpp @@ -81,7 +81,7 @@ public: /** * Add a callback on new supervariable. */ - void add_callback(listener& listener) throw(std::bad_alloc); + void add_callback(listener& listener); /** * Drop a callback on new supervariable. */ @@ -99,7 +99,7 @@ public: /** * Constructor. */ - group() throw(std::bad_alloc); + group(); /** * Destructor. */ @@ -107,7 +107,7 @@ public: /** * Get all settings. */ - std::set get_settings_set() throw(std::bad_alloc); + std::set get_settings_set(); /** * Get setting. */ @@ -115,19 +115,19 @@ public: /** * Add a listener. */ - void add_listener(struct listener& _listener) throw(std::bad_alloc); + void add_listener(struct listener& _listener); /** * Remove a listener. */ - void remove_listener(struct listener& _listener) throw(std::bad_alloc); + void remove_listener(struct listener& _listener); /** * Register a setting. */ - void do_register(const std::string& name, base& _setting) throw(std::bad_alloc); + void do_register(const std::string& name, base& _setting); /** * Unregister a setting. */ - void do_unregister(const std::string& name, base& _setting) throw(std::bad_alloc); + void do_unregister(const std::string& name, base& _setting); /** * Fire listener. */ @@ -135,7 +135,7 @@ public: /** * Add a set of settings. */ - void add_set(set& s) throw(std::bad_alloc); + void add_set(set& s); /** * Remove a set of settings. */ @@ -189,8 +189,7 @@ public: * * Note: If setting has cached value and setting it succeeds, the cached value is cleared. */ - void set(const std::string& name, const std::string& value, bool allow_invalid = false) throw(std::bad_alloc, - std::runtime_error); + void set(const std::string& name, const std::string& value, bool allow_invalid = false); /** * Get a value. * @@ -198,12 +197,11 @@ public: * Return: Actual value of the setting. * Throws std::runtime_error: Setting doesn't exist. */ - std::string get(const std::string& name) throw(std::bad_alloc, std::runtime_error); + std::string get(const std::string& name); /** * Get descriptor for. */ - const description& get_description(const std::string& name) throw(std::bad_alloc, - std::runtime_error); + const description& get_description(const std::string& name); /** * Get human-readable name. * @@ -211,7 +209,7 @@ public: * Return: Human-readable name of the setting. * Throws std::runtime_error: Setting doesn't exist. */ - std::string get_hname(const std::string& name) throw(std::bad_alloc, std::runtime_error); + std::string get_hname(const std::string& name); private: group& grp; std::map badcache; @@ -269,7 +267,7 @@ public: /** * Constructor. */ - void _superbase(set& _s, const std::string& iname) throw(std::bad_alloc); + void _superbase(set& _s, const std::string& iname); /** * Destructor. */ @@ -296,7 +294,7 @@ public: /** * Constructor. */ - base(group& _group, const std::string& iname, const std::string& hname, bool dynamic) throw(std::bad_alloc); + base(group& _group, const std::string& iname, const std::string& hname, bool dynamic); /** * Destructor. */ @@ -304,11 +302,11 @@ public: /** * Set setting. */ - virtual void str(const std::string& val) throw(std::runtime_error, std::bad_alloc) = 0; + virtual void str(const std::string& val) = 0; /** * Get setting. */ - virtual std::string str() const throw(std::runtime_error, std::bad_alloc) = 0; + virtual std::string str() const = 0; /** * Get setting name. */ @@ -358,7 +356,7 @@ public: /** * Set setting. */ - void str(const std::string& val) throw(std::runtime_error, std::bad_alloc) + void str(const std::string& val) { { threads::arlock h(get_setting_lock()); @@ -369,7 +367,7 @@ public: /** * Get setting. */ - std::string str() const throw(std::runtime_error, std::bad_alloc) + std::string str() const { threads::arlock h(get_setting_lock()); return model::write(value); @@ -377,7 +375,7 @@ public: /** * Set setting. */ - void set(valtype_t _value) throw(std::runtime_error, std::bad_alloc) + void set(valtype_t _value) { { threads::arlock h(get_setting_lock()); @@ -390,7 +388,7 @@ public: /** * Get setting. */ - valtype_t get() const throw(std::bad_alloc) + valtype_t get() const { threads::arlock h(get_setting_lock()); return model::transform(value); @@ -427,7 +425,6 @@ public: * Constructor. */ supervariable(set& _s, const std::string& _iname, const std::string& _hname, valtype_t _defaultvalue) - throw(std::bad_alloc) : s(_s) { iname = _iname; diff --git a/include/library/sha256.hpp b/include/library/sha256.hpp index 0e8efe02..73d5917c 100644 --- a/include/library/sha256.hpp +++ b/include/library/sha256.hpp @@ -16,7 +16,7 @@ public: /** * Creates new SHA-256 context, initially containing empty data. */ - sha256() throw(std::bad_alloc) + sha256() { real_init(); finished = false; @@ -65,7 +65,7 @@ public: * Returns: Hexadecimal hash * Throws std::bad_alloc: Not enough memory. */ - static std::string tostring(const uint8_t* hashout) throw(std::bad_alloc) + static std::string tostring(const uint8_t* hashout) { return hex::b_to(hashout, 32); } @@ -87,7 +87,7 @@ public: * Returns: The hash in hex form. * Throws std::bad_alloc: Not enough memory. */ - std::string read() throw(std::bad_alloc) + std::string read() { uint8_t x[32]; read(x); @@ -138,7 +138,7 @@ public: * Returns: Hexadecimal hash of the data. * Throws std::bad_alloc: Not enough memory. */ - static std::string hash(const uint8_t* data, size_t datalen) throw(std::bad_alloc) + static std::string hash(const uint8_t* data, size_t datalen) { uint8_t hashout[32]; hash(hashout, data, datalen); @@ -152,7 +152,7 @@ public: * Returns: Hexadecimal hash of the data. * Throws std::bad_alloc: Not enough memory. */ - static std::string hash(const std::vector& data) throw(std::bad_alloc) + static std::string hash(const std::vector& data) { uint8_t hashout[32]; hash(hashout, &data[0], data.size()); @@ -166,7 +166,7 @@ public: * Returns: Hexadecimal hash of the data. * Throws std::bad_alloc: Not enough memory. */ - static std::string hash(const std::vector& data) throw(std::bad_alloc) + static std::string hash(const std::vector& data) { uint8_t hashout[32]; hash(hashout, reinterpret_cast(&data[0]), data.size()); diff --git a/include/library/skein.hpp b/include/library/skein.hpp index 9c3bde85..beaa74ec 100644 --- a/include/library/skein.hpp +++ b/include/library/skein.hpp @@ -35,7 +35,7 @@ struct hash * Parameter outbits: Number of output bits. * Throws std::runtime_error: Variant is invalid. */ - hash(variant v, uint64_t outbits) throw(std::runtime_error); + hash(variant v, uint64_t outbits); /** * Dtor */ @@ -50,7 +50,7 @@ struct hash * * Note: Data types 4 (CONFIG) and 63 (OUTPUT) are not allowed. */ - void write(const uint8_t* data, size_t datalen, datatype type = T_MESSAGE) throw(std::runtime_error); + void write(const uint8_t* data, size_t datalen, datatype type = T_MESSAGE); /** * Read the output hash. * @@ -106,7 +106,7 @@ public: * Parameter size: Number of random bytes to write. * Throws std::runtime_error: Generator is not seeded. */ - void read(void* buffer, size_t size) throw(std::runtime_error); + void read(void* buffer, size_t size); /** * Is seeded? */ diff --git a/include/library/stateobject.hpp b/include/library/stateobject.hpp index a3fd8bc0..796feccb 100644 --- a/include/library/stateobject.hpp +++ b/include/library/stateobject.hpp @@ -19,7 +19,7 @@ public: * Parameter obj: The object to get the state for. * Returns: The object state. */ - static U& get(T* obj) throw(std::bad_alloc) + static U& get(T* obj) { return *reinterpret_cast(_get(obj, []() -> void* { return new U; })); } diff --git a/include/library/string.hpp b/include/library/string.hpp index 2bd03738..54b3c0ac 100644 --- a/include/library/string.hpp +++ b/include/library/string.hpp @@ -123,7 +123,7 @@ public: * Parameter whole_sequence: If true, after seeing one separator, throw away separators until none more are found. */ token_iterator(const std::basic_string& s, std::initializer_list sep, - bool whole_sequence = false) throw(std::bad_alloc) : str(s) { ctor_itr(sep, whole_sequence); } + bool whole_sequence = false) : str(s) { ctor_itr(sep, whole_sequence); } /** * Compare. */ @@ -139,11 +139,11 @@ public: /** * Increment. */ - token_iterator& operator++() throw(std::bad_alloc) { return preincrement(); } + token_iterator& operator++() { return preincrement(); } /** * Increment. */ - token_iterator operator++(int) throw(std::bad_alloc) { return postincrement(); } + token_iterator operator++(int) { return postincrement(); } /** * Do nothing, pull everything. */ @@ -177,9 +177,9 @@ private: }; void ctor_eos(); - void ctor_itr(std::initializer_list sep, bool whole_sequence = false) throw(std::bad_alloc); - token_iterator postincrement() throw(std::bad_alloc); - token_iterator& preincrement() throw(std::bad_alloc); + void ctor_itr(std::initializer_list sep, bool whole_sequence = false); + token_iterator postincrement(); + token_iterator& preincrement(); const std::basic_string& dereference() const throw(); bool equals_op(const token_iterator& itr) const throw(); size_t is_sep(size_t pos); @@ -228,8 +228,7 @@ private: * Parameter ex: If non-null and string does not match, throw this as std::runtime_error. * Returns: The captures. */ -regex_results regex(const std::string& regex, const std::string& str, const char* ex = NULL) - throw(std::bad_alloc, std::runtime_error); +regex_results regex(const std::string& regex, const std::string& str, const char* ex = NULL); enum regex_match_mode { @@ -247,8 +246,7 @@ enum regex_match_mode * Parameter mode: Match mode. * Returns: True if matches, false if not. */ -bool regex_match(const std::string& regex, const std::string& str, enum regex_match_mode mode = REGEX_MATCH_REGEX) - throw(std::bad_alloc, std::runtime_error); +bool regex_match(const std::string& regex, const std::string& str, enum regex_match_mode mode = REGEX_MATCH_REGEX); /** * Try match a case-insensitive string fragment and return the result. @@ -274,7 +272,7 @@ template T raw_lexical_cast(const std::string& value) /** * \brief Typeconvert string. */ -template inline T parse_value(const std::string& value) throw(std::bad_alloc, std::runtime_error) +template inline T parse_value(const std::string& value) { //Floating-point case. try { @@ -327,7 +325,7 @@ template inline T parse_value(const std::string& value) throw(std::b } } -template<> inline ss_int24_t parse_value(const std::string& value) throw(std::bad_alloc, std::runtime_error) +template<> inline ss_int24_t parse_value(const std::string& value) { int32_t v = parse_value(value); if(v < -8388608 || v > 8388607) @@ -335,7 +333,7 @@ template<> inline ss_int24_t parse_value(const std::string& value) throw(std::ba return v; } -template<> inline ss_uint24_t parse_value(const std::string& value) throw(std::bad_alloc, std::runtime_error) +template<> inline ss_uint24_t parse_value(const std::string& value) { uint32_t v = parse_value(value); if(v > 0xFFFFFF) @@ -343,7 +341,7 @@ template<> inline ss_uint24_t parse_value(const std::string& value) throw(std::b return v; } -template<> inline std::string parse_value(const std::string& value) throw(std::bad_alloc, std::runtime_error) +template<> inline std::string parse_value(const std::string& value) { return value; } diff --git a/include/library/triplebuffer.hpp b/include/library/triplebuffer.hpp index 09861aa6..eb3bc638 100644 --- a/include/library/triplebuffer.hpp +++ b/include/library/triplebuffer.hpp @@ -30,7 +30,7 @@ public: * * Throws std::logic_error: If read count is 0. */ - void put_read() throw(std::logic_error); + void put_read(); /** * Get write pointer and increment write count by 1. * @@ -45,7 +45,7 @@ public: * * Throws std::logic_error: If write count is 0. */ - void put_write() throw(std::logic_error); + void put_write(); /** * Call specified function synchronously for last written buffer. * @@ -94,7 +94,7 @@ public: * * Throws std::logic_error: If read count is 0. */ - void put_read() throw(std::logic_error) { l.put_read(); } + void put_read() { l.put_read(); } /** * Get write pointer and increment write count by 1. * @@ -109,7 +109,7 @@ public: * * Throws std::logic_error: If write count is 0. */ - void put_write() throw(std::logic_error) { l.put_write(); } + void put_write() { l.put_write(); } /** * Call specified function synchronously for last written buffer. * diff --git a/include/library/zip.hpp b/include/library/zip.hpp index fce5c938..5d817736 100644 --- a/include/library/zip.hpp +++ b/include/library/zip.hpp @@ -42,7 +42,7 @@ public: * parameter _itr: The underlying map iterator. * throws std::bad_alloc: Not enough memory. */ - iterator_class(T _itr) throw(std::bad_alloc) + iterator_class(T _itr) : itr(_itr) { } @@ -53,7 +53,7 @@ public: * returns: Name of member. * throws std::bad_alloc: Not enough memory. */ - reference operator*() throw(std::bad_alloc) + reference operator*() { return itr->first; } @@ -64,7 +64,7 @@ public: * returns: Name of member. * throws std::bad_alloc: Not enough memory. */ - pointer operator->() throw(std::bad_alloc) + pointer operator->() { return &(itr->first); } @@ -97,7 +97,7 @@ public: * returns: The old value of iterator. * throws std::bad_alloc: Not enough memory. */ - const iterator_class operator++(int) throw(std::bad_alloc) + const iterator_class operator++(int) { iterator_class c(*this); ++itr; @@ -110,7 +110,7 @@ public: * returns: The old value of iterator. * throws std::bad_alloc: Not enough memory. */ - const iterator_class operator--(int) throw(std::bad_alloc) + const iterator_class operator--(int) { iterator_class c(*this); --itr; @@ -160,7 +160,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Can't open the ZIP file. */ - reader(const std::string& zipfile) throw(std::bad_alloc, std::runtime_error); + reader(const std::string& zipfile); /** * Destroy the ZIP reader. Opened input streams continue to be valid. @@ -173,7 +173,7 @@ public: * returns: The member name * throws std::bad_alloc: Not enough memory. */ - std::string find_first() throw(std::bad_alloc); + std::string find_first(); /** * Gives the name of the next member after specified, or "" if that member is the last. @@ -182,7 +182,7 @@ public: * returns: The member name * throws std::bad_alloc: Not enough memory. */ - std::string find_next(const std::string& name) throw(std::bad_alloc); + std::string find_next(const std::string& name); /** * Starting iterator @@ -190,7 +190,7 @@ public: * returns: The iterator pointing to first name. * throws std::bad_alloc: Not enough memory. */ - iterator begin() throw(std::bad_alloc); + iterator begin(); /** * Ending iterator (one past the end). @@ -198,7 +198,7 @@ public: * returns: The iterator pointing to one past the last name. * throws std::bad_alloc: Not enough memory. */ - iterator end() throw(std::bad_alloc); + iterator end(); /** * Starting reverse iterator @@ -206,14 +206,14 @@ public: * returns: The iterator pointing to last name and acting in reverse. * throws std::bad_alloc: Not enough memory. */ - riterator rbegin() throw(std::bad_alloc); + riterator rbegin(); /** * Ending reverse iterator (one past the start). * returrns: The iterator pointing to one before the first name and acting in reverse. * throws std::bad_alloc: Not enough memory. */ - riterator rend() throw(std::bad_alloc); + riterator rend(); /** * Check if member with specified name exists. @@ -232,7 +232,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: The specified member does not exist */ - std::istream& operator[](const std::string& name) throw(std::bad_alloc, std::runtime_error); + std::istream& operator[](const std::string& name); /** * Reads a file consisting of single line. * @@ -243,8 +243,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Error reading file. */ - bool read_linefile(const std::string& member, std::string& out, bool conditional = false) - throw(std::bad_alloc, std::runtime_error); + bool read_linefile(const std::string& member, std::string& out, bool conditional = false); /** * Read a raw file. * @@ -253,8 +252,7 @@ public: * Throws std::bad_alloc: Not enough memory. * Throws std::runtime_error: Error reading file. */ - void read_raw_file(const std::string& member, std::vector& out) throw(std::bad_alloc, - std::runtime_error); + void read_raw_file(const std::string& member, std::vector& out); /** * Reads a file consisting of single numeric constant. * @@ -267,7 +265,6 @@ public: */ template bool read_numeric_file(const std::string& member, T& out, bool conditional = false) - throw(std::bad_alloc, std::runtime_error) { std::string _out; if(!read_linefile(member, _out, conditional)) @@ -296,8 +293,7 @@ private: * throw std::bad_alloc: Not enough memory. * throw std::runtime_error: The file does not exist or can't be opened. */ -std::istream& openrel(const std::string& name, const std::string& referencing_path) throw(std::bad_alloc, - std::runtime_error); +std::istream& openrel(const std::string& name, const std::string& referencing_path); /** * As zip::openrel, but instead of returning handle to file, reads the entiere contents of the file and returns @@ -309,8 +305,7 @@ std::istream& openrel(const std::string& name, const std::string& referencing_pa * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: The file does not exist or can't be opened. */ -std::vector readrel(const std::string& name, const std::string& referencing_path) - throw(std::bad_alloc, std::runtime_error); +std::vector readrel(const std::string& name, const std::string& referencing_path); /** * Resolves the final file path that zip::openrel/zip::readrel would open. @@ -321,8 +316,7 @@ std::vector readrel(const std::string& name, const std::string& referencin * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Bad path. */ -std::string resolverel(const std::string& name, const std::string& referencing_path) throw(std::bad_alloc, - std::runtime_error); +std::string resolverel(const std::string& name, const std::string& referencing_path); /** * Does the specified file (maybe inside .zip) exist? @@ -331,7 +325,7 @@ std::string resolverel(const std::string& name, const std::string& referencing_p * returns: True if file exists, false if not. * throws std::bad_alloc: Not enough memory. */ -bool file_exists(const std::string& name) throw(std::bad_alloc); +bool file_exists(const std::string& name); /** * This class handles writing a ZIP archives. @@ -348,8 +342,8 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Can't open archive or invalid argument. */ - writer(const std::string& zipfile, unsigned _compression) throw(std::bad_alloc, std::runtime_error); - writer(std::ostream& stream, unsigned _compression) throw(std::bad_alloc, std::runtime_error); + writer(const std::string& zipfile, unsigned _compression); + writer(std::ostream& stream, unsigned _compression); /** * Destroys ZIP writer, aborting the transaction (unless commit() has been called). */ @@ -362,7 +356,7 @@ public: * throws std::logic_error: Existing file open. * throws std::runtime_error: Can't commit archive (OS error or member open). */ - void commit() throw(std::bad_alloc, std::logic_error, std::runtime_error); + void commit(); /** * Create a new member inside ZIP file. No existing member may be open. @@ -373,8 +367,7 @@ public: * throws std::logic_error: Existing file open. * throws std::runtime_error: Illegal name. */ - std::ostream& create_file(const std::string& name) throw(std::bad_alloc, std::logic_error, - std::runtime_error); + std::ostream& create_file(const std::string& name); /** * Closes open member and destroys stream corresponding to it. @@ -383,7 +376,7 @@ public: * throws std::logic_error: No file open. * throws std::runtime_error: Error from operating system. */ - void close_file() throw(std::bad_alloc, std::logic_error, std::runtime_error); + void close_file(); /** * Write a file consisting of single line. No existing member may be open. * @@ -393,8 +386,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Error from operating system. */ - void write_linefile(const std::string& member, const std::string& value, bool conditional = false) - throw(std::bad_alloc, std::runtime_error); + void write_linefile(const std::string& member, const std::string& value, bool conditional = false); /** * Write a raw file. No existing member may be open. * @@ -403,8 +395,7 @@ public: * throws std::bad_alloc: Not enough memory. * throws std::runtime_error: Error from operating system. */ - void write_raw_file(const std::string& member, const std::vector& content) - throw(std::bad_alloc, std::runtime_error); + void write_raw_file(const std::string& member, const std::vector& content); /** * Write a file consisting of a single number. No existing member may be open. * @@ -414,7 +405,7 @@ public: * throws std::runtime_error: Error from operating system. */ template - void write_numeric_file(const std::string& member, T value) throw(std::bad_alloc, std::runtime_error) + void write_numeric_file(const std::string& member, T value) { write_linefile(member, (stringfmt() << value).str()); } diff --git a/include/lua/lua.hpp b/include/lua/lua.hpp index a20535b3..fc37da2f 100644 --- a/include/lua/lua.hpp +++ b/include/lua/lua.hpp @@ -87,8 +87,8 @@ struct lua_state uint64_t timed_hook(int timer) throw(); const std::map& get_watch_vars(); - void do_eval_lua(const std::string& c) throw(std::bad_alloc); - void do_run_lua(const std::string& c) throw(std::bad_alloc); + void do_eval_lua(const std::string& c); + void do_run_lua(const std::string& c); void run_sysrc_lua(bool rerun); bool requests_repaint; @@ -113,7 +113,7 @@ struct lua_state private: void do_reset(); void do_evaluate(const std::string& a); - bool run_lua_fragment() throw(std::bad_alloc); + bool run_lua_fragment(); template bool run_callback(lua::state::callback_list& list, T... args); void run_synchronous_paint(struct lua::render_context* ctx); lua::state& L; diff --git a/include/platform/wxwidgets/platform.hpp b/include/platform/wxwidgets/platform.hpp index 2f07d5ea..7e55ef59 100644 --- a/include/platform/wxwidgets/platform.hpp +++ b/include/platform/wxwidgets/platform.hpp @@ -61,12 +61,12 @@ extern bool vflip_enabled; extern bool rotate_enabled; extern int wx_escape_count; -wxString towxstring(const std::string& str) throw(std::bad_alloc); -std::string tostdstring(const wxString& str) throw(std::bad_alloc); -wxString towxstring(const std::u32string& str) throw(std::bad_alloc); -std::u32string tou32string(const wxString& str) throw(std::bad_alloc); +wxString towxstring(const std::string& str); +std::string tostdstring(const wxString& str); +wxString towxstring(const std::u32string& str); +std::u32string tou32string(const wxString& str); void bring_app_foreground(); -std::string pick_archive_member(wxWindow* parent, const std::string& filename) throw(std::bad_alloc); +std::string pick_archive_member(wxWindow* parent, const std::string& filename); void boot_emulator(emulator_instance& inst, loaded_rom& rom, moviefile& movie, bool fscreen); void handle_wx_keyboard(emulator_instance& inst, wxKeyEvent& e, bool polarity); void handle_wx_mouse(emulator_instance& inst, wxMouseEvent& e); diff --git a/include/video/sox.hpp b/include/video/sox.hpp index ff7a3668..845f8266 100644 --- a/include/video/sox.hpp +++ b/include/video/sox.hpp @@ -22,8 +22,7 @@ public: * throws std::bad_alloc: Not enough memory * throws std::runtime_error: Error opening .sox file */ - sox_dumper(const std::string& filename, double samplerate, uint32_t channels) throw(std::bad_alloc, - std::runtime_error); + sox_dumper(const std::string& filename, double samplerate, uint32_t channels); /** * Destructor. @@ -36,7 +35,7 @@ public: * throws std::bad_alloc: Not enough memory * throws std::runtime_error: Error fixing and closing .sox file */ - void close() throw(std::bad_alloc, std::runtime_error); + void close(); /** * Dump a sample diff --git a/src/core/actions.cpp b/src/core/actions.cpp index ba9ca971..d0a62457 100644 --- a/src/core/actions.cpp +++ b/src/core/actions.cpp @@ -8,7 +8,7 @@ namespace { command::fnptr CMD_action(lsnes_cmds, CACTION::e, - [](const std::string& _args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& _args) { auto& core = CORE(); if(_args == "") { messages << "Action name required." << std::endl; diff --git a/src/core/advdumper.cpp b/src/core/advdumper.cpp index 7a9d3467..27fc51a5 100644 --- a/src/core/advdumper.cpp +++ b/src/core/advdumper.cpp @@ -16,13 +16,13 @@ namespace globalwrap> S_notifiers; } -master_dumper::gameinfo::gameinfo() throw(std::bad_alloc) +master_dumper::gameinfo::gameinfo() { length = 0; rerecords = "0"; } -std::string master_dumper::gameinfo::get_readable_time(unsigned digits) const throw(std::bad_alloc) +std::string master_dumper::gameinfo::get_readable_time(unsigned digits) const { double bias = 0.5 * pow(10, -static_cast(digits)); double len = length + bias; @@ -53,7 +53,7 @@ size_t master_dumper::gameinfo::get_author_count() const throw() return authors.size(); } -std::string master_dumper::gameinfo::get_author_short(size_t idx) const throw(std::bad_alloc) +std::string master_dumper::gameinfo::get_author_short(size_t idx) const { if(idx >= authors.size()) return ""; @@ -64,7 +64,7 @@ std::string master_dumper::gameinfo::get_author_short(size_t idx) const throw(st return x.first; } -std::string master_dumper::gameinfo::get_author_long(size_t idx) const throw(std::bad_alloc) +std::string master_dumper::gameinfo::get_author_long(size_t idx) const { if(idx >= authors.size()) return ""; @@ -118,7 +118,7 @@ dumper_factory_base::~dumper_factory_base() run_notify(); } -std::set dumper_factory_base::get_dumper_set() throw(std::bad_alloc) +std::set dumper_factory_base::get_dumper_set() { std::set d; for(auto i : S_dumpers()) @@ -126,7 +126,7 @@ std::set dumper_factory_base::get_dumper_set() throw(std:: return d; } -dumper_factory_base::dumper_factory_base(const std::string& id) throw(std::bad_alloc) +dumper_factory_base::dumper_factory_base(const std::string& id) { d_id = id; S_dumpers()[d_id] = this; @@ -200,7 +200,7 @@ dumper_base* master_dumper::get_instance(dumper_factory_base* f) throw() } dumper_base* master_dumper::start(dumper_factory_base& factory, const std::string& mode, - const std::string& targetname) throw(std::bad_alloc, std::runtime_error) + const std::string& targetname) { threads::arlock h(lock); auto f = factory.start(*this, mode, targetname); diff --git a/src/core/audioapi-driver.cpp b/src/core/audioapi-driver.cpp index 35831ecb..8204f3fd 100644 --- a/src/core/audioapi-driver.cpp +++ b/src/core/audioapi-driver.cpp @@ -42,8 +42,7 @@ namespace return true; } - void dummy_set_device(const std::string& pdev, const std::string& rdev) throw(std::bad_alloc, - std::runtime_error) + void dummy_set_device(const std::string& pdev, const std::string& rdev) { if(pdev != "null") throw std::runtime_error("Bad sound device '" + pdev + "'"); @@ -51,12 +50,12 @@ namespace throw std::runtime_error("Bad sound device '" + rdev + "'"); } - std::string dummy_get_device(bool rec) throw(std::bad_alloc) + std::string dummy_get_device(bool rec) { return "null"; } - std::map dummy_get_devices(bool rec) throw(std::bad_alloc) + std::map dummy_get_devices(bool rec) { std::map ret; ret["null"] = "NULL sound output"; @@ -102,18 +101,17 @@ bool audioapi_driver_initialized() return driver.initialized(); } -void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev) throw(std::bad_alloc, - std::runtime_error) +void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev) { driver.set_device(pdev, rdev); } -std::string audioapi_driver_get_device(bool rec) throw(std::bad_alloc) +std::string audioapi_driver_get_device(bool rec) { return driver.get_device(rec); } -std::map audioapi_driver_get_devices(bool rec) throw(std::bad_alloc) +std::map audioapi_driver_get_devices(bool rec) { return driver.get_devices(rec); } diff --git a/src/core/controllerframe.cpp b/src/core/controllerframe.cpp index 3b80d50b..d4a38519 100644 --- a/src/core/controllerframe.cpp +++ b/src/core/controllerframe.cpp @@ -17,7 +17,7 @@ namespace portctrl::type_set dummytypes; command::fnptr macro_test(lsnes_cmds, CMACRO::test, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { auto& core = CORE(); regex_results r = regex("([0-9]+)[ \t](.*)", args); if(!r) { @@ -211,7 +211,7 @@ void controller_state::reread_tasinput_mode(const portctrl::type_set& ptype) } } -void controller_state::set_ports(const portctrl::type_set& ptype) throw(std::runtime_error) +void controller_state::set_ports(const portctrl::type_set& ptype) { const portctrl::type_set* oldtype = types; types = &ptype; diff --git a/src/core/disassemble.cpp b/src/core/disassemble.cpp index 6b9c738c..de487570 100644 --- a/src/core/disassemble.cpp +++ b/src/core/disassemble.cpp @@ -23,7 +23,7 @@ namespace }; command::fnptr CMD_disassemble(lsnes_cmds, CDISASM::d, - [](const std::string& t) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& t) { auto& core = CORE(); regex_results r = regex("([^ \t]+)[ \t]+([0-9]+|0x[0-9A-Fa-f]+)([ \t]+([0-9]+))?" "([ \t]+to[ \t]+(.+))?", t); diff --git a/src/core/framebuffer.cpp b/src/core/framebuffer.cpp index 946fa3e8..ebda7731 100644 --- a/src/core/framebuffer.cpp +++ b/src/core/framebuffer.cpp @@ -105,7 +105,7 @@ void emu_framebuffer::do_screenshot(command::arg_filename file) messages << "Saved PNG screenshot to '" << fn << "'" << std::endl; } -void emu_framebuffer::take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error) +void emu_framebuffer::take_screenshot(const std::string& file) { render_info& ri = buffering.get_read(); ri.fbuf.save_png(file); @@ -113,7 +113,7 @@ void emu_framebuffer::take_screenshot(const std::string& file) throw(std::bad_al } -void emu_framebuffer::init_special_screens() throw(std::bad_alloc) +void emu_framebuffer::init_special_screens() { std::vector buf; buf.resize(512*448); @@ -211,7 +211,7 @@ std::pair emu_framebuffer::get_framebuffer_size() return std::make_pair(h, v); } -framebuffer::raw emu_framebuffer::get_framebuffer() throw(std::bad_alloc) +framebuffer::raw emu_framebuffer::get_framebuffer() { render_info& ri = buffering.get_read(); framebuffer::raw copy = ri.fbuf; diff --git a/src/core/instance.cpp b/src/core/instance.cpp index 1836f476..efb35147 100644 --- a/src/core/instance.cpp +++ b/src/core/instance.cpp @@ -157,7 +157,7 @@ namespace command::fnptr<> CMD_memory_use(lsnes_cmds, "show-memory", "Show memory usage", "show-memory\nShow memory usage", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto report = memtracker::singleton().report(); uint32_t maxwidth_left = 0; uint32_t maxwidth_right = 0; diff --git a/src/core/keymapper.cpp b/src/core/keymapper.cpp index e71ed4aa..10d09958 100644 --- a/src/core/keymapper.cpp +++ b/src/core/keymapper.cpp @@ -108,14 +108,14 @@ void cleanup_keymapper() namespace { command::fnptr<> CMD_show_joysticks(lsnes_cmds, CKEYMAPPER::show, - []() throw(std::bad_alloc, std::runtime_error) { + []() { messages << "--------------------------------------------" << std::endl; messages << lsnes_gamepads.get_summary() << std::endl; messages << "--------------------------------------------" << std::endl; }); command::fnptr<> reset_joysticks(lsnes_cmds, CKEYMAPPER::reset, - []() throw(std::bad_alloc, std::runtime_error) { + []() { joystick_driver_quit(true); lsnes_gamepads.offline_all(); //Not supposed to have online gamepads when entering reset. joystick_driver_init(true); diff --git a/src/core/loadlib.cpp b/src/core/loadlib.cpp index 15e5f4c0..ebbbe136 100644 --- a/src/core/loadlib.cpp +++ b/src/core/loadlib.cpp @@ -171,13 +171,13 @@ namespace } command::fnptr CMD_load_library(lsnes_cmds, CLOADLIB::load, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { with_loaded_library(*new loadlib::module(loadlib::library(args))); handle_post_loadlibrary(); }); command::fnptr CMD_unload_library(lsnes_cmds, CLOADLIB::unload, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { unsigned libid = parse_value(args); if(!modules.count(libid)) throw std::runtime_error("No such library loaded"); @@ -186,7 +186,7 @@ namespace }); command::fnptr<> CMD_list_library(lsnes_cmds, CLOADLIB::list, - []() throw(std::bad_alloc, std::runtime_error) { + []() { for(auto i : modules) messages << "#" << i.first << " [" << i.second->get_libname() << "]" << std::endl; }); diff --git a/src/core/mainloop.cpp b/src/core/mainloop.cpp index 5cc04f30..2a51b5dd 100644 --- a/src/core/mainloop.cpp +++ b/src/core/mainloop.cpp @@ -86,12 +86,12 @@ void mainloop_signal_need_rewind(void* ptr) unsafe_rewind_obj = ptr; } -bool movie_logic::notify_user_poll() throw(std::bad_alloc, std::runtime_error) +bool movie_logic::notify_user_poll() { return CORE().runmode->is_skiplag(); } -portctrl::frame movie_logic::update_controls(bool subframe, bool forced) throw(std::bad_alloc, std::runtime_error) +portctrl::frame movie_logic::update_controls(bool subframe, bool forced) { auto& core = CORE(); if(core.lua2->requests_subframe_paint) @@ -324,20 +324,20 @@ namespace lsnes_callbacks lsnes_callbacks_obj; command::fnptr<> CMD_segfault(lsnes_cmds, "segfault", "Trigger SIGSEGV", "segfault\nTrigger segmentation fault", - []() throw(std::bad_alloc, std::runtime_error) { + []() { char* ptr = (char*)0x1234; *ptr = 0; }); command::fnptr<> CMD_div0(lsnes_cmds, "divide-by-0", "Do div0", "divide-by-0\nDo divide by 0", - []() throw(std::bad_alloc, std::runtime_error) { + []() { static int ptr = 1; static int ptr2 = 0; ptr = ptr / ptr2; }); command::fnptr CMD_test4(lsnes_cmds, "test4", "test", "test", - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { auto& core = CORE(); std::list _args; std::string args2 = args; @@ -347,7 +347,7 @@ namespace }); command::fnptr<> CMD_count_rerecords(lsnes_cmds, "count-rerecords", "Count rerecords", "Syntax: count-rerecords\nCounts rerecords.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { std::vector tmp; uint64_t x = CORE().mlogic->get_rrdata().write(tmp); messages << x << " rerecord(s)" << std::endl; @@ -355,7 +355,7 @@ namespace command::fnptr CMD_quit_emulator(lsnes_cmds, "quit-emulator", "Quit the emulator", "Syntax: quit-emulator [/y]\nQuits emulator (/y => don't ask for confirmation).\n", - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { CORE().runmode->set_quit(); platform::set_paused(false); platform::cancel_wait(); @@ -363,7 +363,7 @@ namespace command::fnptr<> CMD_unpause_emulator(lsnes_cmds, "unpause-emulator", "Unpause the emulator", "Syntax: unpause-emulator\nUnpauses the emulator.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); if(core.runmode->is_special()) return; @@ -374,7 +374,7 @@ namespace command::fnptr<> CMD_pause_emulator(lsnes_cmds, "pause-emulator", "(Un)pause the emulator", "Syntax: pause-emulator\n(Un)pauses the emulator.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); if(core.runmode->is_special()) ; @@ -390,44 +390,44 @@ namespace }); command::fnptr<> CMD_load_jukebox(lsnes_cmds, CLOADSAVE::ldj, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_load(core.jukebox->get_slot_name(), LOAD_STATE_CURRENT); }); command::fnptr<> CMD_load_jukebox_readwrite(lsnes_cmds, CLOADSAVE::ldjrw, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_load(core.jukebox->get_slot_name(), LOAD_STATE_RW); }); command::fnptr<> CMD_load_jukebox_readonly(lsnes_cmds, CLOADSAVE::ldjro, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_load(core.jukebox->get_slot_name(), LOAD_STATE_RO); }); command::fnptr<> CMD_load_jukebox_preserve(lsnes_cmds, CLOADSAVE::ldjp, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_load(core.jukebox->get_slot_name(), LOAD_STATE_PRESERVE); }); command::fnptr<> CMD_load_jukebox_movie(lsnes_cmds, CLOADSAVE::ldjm, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_load(core.jukebox->get_slot_name(), LOAD_STATE_MOVIE); }); command::fnptr<> CMD_save_jukebox_c(lsnes_cmds, CLOADSAVE::saj, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); mark_pending_save(core.jukebox->get_slot_name(), SAVE_STATE, -1); }); command::fnptr<> CMD_padvance_frame(lsnes_cmds, "+advance-frame", "Advance one frame", "Syntax: +advance-frame\nAdvances the emulation by one frame.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); if(core.runmode->is_special()) return; @@ -438,7 +438,7 @@ namespace command::fnptr<> CMD_nadvance_frame(lsnes_cmds, "-advance-frame", "Advance one frame", "No help available\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { CORE().runmode->set_cancel(); platform::cancel_wait(); platform::set_paused(false); @@ -446,7 +446,7 @@ namespace command::fnptr<> CMD_padvance_poll(lsnes_cmds, "+advance-poll", "Advance one subframe", "Syntax: +advance-poll\nAdvances the emulation by one subframe.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); if(core.runmode->is_special()) return; @@ -457,7 +457,7 @@ namespace command::fnptr<> CMD_nadvance_poll(lsnes_cmds, "-advance-poll", "Advance one subframe", "No help available\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); core.runmode->decay_break(); core.runmode->set_cancel(); @@ -467,7 +467,7 @@ namespace command::fnptr<> CMD_advance_skiplag(lsnes_cmds, "advance-skiplag", "Skip to next poll", "Syntax: advance-skiplag\nAdvances the emulation to the next poll.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { CORE().runmode->set_skiplag_pending(); platform::cancel_wait(); platform::set_paused(false); @@ -475,7 +475,7 @@ namespace command::fnptr<> CMD_reset_c(lsnes_cmds, "reset", "Reset the system", "Syntax: reset\nReset\nResets the system in beginning of the next frame.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); int sreset_action = core.rom->reset_action(false); if(sreset_action < 0) { @@ -488,7 +488,7 @@ namespace command::fnptr<> CMD_hreset_c(lsnes_cmds, "reset-hard", "Reset the system", "Syntax: reset-hard\nReset-hard\nHard resets the system in beginning of the next frame.\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); int hreset_action = core.rom->reset_action(true); if(hreset_action < 0) { @@ -500,90 +500,90 @@ namespace }); command::fnptr CMD_load_c(lsnes_cmds, CLOADSAVE::ld, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_CURRENT); }); command::fnptr CMD_load_smart_c(lsnes_cmds, CLOADSAVE::ldsm, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_DEFAULT); }); command::fnptr CMD_load_state_c(lsnes_cmds, CLOADSAVE::ldrw, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_RW); }); command::fnptr CMD_load_readonly(lsnes_cmds, CLOADSAVE::ldro, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_RO); }); command::fnptr CMD_load_preserve(lsnes_cmds, CLOADSAVE::ldp, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_PRESERVE); }); command::fnptr CMD_load_movie_c(lsnes_cmds, CLOADSAVE::ldm, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_MOVIE); }); command::fnptr CMD_load_allbr_c(lsnes_cmds, CLOADSAVE::ldab, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_load(args, LOAD_STATE_ALLBRANCH); }); command::fnptr CMD_save_state(lsnes_cmds, CLOADSAVE::sa, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_STATE, -1); }); command::fnptr CMD_save_state2(lsnes_cmds, CLOADSAVE::sasb, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_STATE, 1); }); command::fnptr CMD_save_state3(lsnes_cmds, CLOADSAVE::sasz, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_STATE, 0); }); command::fnptr CMD_save_movie(lsnes_cmds, CLOADSAVE::sam, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_MOVIE, -1); }); command::fnptr CMD_save_movie2(lsnes_cmds, CLOADSAVE::samb, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_MOVIE, 1); }); command::fnptr CMD_save_movie3(lsnes_cmds, CLOADSAVE::samz, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { mark_pending_save(args, SAVE_MOVIE, 0); }); command::fnptr CMD_load_rom(lsnes_cmds, CLOADSAVE::lrom, - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { romload_request req; req.packfile = args; load_new_rom(req); }); command::fnptr<> CMD_reload_rom(lsnes_cmds, CLOADSAVE::rlrom, - []() throw(std::bad_alloc, std::runtime_error) { + []() { reload_current_rom(); }); command::fnptr<> CMD_close_rom(lsnes_cmds, CLOADSAVE::clrom, - []() throw(std::bad_alloc, std::runtime_error) { + []() { close_rom(); }); command::fnptr<> CMD_set_rwmode(lsnes_cmds, "set-rwmode", "Switch to recording mode", "Syntax: set-rwmode\nSwitches to recording mode\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); core.lua2->callback_movie_lost("readwrite"); core.mlogic->get_movie().readonly_mode(false); @@ -594,7 +594,7 @@ namespace command::fnptr<> CMD_set_romode(lsnes_cmds, "set-romode", "Switch to playback mode", "Syntax: set-romode\nSwitches to playback mode\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); core.mlogic->get_movie().readonly_mode(true); core.dispatch->mode_change(true); @@ -603,7 +603,7 @@ namespace command::fnptr<> CMD_toggle_rwmode(lsnes_cmds, "toggle-rwmode", "Toggle recording mode", "Syntax: toggle-rwmode\nToggles recording mode\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); bool c = core.mlogic->get_movie().readonly_mode(); if(c) @@ -617,12 +617,12 @@ namespace command::fnptr<> CMD_repaint(lsnes_cmds, "repaint", "Redraw the screen", "Syntax: repaint\nRedraws the screen\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { CORE().fbuf->redraw_framebuffer(); }); command::fnptr<> CMD_tpon(lsnes_cmds, "toggle-pause-on-end", "Toggle pause on end", "Toggle pause on end\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); bool tmp = SET_pause_on_end(*core.settings); SET_pause_on_end(*core.settings, !tmp); @@ -630,37 +630,37 @@ namespace }); command::fnptr<> CMD_spon(lsnes_cmds, "set-pause-on-end", "Set pause on end", "Set pause on end\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { SET_pause_on_end(*CORE().settings, true); messages << "Pause-on-end is now ON" << std::endl; }); command::fnptr<> CMD_cpon(lsnes_cmds, "clear-pause-on-end", "Clear pause on end", "Clear pause on end\n", - []() throw(std::bad_alloc, std::runtime_error) { + []() { SET_pause_on_end(*CORE().settings, false); messages << "Pause-on-end is now OFF" << std::endl; }); command::fnptr<> CMD_rewind_movie(lsnes_cmds, CLOADSAVE::rewind, - []() throw(std::bad_alloc, std::runtime_error) { + []() { mark_pending_load("SOME NONBLANK NAME", LOAD_STATE_BEGINNING); }); command::fnptr<> CMD_cancel_save(lsnes_cmds, CLOADSAVE::cancel, - []() throw(std::bad_alloc, std::runtime_error) { + []() { queued_saves.clear(); messages << "Pending saves canceled." << std::endl; }); - command::fnptr<> CMD_mhold1(lsnes_cmds, CMHOLD::p, []() throw(std::bad_alloc, std::runtime_error) { + command::fnptr<> CMD_mhold1(lsnes_cmds, CMHOLD::p, []() { macro_hold_1 = true; }); - command::fnptr<> CMD_mhold2(lsnes_cmds, CMHOLD::r, []() throw(std::bad_alloc, std::runtime_error) { + command::fnptr<> CMD_mhold2(lsnes_cmds, CMHOLD::r, []() { macro_hold_1 = false; }); - command::fnptr<> CMD_mhold3(lsnes_cmds, CMHOLD::t, []() throw(std::bad_alloc, std::runtime_error) { + command::fnptr<> CMD_mhold3(lsnes_cmds, CMHOLD::t, []() { macro_hold_2 = !macro_hold_2; if(macro_hold_2) messages << "Macros are held for next frame." << std::endl; @@ -837,8 +837,7 @@ void init_main_callbacks() ecore_callbacks = &lsnes_callbacks_obj; } -void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_to_succeed) throw(std::bad_alloc, - std::runtime_error) +void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_to_succeed) { lsnes_instance.emu_thread = threads::id(); auto& core = CORE(); diff --git a/src/core/memorymanip.cpp b/src/core/memorymanip.cpp index 07721079..9f8d8450 100644 --- a/src/core/memorymanip.cpp +++ b/src/core/memorymanip.cpp @@ -93,7 +93,7 @@ cart_mappings_refresher::cart_mappings_refresher(memory_space& _mspace, movie_lo { } -void cart_mappings_refresher::operator()() throw(std::bad_alloc) +void cart_mappings_refresher::operator()() { std::list cur_regions = mspace.get_regions(); std::list regions; @@ -170,13 +170,13 @@ namespace class memorymanip_command : public command::base { public: - memorymanip_command(command::group& grp, const std::string& cmd) throw(std::bad_alloc) + memorymanip_command(command::group& grp, const std::string& cmd) : command::base(grp, cmd, true) { _command = cmd; } ~memorymanip_command() throw() {} - void invoke(const std::string& args) throw(std::bad_alloc, std::runtime_error) + void invoke(const std::string& args) { regex_results t = regex("(([^ \t]+)([ \t]+([^ \t]+)([ \t]+([^ \t].*)?)?)?)?", args); if(!t) { @@ -208,7 +208,7 @@ namespace } invoke2(); } - virtual void invoke2() throw(std::bad_alloc, std::runtime_error) = 0; + virtual void invoke2() = 0; std::string firstword; std::string secondword; uint64_t address; @@ -226,12 +226,12 @@ namespace class read_command : public memorymanip_command { public: - read_command(command::group& grp, const std::string& cmd) throw(std::bad_alloc) + read_command(command::group& grp, const std::string& cmd) : memorymanip_command(grp, cmd) { } ~read_command() throw() {} - void invoke2() throw(std::bad_alloc, std::runtime_error) + void invoke2() { if(address_bad || has_value || has_tail) throw std::runtime_error("Syntax: " + _command + "
"); @@ -249,8 +249,8 @@ namespace messages << x.str() << std::endl; } } - std::string get_short_help() throw(std::bad_alloc) { return "Read memory"; } - std::string get_long_help() throw(std::bad_alloc) + std::string get_short_help() { return "Read memory"; } + std::string get_long_help() { return "Syntax: " + _command + "
\n" "Reads data from memory.\n"; @@ -262,12 +262,11 @@ namespace { public: write_command(command::group& grp, const std::string& cmd) - throw(std::bad_alloc) : memorymanip_command(grp, cmd) { } ~write_command() throw() {} - void invoke2() throw(std::bad_alloc, std::runtime_error) + void invoke2() { if(address_bad || value_bad || has_tail) throw std::runtime_error("Syntax: " + _command + "
"); @@ -276,8 +275,8 @@ namespace throw std::runtime_error("Value to write out of range"); (CORE().memory->*_wfn)(address, value & high); } - std::string get_short_help() throw(std::bad_alloc) { return "Write memory"; } - std::string get_long_help() throw(std::bad_alloc) + std::string get_short_help() { return "Write memory"; } + std::string get_long_help() { return "Syntax: " + _command + "
\n" "Writes data to memory.\n"; @@ -289,19 +288,18 @@ namespace { public: writef_command(command::group& grp, const std::string& cmd) - throw(std::bad_alloc) : memorymanip_command(grp, cmd) { } ~writef_command() throw() {} - void invoke2() throw(std::bad_alloc, std::runtime_error) + void invoke2() { if(address_bad || !has_valuef || has_tail) throw std::runtime_error("Syntax: " + _command + "
"); (CORE().memory->*_wfn)(address, valuef); } - std::string get_short_help() throw(std::bad_alloc) { return "Write memory"; } - std::string get_long_help() throw(std::bad_alloc) + std::string get_short_help() { return "Write memory"; } + std::string get_long_help() { return "Syntax: " + _command + "
\n" "Writes data to memory.\n"; diff --git a/src/core/misc.cpp b/src/core/misc.cpp index 4bb8c13a..bba1df07 100644 --- a/src/core/misc.cpp +++ b/src/core/misc.cpp @@ -96,7 +96,7 @@ void fatal_error() throw() exit(1); } -std::string get_config_path() throw(std::bad_alloc) +std::string get_config_path() { const char* tmp; std::string basedir; diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 6f9b8c18..4cac9037 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -21,7 +21,7 @@ void movie_logic::set_movie(movie& _mov, bool free_old) throw() if(free_old) delete tmp; } -movie& movie_logic::get_movie() throw(std::runtime_error) +movie& movie_logic::get_movie() { if(!mov) throw std::runtime_error("No movie"); @@ -35,7 +35,7 @@ void movie_logic::set_mfile(moviefile& _mf, bool free_old) throw() if(free_old) delete tmp; } -moviefile& movie_logic::get_mfile() throw(std::runtime_error) +moviefile& movie_logic::get_mfile() { if(!mf) throw std::runtime_error("No movie"); @@ -49,14 +49,14 @@ void movie_logic::set_rrdata(rrdata_set& _rrd, bool free_old) throw() if(free_old) delete tmp; } -rrdata_set& movie_logic::get_rrdata() throw(std::runtime_error) +rrdata_set& movie_logic::get_rrdata() { if(!rrd) throw std::runtime_error("No movie"); return *rrd; } -void movie_logic::new_frame_starting(bool dont_poll) throw(std::bad_alloc, std::runtime_error) +void movie_logic::new_frame_starting(bool dont_poll) { mov->next_frame(); portctrl::frame c = update_controls(false); @@ -68,7 +68,7 @@ void movie_logic::new_frame_starting(bool dont_poll) throw(std::bad_alloc, std:: mov->set_all_DRDY(); } -short movie_logic::input_poll(unsigned port, unsigned dev, unsigned id) throw(std::bad_alloc, std::runtime_error) +short movie_logic::input_poll(unsigned port, unsigned dev, unsigned id) { if(!mov) return 0; diff --git a/src/core/moviedata.cpp b/src/core/moviedata.cpp index 913dbcb9..dc99b5a2 100644 --- a/src/core/moviedata.cpp +++ b/src/core/moviedata.cpp @@ -48,13 +48,13 @@ namespace } command::fnptr test4(lsnes_cmds, CMOVIEDATA::panic, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { auto& core = CORE(); if(*core.mlogic) emerg_save_movie(core.mlogic->get_mfile(), core.mlogic->get_rrdata()); }); command::fnptr CMD_dump_coresave(lsnes_cmds, CMOVIEDATA::dumpcore, - [](const std::string& name) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& name) { auto& core = CORE(); auto x = core.rom->save_core_state(); x.resize(x.size() - 32); @@ -186,8 +186,7 @@ std::string translate_name_mprefix(std::string original, int& binary, int save) } } -std::pair split_author(const std::string& author) throw(std::bad_alloc, - std::runtime_error) +std::pair split_author(const std::string& author) { std::string _author = author; std::string fullname; @@ -215,8 +214,7 @@ std::string resolve_relative_path(const std::string& path) } //Save state. -void do_save_state(const std::string& filename, int binary) throw(std::bad_alloc, - std::runtime_error) +void do_save_state(const std::string& filename, int binary) { auto& core = CORE(); if(!*core.mlogic || !core.mlogic->get_mfile().gametype) { @@ -271,7 +269,7 @@ void do_save_state(const std::string& filename, int binary) throw(std::bad_alloc } //Save movie. -void do_save_movie(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error) +void do_save_movie(const std::string& filename, int binary) { auto& core = CORE(); if(!*core.mlogic || !core.mlogic->get_mfile().gametype) { @@ -452,7 +450,7 @@ namespace } } -void do_load_rom() throw(std::bad_alloc, std::runtime_error) +void do_load_rom() { auto& core = CORE(); bool load_readwrite = !*core.mlogic || !core.mlogic->get_movie().readonly_mode(); @@ -563,7 +561,7 @@ void do_load_rom() throw(std::bad_alloc, std::runtime_error) messages << "ROM reloaded." << std::endl; } -void do_load_rewind() throw(std::bad_alloc, std::runtime_error) +void do_load_rewind() { auto& core = CORE(); if(!*core.mlogic || !core.mlogic->get_mfile().gametype) diff --git a/src/core/moviefile-binary.cpp b/src/core/moviefile-binary.cpp index 19fa86b2..66c32d8f 100644 --- a/src/core/moviefile-binary.cpp +++ b/src/core/moviefile-binary.cpp @@ -57,7 +57,7 @@ void moviefile::brief_info::binary_io(int _stream) }, binarystream::null_default); } -void moviefile::binary_io(int _stream, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error) +void moviefile::binary_io(int _stream, rrdata_set& rrd, bool as_state) { binarystream::output out(_stream); out.string(gametype->get_name()); @@ -192,7 +192,7 @@ void moviefile::binary_io(int _stream, rrdata_set& rrd, bool as_state) throw(std } } -void moviefile::binary_io(int _stream, core_type& romtype) throw(std::bad_alloc, std::runtime_error) +void moviefile::binary_io(int _stream, core_type& romtype) { binarystream::input in(_stream); std::string tmp = in.string(); diff --git a/src/core/moviefile-text-load.cpp b/src/core/moviefile-text-load.cpp index 6c25595c..3e59b339 100644 --- a/src/core/moviefile-text-load.cpp +++ b/src/core/moviefile-text-load.cpp @@ -82,7 +82,6 @@ namespace } void read_authors_file(zip::reader& r, std::vector>& authors) - throw(std::bad_alloc, std::runtime_error) { std::istream& m = r["authors"]; try { @@ -99,7 +98,7 @@ namespace } } - std::string read_rrdata(zip::reader& r, std::vector& out) throw(std::bad_alloc, std::runtime_error) + std::string read_rrdata(zip::reader& r, std::vector& out) { r.read_raw_file("rrdata", out); uint64_t count = rrdata_set::count(out); @@ -133,7 +132,6 @@ namespace } void read_input(zip::reader& r, const std::string& mname, portctrl::frame_vector& input) - throw(std::bad_alloc, std::runtime_error) { portctrl::frame tmp = input.blank_frame(false); std::istream& m = r[mname]; @@ -221,7 +219,7 @@ void moviefile::brief_info::load(zip::reader& r) } } -void moviefile::load(zip::reader& r, core_type& romtype) throw(std::bad_alloc, std::runtime_error) +void moviefile::load(zip::reader& r, core_type& romtype) { std::string tmp; r.read_linefile("systemid", tmp); diff --git a/src/core/moviefile-text-save.cpp b/src/core/moviefile-text-save.cpp index fe98e694..0052144f 100644 --- a/src/core/moviefile-text-save.cpp +++ b/src/core/moviefile-text-save.cpp @@ -47,7 +47,7 @@ namespace } } - void write_rrdata(zip::writer& w, rrdata_set& rrd) throw(std::bad_alloc, std::runtime_error) + void write_rrdata(zip::writer& w, rrdata_set& rrd) { uint64_t count; std::vector out; @@ -66,7 +66,6 @@ namespace } void write_authors_file(zip::writer& w, std::vector>& authors) - throw(std::bad_alloc, std::runtime_error) { std::ostream& m = w.create_file("authors"); try { @@ -85,7 +84,6 @@ namespace } void write_input(zip::writer& w, const std::string& mname, portctrl::frame_vector& input) - throw(std::bad_alloc, std::runtime_error) { std::ostream& m = w.create_file(mname); try { @@ -139,7 +137,7 @@ namespace } } -void moviefile::save(zip::writer& w, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error) +void moviefile::save(zip::writer& w, rrdata_set& rrd, bool as_state) { w.write_linefile("gametype", gametype->get_name()); moviefile_write_settings(w, settings, gametype->get_type().get_settings(), [](zip::writer& w, diff --git a/src/core/moviefile.cpp b/src/core/moviefile.cpp index f27f217e..79caf991 100644 --- a/src/core/moviefile.cpp +++ b/src/core/moviefile.cpp @@ -102,7 +102,7 @@ moviefile::brief_info::brief_info(const std::string& filename) load(r); } -moviefile::moviefile() throw(std::bad_alloc) +moviefile::moviefile() : tracker(memtracker::singleton(), movie_file_id, sizeof(*this)) { force_corrupt = false; @@ -150,7 +150,7 @@ moviefile::moviefile(loaded_rom& rom, std::map& c_sett } } -moviefile::moviefile(const std::string& movie, core_type& romtype) throw(std::bad_alloc, std::runtime_error) +moviefile::moviefile(const std::string& movie, core_type& romtype) : tracker(memtracker::singleton(), movie_file_id, sizeof(*this)) { regex_results rr; @@ -192,7 +192,6 @@ void moviefile::fixup_current_branch(const moviefile& mv) } void moviefile::save(const std::string& movie, unsigned compression, bool binary, rrdata_set& rrd, bool as_state) - throw(std::bad_alloc, std::runtime_error) { regex_results rr; if(rr = regex("\\$MEMORY:(.*)", movie)) { @@ -235,7 +234,7 @@ void moviefile::save(const std::string& movie, unsigned compression, bool binary save(w, rrd, as_state); } -void moviefile::save(std::ostream& stream, rrdata_set& rrd, bool as_state) throw(std::bad_alloc, std::runtime_error) +void moviefile::save(std::ostream& stream, rrdata_set& rrd, bool as_state) { zip::writer w(stream, 0); save(w, rrd, as_state); diff --git a/src/core/queue.cpp b/src/core/queue.cpp index 902bf93e..d18c6105 100644 --- a/src/core/queue.cpp +++ b/src/core/queue.cpp @@ -39,21 +39,21 @@ keypress_info::keypress_info(keyboard::modifier_set mod, keyboard::key& _key, ke } -void input_queue::queue(const keypress_info& k) throw(std::bad_alloc) +void input_queue::queue(const keypress_info& k) { threads::alock h(queue_lock); keypresses.push_back(k); queue_condition.notify_all(); } -void input_queue::queue(const std::string& c) throw(std::bad_alloc) +void input_queue::queue(const std::string& c) { threads::alock h(queue_lock); commands.push_back(std::make_pair(nullptr, c)); queue_condition.notify_all(); } -void input_queue::queue(const char* c, const std::string& a) throw(std::bad_alloc) +void input_queue::queue(const char* c, const std::string& a) { threads::alock h(queue_lock); commands.push_back(std::make_pair(c, a)); @@ -61,7 +61,6 @@ void input_queue::queue(const char* c, const std::string& a) throw(std::bad_allo } void input_queue::queue(std::function f, std::function onerror, bool sync) - throw(std::bad_alloc) { if(!system_thread_available) { try { diff --git a/src/core/random.cpp b/src/core/random.cpp index 7ce501e7..8f8bcd42 100644 --- a/src/core/random.cpp +++ b/src/core/random.cpp @@ -80,7 +80,7 @@ void contribute_random_entropy(void* buf, size_t bytes) prng.write(buf, sizeof(buf)); } -std::string get_random_hexstring(size_t length) throw(std::bad_alloc) +std::string get_random_hexstring(size_t length) { std::string out; for(size_t i = 0; i < length; i += 64) @@ -88,7 +88,7 @@ std::string get_random_hexstring(size_t length) throw(std::bad_alloc) return out.substr(0, length); } -void set_random_seed(const std::string& seed) throw(std::bad_alloc) +void set_random_seed(const std::string& seed) { std::vector x(seed.begin(), seed.end()); { @@ -97,7 +97,7 @@ void set_random_seed(const std::string& seed) throw(std::bad_alloc) } } -void set_random_seed() throw(std::bad_alloc) +void set_random_seed() { char buf[128]; crandom::generate(buf, 128); diff --git a/src/core/rom.cpp b/src/core/rom.cpp index 884fc882..f107c438 100644 --- a/src/core/rom.cpp +++ b/src/core/rom.cpp @@ -56,14 +56,13 @@ loaded_rom::loaded_rom() throw() region = &image->get_region(); } -loaded_rom::loaded_rom(rom_image_handle _image) throw(std::bad_alloc, std::runtime_error) +loaded_rom::loaded_rom(rom_image_handle _image) { image = _image; region = &image->get_region(); } void loaded_rom::load(std::map& settings, uint64_t rtc_sec, uint64_t rtc_subsec) - throw(std::bad_alloc, std::runtime_error) { auto& core = CORE(); core_type* old_type = current_rom_type; @@ -109,7 +108,6 @@ void loaded_rom::load(std::map& settings, uint64_t rtc } std::map> load_sram_commandline(const std::vector& cmdline) - throw(std::bad_alloc, std::runtime_error) { std::map> ret; regex_results opt; @@ -146,7 +144,7 @@ std::map> load_sram_commandline(const std::vector return ret; } -std::vector loaded_rom::save_core_state(bool nochecksum) throw(std::bad_alloc, std::runtime_error) +std::vector loaded_rom::save_core_state(bool nochecksum) { std::vector ret; rtype().serialize(ret); @@ -164,7 +162,7 @@ std::vector loaded_rom::save_core_state(bool nochecksum) throw(std::bad_al return ret; } -void loaded_rom::load_core_state(const std::vector& buf, bool nochecksum) throw(std::runtime_error) +void loaded_rom::load_core_state(const std::vector& buf, bool nochecksum) { if(nochecksum) { rtype().unserialize(&buf[0], buf.size()); diff --git a/src/core/romimage.cpp b/src/core/romimage.cpp index 1b3a4ac8..d96c7435 100644 --- a/src/core/romimage.cpp +++ b/src/core/romimage.cpp @@ -185,7 +185,7 @@ rom_image::rom_image() throw() account_images(); } -rom_image::rom_image(const std::string& file, core_type& ctype) throw(std::bad_alloc, std::runtime_error) +rom_image::rom_image(const std::string& file, core_type& ctype) : tracker(memtracker::singleton(), romimage_id, sizeof(*this)) { rtype = &ctype; @@ -216,8 +216,7 @@ rom_image::rom_image(const std::string& file, core_type& ctype) throw(std::bad_a return; } -rom_image::rom_image(const std::string& file, const std::string& tmpprefer) throw(std::bad_alloc, - std::runtime_error) +rom_image::rom_image(const std::string& file, const std::string& tmpprefer) : tracker(memtracker::singleton(), romimage_id, sizeof(*this)) { std::istream& spec = zip::openrel(file, ""); @@ -267,7 +266,6 @@ rom_image::rom_image(const std::string& file, const std::string& tmpprefer) thro } void rom_image::load_bundle(const std::string& file, std::istream& spec, const std::string& tmpprefer) - throw(std::bad_alloc, std::runtime_error) { std::string s; load_filename = file; @@ -461,7 +459,7 @@ rom_image::rom_image(const std::string file[ROM_SLOT_COUNT], const std::string& account_images(); } -bool rom_image::is_gamepak(const std::string& filename) throw(std::bad_alloc, std::runtime_error) +bool rom_image::is_gamepak(const std::string& filename) { std::istream* spec = NULL; try { diff --git a/src/core/subtitles.cpp b/src/core/subtitles.cpp index 7ff6b6cb..3106c929 100644 --- a/src/core/subtitles.cpp +++ b/src/core/subtitles.cpp @@ -92,7 +92,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/core/window.cpp b/src/core/window.cpp index f640c1b1..47a5c26c 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -41,14 +41,14 @@ volatile bool platform::do_exit_dummy_event_loop = false; namespace { command::fnptr<> identify_key(lsnes_cmds, CSOUND::showdrv, - []() throw(std::bad_alloc, std::runtime_error) { + []() { messages << "Graphics:\t" << graphics_driver_name() << std::endl; messages << "Sound:\t" << audioapi_driver_name() << std::endl; messages << "Joystick:\t" << joystick_driver_name() << std::endl; }); command::fnptr enable_sound(lsnes_cmds, CSOUND::enable, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { if(args == "toggle") { if(!audioapi_driver_initialized()) throw std::runtime_error("Sound failed to initialize and is disabled"); @@ -90,7 +90,7 @@ namespace } command::fnptr change_playback_dev(lsnes_cmds, CSOUND::chpdev, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { auto old_rec = audioapi_driver_get_device(true); auto args2 = args; if(!fuzzy_search_list(audioapi_driver_get_devices(false), args2)) { @@ -101,7 +101,7 @@ namespace }); command::fnptr change_record_dev(lsnes_cmds, CSOUND::chrdev, - [](const std::string& args) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& args) { auto old_play = audioapi_driver_get_device(false); auto args2 = args; if(!fuzzy_search_list(audioapi_driver_get_devices(true), args2)) { @@ -112,7 +112,7 @@ namespace }); command::fnptr<> show_devices(lsnes_cmds, CSOUND::showdev, - []() throw(std::bad_alloc, std::runtime_error) { + []() { messages << "Known playback devices:" << std::endl; auto pdevs = audioapi_driver_get_devices(false); auto cpdev = audioapi_driver_get_device(false); @@ -130,7 +130,7 @@ namespace }); command::fnptr<> reset_audio(lsnes_cmds, CSOUND::reset, - []() throw(std::bad_alloc, std::runtime_error) { + []() { //Save the old devices. We save descriptions if possible, since handles change. auto cpdev = platform::get_sound_device_description(false); auto crdev = platform::get_sound_device_description(true); @@ -187,7 +187,7 @@ namespace { public: ~msgcallback() throw() {}; - void messagebuffer_update() throw(std::bad_alloc, std::runtime_error) + void messagebuffer_update() { platform::notify_message(); } @@ -242,7 +242,7 @@ void platform::set_sound_device_by_description(const std::string& pdev, const st set_sound_device(old_play, old_rec); } -std::string platform::get_sound_device_description(bool rec) throw(std::bad_alloc) +std::string platform::get_sound_device_description(bool rec) { auto dev = audioapi_driver_get_device(rec); auto devs = audioapi_driver_get_devices(rec); @@ -297,7 +297,7 @@ void platform::quit() system_log.close(); } -std::ostream& platform::out() throw(std::bad_alloc) +std::ostream& platform::out() { static std::ostream* cached = NULL; int dummy; @@ -309,7 +309,7 @@ std::ostream& platform::out() throw(std::bad_alloc) messagebuffer platform::msgbuf(MAXMESSAGES, INIT_WIN_SIZE); -void platform::message(const std::string& msg) throw(std::bad_alloc) +void platform::message(const std::string& msg) { threads::alock h(msgbuf_lock()); for(auto& forlog : token_iterator::foreach(msg, {"\n"})) { diff --git a/src/emulation/bsnes-legacy/core.cpp b/src/emulation/bsnes-legacy/core.cpp index d93ee608..352ec4fa 100644 --- a/src/emulation/bsnes-legacy/core.cpp +++ b/src/emulation/bsnes-legacy/core.cpp @@ -954,7 +954,6 @@ namespace void create_region(std::list& inf, const std::string& name, uint64_t base, uint64_t size, uint8_t (*readfn)(uint64_t offset), void (*writefn)(uint64_t offset, uint8_t data)) - throw(std::bad_alloc) { if(size == 0) return; @@ -971,7 +970,7 @@ namespace } void create_region(std::list& inf, const std::string& name, uint64_t base, uint8_t* memory, - uint64_t size, bool readonly, bool native_endian = false) throw(std::bad_alloc) + uint64_t size, bool readonly, bool native_endian = false) { if(size == 0) return; @@ -993,7 +992,7 @@ namespace } void create_region(std::list& inf, const std::string& name, uint64_t base, - SNES::MappedRAM& memory, bool readonly, bool native_endian = false) throw(std::bad_alloc) + SNES::MappedRAM& memory, bool readonly, bool native_endian = false) { create_region(inf, name, base, memory.data(), memory.size(), readonly, native_endian); } @@ -1177,7 +1176,7 @@ namespace return std::make_pair(64081, 2); return std::make_pair(SNES::system.apu_frequency(), static_cast(768)); } - std::map> c_save_sram() throw(std::bad_alloc) { + std::map> c_save_sram() { std::map> out; if(!internal_rom) return out; @@ -1191,7 +1190,7 @@ namespace } return out; } - void c_load_sram(std::map>& sram) throw(std::bad_alloc) { + void c_load_sram(std::map>& sram) { std::set used; if(!internal_rom) { for(auto i : sram) @@ -1902,7 +1901,7 @@ again2: command::fnptr dump_core(lsnes_cmds, "dump-core", "No description available", "No description available\n", - [](command::arg_filename args) throw(std::bad_alloc, std::runtime_error) { + [](command::arg_filename args) { std::vector out; bsnes_core.serialize(out); std::ofstream x(args, std::ios_base::out | std::ios_base::binary); @@ -2087,7 +2086,7 @@ again2: command::fnptr start_trace(lsnes_cmds, "set-trace", "No description available", "No description available\n", - [](const std::string& r) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& r) { CORE().command->invoke("tracelog cpu " + r); }); diff --git a/src/emulation/gambatte/core.cpp b/src/emulation/gambatte/core.cpp index 3d8235a9..71d3f39f 100644 --- a/src/emulation/gambatte/core.cpp +++ b/src/emulation/gambatte/core.cpp @@ -569,7 +569,7 @@ namespace else return std::make_pair(32768, 1); } - std::map> c_save_sram() throw(std::bad_alloc) { + std::map> c_save_sram() { std::map> s; if(!internal_rom) return s; @@ -582,7 +582,7 @@ namespace s["rtc"][i] = ((unsigned long long)timebase >> (8 * i)); return s; } - void c_load_sram(std::map>& sram) throw(std::bad_alloc) { + void c_load_sram(std::map>& sram) { if(!internal_rom) return; std::vector x = sram.count("main") ? sram["main"] : std::vector(); @@ -967,15 +967,13 @@ namespace std::vector cmp_save; - command::fnptr<> cmp_save1(lsnes_cmds, "set-cmp-save", "", "\n", []() throw(std::bad_alloc, - std::runtime_error) { + command::fnptr<> cmp_save1(lsnes_cmds, "set-cmp-save", "", "\n", []() { if(!internal_rom) return; instance->saveState(cmp_save); }); - command::fnptr<> cmp_save2(lsnes_cmds, "do-cmp-save", "", "\n", []() throw(std::bad_alloc, - std::runtime_error) { + command::fnptr<> cmp_save2(lsnes_cmds, "do-cmp-save", "", "\n", []() { std::vector x; if(!internal_rom) return; diff --git a/src/emulation/sky/sky.cpp b/src/emulation/sky/sky.cpp index 42824fbe..e5ee268e 100644 --- a/src/emulation/sky/sky.cpp +++ b/src/emulation/sky/sky.cpp @@ -266,7 +266,7 @@ namespace sky std::pair c_video_rate() { return std::make_pair(656250, 18227); } double c_get_PAR() { return 5.0/6; } std::pair c_audio_rate() { return std::make_pair(48000, 1); } - std::map> c_save_sram() throw(std::bad_alloc) { + std::map> c_save_sram() { std::map> r; std::vector sram; sram.resize(32); @@ -274,7 +274,7 @@ namespace sky r["sram"] = sram; return r; } - void c_load_sram(std::map>& sram) throw(std::bad_alloc) { + void c_load_sram(std::map>& sram) { if(sram.count("sram") && sram["sram"].size() == 32) memcpy(corei.state.sram, &sram["sram"][0], 32); else diff --git a/src/emulation/test/test.cpp b/src/emulation/test/test.cpp index 8cb46d4f..2a8619f5 100644 --- a/src/emulation/test/test.cpp +++ b/src/emulation/test/test.cpp @@ -132,11 +132,11 @@ namespace std::pair c_video_rate() { return std::make_pair(60, 1); } double c_get_PAR() { return 1.0; } std::pair c_audio_rate() { return std::make_pair(48000, 1); } - std::map> c_save_sram() throw(std::bad_alloc) { + std::map> c_save_sram() { std::map> s; return s; } - void c_load_sram(std::map>& sram) throw(std::bad_alloc) {} + void c_load_sram(std::map>& sram) {} void c_serialize(std::vector& out) { out.clear(); } void c_unserialize(const char* in, size_t insize) {} core_region& c_get_region() { return *this; } diff --git a/src/interface/c-interface.cpp b/src/interface/c-interface.cpp index efc3817e..780f587b 100644 --- a/src/interface/c-interface.cpp +++ b/src/interface/c-interface.cpp @@ -358,7 +358,7 @@ namespace } return ret; } - void c_load_sram(std::map>& sram) throw(std::bad_alloc) + void c_load_sram(std::map>& sram) { lsnes_core_load_sram s; if(caps1 & LSNES_CORE_CAP1_SRAM) { @@ -387,7 +387,7 @@ namespace entrypoint(id, s); } } - std::map> c_save_sram() throw(std::bad_alloc) + std::map> c_save_sram() { lsnes_core_save_sram s; std::map> ret; diff --git a/src/interface/romtype.cpp b/src/interface/romtype.cpp index 89a25c2a..b7b739b3 100644 --- a/src/interface/romtype.cpp +++ b/src/interface/romtype.cpp @@ -458,12 +458,12 @@ void core_core::uninstall_all_handlers() i->uninstall_handler(); } -std::map> core_core::save_sram() throw(std::bad_alloc) +std::map> core_core::save_sram() { return c_save_sram(); } -void core_core::load_sram(std::map>& sram) throw(std::bad_alloc) +void core_core::load_sram(std::map>& sram) { c_load_sram(sram); } diff --git a/src/interface/setting.cpp b/src/interface/setting.cpp index f7bfcf46..801c04ff 100644 --- a/src/interface/setting.cpp +++ b/src/interface/setting.cpp @@ -1,7 +1,7 @@ #include "interface/setting.hpp" #include "library/string.hpp" -core_setting_value::core_setting_value(const core_setting_value_param& p) throw(std::bad_alloc) +core_setting_value::core_setting_value(const core_setting_value_param& p) : iname(p.iname), hname(p.hname), index(p.index) { } @@ -56,7 +56,7 @@ core_setting_group::core_setting_group(std::vector _settings settings.insert(std::make_pair(i.iname, core_setting(i))); } -void core_setting_group::fill_defaults(std::map& values) throw(std::bad_alloc) +void core_setting_group::fill_defaults(std::map& values) { for(auto i : settings) if(!values.count(i.first)) @@ -71,7 +71,7 @@ std::set core_setting_group::get_setting_set() return r; } -std::vector core_setting::hvalues() const throw(std::runtime_error) +std::vector core_setting::hvalues() const { std::vector x; if(values.size() == 0) @@ -81,7 +81,7 @@ std::vector core_setting::hvalues() const throw(std::runtime_error) return x; } -std::string core_setting::hvalue_to_ivalue(const std::string& hvalue) const throw(std::runtime_error) +std::string core_setting::hvalue_to_ivalue(const std::string& hvalue) const { for(auto i : values) if(i.hname == hvalue) @@ -89,7 +89,7 @@ std::string core_setting::hvalue_to_ivalue(const std::string& hvalue) const thro throw std::runtime_error("Invalid hvalue for setting"); } -signed core_setting::ivalue_to_index(const std::string& ivalue) const throw(std::runtime_error) +signed core_setting::ivalue_to_index(const std::string& ivalue) const { for(auto i : values) if(i.iname == ivalue) diff --git a/src/library/command.cpp b/src/library/command.cpp index 48566c89..b757ea3b 100644 --- a/src/library/command.cpp +++ b/src/library/command.cpp @@ -25,7 +25,7 @@ namespace { } - void invoke(const std::string& filename) throw(std::bad_alloc, std::runtime_error) + void invoke(const std::string& filename) { if(filename == "") { (*output) << "Syntax: run-script " << std::endl; @@ -45,12 +45,12 @@ namespace } } - std::string get_short_help() throw(std::bad_alloc) + std::string get_short_help() { return "Run file as a script"; } - std::string get_long_help() throw(std::bad_alloc) + std::string get_long_help() { return "Syntax: run-script \nRuns file just as it would have been entered in " "the command line\n"; @@ -93,7 +93,7 @@ set::listener::~listener() { } -void factory_base::_factory_base(set& _set, const std::string& cmd) throw(std::bad_alloc) +void factory_base::_factory_base(set& _set, const std::string& cmd) { threads::arlock h(get_cmd_lock()); in_set = &_set; @@ -113,7 +113,7 @@ void factory_base::set_died() throw() in_set = NULL; } -base::base(group& group, const std::string& cmd, bool dynamic) throw(std::bad_alloc) +base::base(group& group, const std::string& cmd, bool dynamic) { in_group = &group; is_dynamic = dynamic; @@ -136,17 +136,17 @@ void base::group_died() throw() if(is_dynamic) delete this; } -std::string base::get_short_help() throw(std::bad_alloc) +std::string base::get_short_help() { return "No description available"; } -std::string base::get_long_help() throw(std::bad_alloc) +std::string base::get_long_help() { return "No help available on command " + commandname; } -set::set() throw(std::bad_alloc) +set::set() { } @@ -169,7 +169,7 @@ set::~set() throw() set_internal_t::clear(this); } -void set::do_register(const std::string& name, factory_base& cmd) throw(std::bad_alloc) +void set::do_register(const std::string& name, factory_base& cmd) { threads::arlock h(get_cmd_lock()); auto& state = set_internal_t::get(this); @@ -183,7 +183,7 @@ void set::do_register(const std::string& name, factory_base& cmd) throw(std::bad i->create(*this, name, cmd); } -void set::do_unregister(const std::string& name, factory_base& cmd) throw(std::bad_alloc) +void set::do_unregister(const std::string& name, factory_base& cmd) { threads::arlock h(get_cmd_lock()); auto state = set_internal_t::get_soft(this); @@ -196,7 +196,6 @@ void set::do_unregister(const std::string& name, factory_base& cmd) throw(std::b } void set::add_callback(set::listener& listener) - throw(std::bad_alloc) { threads::arlock h(get_cmd_lock()); auto& state = set_internal_t::get(this); @@ -219,7 +218,7 @@ void set::drop_callback(set::listener& listener) throw() } } -group::group() throw(std::bad_alloc) +group::group() : _listener(*this) { oom_panic_routine = default_oom_panic; @@ -352,7 +351,7 @@ void group::invoke(const std::string& cmd, const std::string& args) throw() } } -std::set group::get_aliases() throw(std::bad_alloc) +std::set group::get_aliases() { threads::arlock lock(get_cmd_lock()); std::set r; @@ -361,7 +360,7 @@ std::set group::get_aliases() throw(std::bad_alloc) return r; } -std::string group::get_alias_for(const std::string& aname) throw(std::bad_alloc) +std::string group::get_alias_for(const std::string& aname) { threads::arlock lock(get_cmd_lock()); if(!valid_alias_name(aname)) @@ -375,7 +374,7 @@ std::string group::get_alias_for(const std::string& aname) throw(std::bad_alloc) return ""; } -void group::set_alias_for(const std::string& aname, const std::string& avalue) throw(std::bad_alloc) +void group::set_alias_for(const std::string& aname, const std::string& avalue) { threads::arlock lock(get_cmd_lock()); if(!valid_alias_name(aname)) @@ -395,7 +394,7 @@ void group::set_alias_for(const std::string& aname, const std::string& avalue) t aliases[aname] = newlist; } -bool group::valid_alias_name(const std::string& aliasname) throw(std::bad_alloc) +bool group::valid_alias_name(const std::string& aliasname) { if(aliasname.length() == 0 || aliasname[0] == '?' || aliasname[0] == '*') return false; @@ -404,7 +403,7 @@ bool group::valid_alias_name(const std::string& aliasname) throw(std::bad_alloc) return true; } -void group::do_register(const std::string& name, base& cmd) throw(std::bad_alloc) +void group::do_register(const std::string& name, base& cmd) { threads::arlock h(get_cmd_lock()); auto& state = group_internal_t::get(this); @@ -413,7 +412,7 @@ void group::do_register(const std::string& name, base& cmd) throw(std::bad_alloc state.commands[name] = &cmd; } -void group::do_unregister(const std::string& name, base& cmd) throw(std::bad_alloc) +void group::do_unregister(const std::string& name, base& cmd) { threads::arlock h(get_cmd_lock()); auto state = group_internal_t::get_soft(this); @@ -435,7 +434,7 @@ void group::set_oom_panic(void (*fn)()) oom_panic_routine = default_oom_panic; } -void group::add_set(set& s) throw(std::bad_alloc) +void group::add_set(set& s) { threads::arlock h(get_cmd_lock()); auto& state = group_internal_t::get(this); diff --git a/src/library/fileimage-patch-bps.cpp b/src/library/fileimage-patch-bps.cpp index 02e39907..6c925182 100644 --- a/src/library/fileimage-patch-bps.cpp +++ b/src/library/fileimage-patch-bps.cpp @@ -58,7 +58,7 @@ namespace ~bps_patcher() throw(); bool identify(const std::vector& patch) throw(); void dopatch(std::vector& out, const std::vector& original, - const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error); + const std::vector& patch, int32_t offset); } bpspatch; bps_patcher::~bps_patcher() throw() @@ -71,7 +71,7 @@ namespace } void bps_patcher::dopatch(std::vector& out, const std::vector& original, - const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error) + const std::vector& patch, int32_t offset) { if(offset) (stringfmt() << "Nonzero offsets (" << offset << ") not allowed in BPS mode.").throwex(); diff --git a/src/library/fileimage-patch-ips.cpp b/src/library/fileimage-patch-ips.cpp index 42903461..00c590d4 100644 --- a/src/library/fileimage-patch-ips.cpp +++ b/src/library/fileimage-patch-ips.cpp @@ -24,7 +24,7 @@ namespace ~ips_patcher() throw(); bool identify(const std::vector& patch) throw(); void dopatch(std::vector& out, const std::vector& original, - const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error); + const std::vector& patch, int32_t offset); } ipspatch; ips_patcher::~ips_patcher() throw() @@ -38,7 +38,7 @@ namespace } void ips_patcher::dopatch(std::vector& out, const std::vector& original, - const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error) + const std::vector& patch, int32_t offset) { //Initial guess. out = original; diff --git a/src/library/fileimage-patch.cpp b/src/library/fileimage-patch.cpp index 126f4bcf..3fd9141e 100644 --- a/src/library/fileimage-patch.cpp +++ b/src/library/fileimage-patch.cpp @@ -18,7 +18,7 @@ namespace } std::vector patch(const std::vector& original, const std::vector& patch, - int32_t offset) throw(std::bad_alloc, std::runtime_error) + int32_t offset) { std::vector out; for(auto i : patchers()) @@ -29,7 +29,7 @@ std::vector patch(const std::vector& original, const std::vector& patch, int32_t offset) throw(std::bad_alloc, std::runtime_error) +void image::patch(const std::vector& patch, int32_t offset) { if(type == info::IT_NONE) throw std::runtime_error("Not an image"); diff --git a/src/library/framebuffer-font2.cpp b/src/library/framebuffer-font2.cpp index 53d19712..3e4acc39 100644 --- a/src/library/framebuffer-font2.cpp +++ b/src/library/framebuffer-font2.cpp @@ -300,7 +300,7 @@ std::ostream& operator<<(std::ostream& os, const std::u32string& lkey) return os; } -void font2::add(const std::u32string& key, const glyph& fglyph) throw(std::bad_alloc) +void font2::add(const std::u32string& key, const glyph& fglyph) { glyphs[key] = fglyph; if(fglyph.height > rowadvance) @@ -308,7 +308,6 @@ void font2::add(const std::u32string& key, const glyph& fglyph) throw(std::bad_a } std::u32string font2::best_ligature_match(const std::u32string& codepoints, size_t start) const - throw(std::bad_alloc) { std::u32string tmp; if(start >= codepoints.length()) diff --git a/src/library/framebuffer-pixfmt-lrgb.cpp b/src/library/framebuffer-pixfmt-lrgb.cpp index 372860cc..25633ab8 100644 --- a/src/library/framebuffer-pixfmt-lrgb.cpp +++ b/src/library/framebuffer-pixfmt-lrgb.cpp @@ -41,7 +41,7 @@ void _pixfmt_lrgb::decode(uint64_t* target, const uint8_t* src, size_t width, } void _pixfmt_lrgb::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x80000); for(size_t i = 0; i < 0x80000; i++) { @@ -59,7 +59,7 @@ void _pixfmt_lrgb::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t } void _pixfmt_lrgb::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x80000); for(size_t i = 0; i < 0x80000; i++) { diff --git a/src/library/framebuffer-pixfmt-rgb15.cpp b/src/library/framebuffer-pixfmt-rgb15.cpp index 91ac3e2b..151325df 100644 --- a/src/library/framebuffer-pixfmt-rgb15.cpp +++ b/src/library/framebuffer-pixfmt-rgb15.cpp @@ -44,7 +44,7 @@ void _pixfmt_rgb15::decode(uint64_t* target, const uint8_t* src, size_t template void _pixfmt_rgb15::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x8000); for(size_t i = 0; i < 0x8000; i++) { @@ -62,7 +62,7 @@ void _pixfmt_rgb15::set_palette(auxpalette& auxp, uint8_t rshift, template void _pixfmt_rgb15::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x8000); for(size_t i = 0; i < 0x8000; i++) { diff --git a/src/library/framebuffer-pixfmt-rgb16.cpp b/src/library/framebuffer-pixfmt-rgb16.cpp index 58b49b4c..44debfb7 100644 --- a/src/library/framebuffer-pixfmt-rgb16.cpp +++ b/src/library/framebuffer-pixfmt-rgb16.cpp @@ -43,7 +43,7 @@ void _pixfmt_rgb16::decode(uint64_t* target, const uint8_t* src, size_t template void _pixfmt_rgb16::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x10000); for(size_t i = 0; i < 0x10000; i++) { @@ -61,7 +61,7 @@ void _pixfmt_rgb16::set_palette(auxpalette& auxp, uint8_t rshift, template void _pixfmt_rgb16::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.pcache.resize(0x10000); for(size_t i = 0; i < 0x10000; i++) { diff --git a/src/library/framebuffer-pixfmt-rgb24.cpp b/src/library/framebuffer-pixfmt-rgb24.cpp index 718adff0..bcbe8d1d 100644 --- a/src/library/framebuffer-pixfmt-rgb24.cpp +++ b/src/library/framebuffer-pixfmt-rgb24.cpp @@ -50,7 +50,7 @@ void _pixfmt_rgb24::decode(uint64_t* target, const uint8_t* src, size_t template void _pixfmt_rgb24::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.rshift = rshift; auxp.gshift = gshift; @@ -60,7 +60,7 @@ void _pixfmt_rgb24::set_palette(auxpalette& auxp, uint8_t rshift, template void _pixfmt_rgb24::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.rshift = rshift; auxp.gshift = gshift; diff --git a/src/library/framebuffer-pixfmt-rgb32.cpp b/src/library/framebuffer-pixfmt-rgb32.cpp index a37d073e..24da97dd 100644 --- a/src/library/framebuffer-pixfmt-rgb32.cpp +++ b/src/library/framebuffer-pixfmt-rgb32.cpp @@ -36,7 +36,7 @@ void _pixfmt_rgb32::decode(uint64_t* target, const uint8_t* src, size_t width, } void _pixfmt_rgb32::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.rshift = rshift; auxp.gshift = gshift; @@ -45,7 +45,7 @@ void _pixfmt_rgb32::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t } void _pixfmt_rgb32::set_palette(auxpalette& auxp, uint8_t rshift, uint8_t gshift, - uint8_t bshift) throw(std::bad_alloc) + uint8_t bshift) { auxp.rshift = rshift; auxp.gshift = gshift; diff --git a/src/library/framebuffer.cpp b/src/library/framebuffer.cpp index 0aa1c9b3..4fcd9a3a 100644 --- a/src/library/framebuffer.cpp +++ b/src/library/framebuffer.cpp @@ -134,7 +134,7 @@ color_mod::color_mod(const std::string& name, std::function fn) colornames()[name] = std::make_pair(fn, true); } -pixfmt::pixfmt() throw(std::bad_alloc) +pixfmt::pixfmt() { pixfmts().push_back(this); } @@ -148,7 +148,7 @@ pixfmt::~pixfmt() throw() } } -raw::raw(const info& info) throw(std::bad_alloc) +raw::raw(const info& info) { size_t unit = info.type->get_bpp(); size_t pixel_offset = info.offset_y * info.physstride + unit * info.offset_x; @@ -161,7 +161,7 @@ raw::raw(const info& info) throw(std::bad_alloc) allocated = 0; } -raw::raw() throw(std::bad_alloc) +raw::raw() { user_memory = true; fmt = NULL; @@ -172,7 +172,7 @@ raw::raw() throw(std::bad_alloc) allocated = 0; } -raw::raw(const raw& f) throw(std::bad_alloc) +raw::raw(const raw& f) { user_memory = true; fmt = f.fmt; @@ -186,7 +186,7 @@ raw::raw(const raw& f) throw(std::bad_alloc) memcpy(addr + stride * i, f.addr + f.stride * i, unit * width); } -raw& raw::operator=(const raw& f) throw(std::bad_alloc, std::runtime_error) +raw& raw::operator=(const raw& f) { if(!user_memory) throw std::runtime_error("Target framebuffer is not writable"); @@ -215,7 +215,7 @@ raw::~raw() delete[] addr; } -void raw::load(const std::vector& data) throw(std::bad_alloc, std::runtime_error) +void raw::load(const std::vector& data) { if(data.size() < 2) throw std::runtime_error("Bad screenshot data"); @@ -281,7 +281,7 @@ void raw::load(const std::vector& data) throw(std::bad_alloc, std::runtime decode_words<4>(reinterpret_cast(addr), data2 + dataoffset, data.size() - dataoffset); } -void raw::save(std::vector& data) throw(std::bad_alloc) +void raw::save(std::vector& data) { uint8_t* memory = reinterpret_cast(addr); unsigned m; @@ -325,7 +325,7 @@ void raw::save(std::vector& data) throw(std::bad_alloc) } } -void raw::save_png(const std::string& file) throw(std::bad_alloc, std::runtime_error) +void raw::save_png(const std::string& file) { uint8_t* memory = reinterpret_cast(addr); png::encoder img; @@ -436,7 +436,7 @@ void fb::copy_from(raw& scr, size_t hscale, size_t vscale) throw() } template -void fb::set_palette(uint32_t r, uint32_t g, uint32_t b) throw(std::bad_alloc) +void fb::set_palette(uint32_t r, uint32_t g, uint32_t b) { typename fb::element_t R, G, B; if(r == active_rshift && g == active_gshift && b == active_bshift) @@ -467,7 +467,7 @@ void fb::set(element_t* _memory, size_t _width, size_t _height, size_t _pitch } template -void fb::reallocate(size_t _width, size_t _height, bool _upside_down) throw(std::bad_alloc) +void fb::reallocate(size_t _width, size_t _height, bool _upside_down) { size_t ustride = (_width + 11) / 12 * 12; if(width != _width || height != _height) { @@ -519,7 +519,7 @@ size_t raw::get_height() const throw() { return height; } template size_t fb::get_origin_x() const throw() { return offset_x; } template size_t fb::get_origin_y() const throw() { return offset_y; } -void queue::add(struct object& obj) throw(std::bad_alloc) +void queue::add(struct object& obj) { struct node* n = reinterpret_cast(alloc(sizeof(node))); n->obj = &obj; @@ -531,7 +531,7 @@ void queue::add(struct object& obj) throw(std::bad_alloc) queue_head = queue_tail = n; } -void queue::copy_from(queue& q) throw(std::bad_alloc) +void queue::copy_from(queue& q) { struct node* tmp = q.queue_head; while(tmp) { @@ -571,7 +571,7 @@ void queue::clear() throw() queue_tail = NULL; } -void* queue::alloc(size_t block) throw(std::bad_alloc) +void* queue::alloc(size_t block) { block = (block + 15) / 16 * 16; if(block > RENDER_PAGE_SIZE) @@ -639,7 +639,7 @@ bool object::kill_request(void* obj) throw() return false; } -font::font() throw(std::bad_alloc) +font::font() { bad_glyph_data[0] = 0x018001AAU; bad_glyph_data[1] = 0x01800180U; @@ -649,7 +649,7 @@ font::font() throw(std::bad_alloc) bad_glyph.data = bad_glyph_data; } -void font::load_hex_glyph(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) +void font::load_hex_glyph(const char* data, size_t size) { char buf2[8]; std::string line(data, data + size); @@ -686,7 +686,7 @@ void font::load_hex_glyph(const char* data, size_t size) throw(std::bad_alloc, s glyphs[cp].offset = p; } -void font::load_hex(const char* data, size_t size) throw(std::bad_alloc, std::runtime_error) +void font::load_hex(const char* data, size_t size) { const char* enddata = data + size; while(data != enddata) { @@ -744,7 +744,7 @@ std::pair font::get_metrics(const std::string& string, uint32_t return std::make_pair(commit_width, commit_height); } -std::vector font::dolayout(const std::string& string) throw(std::bad_alloc) +std::vector font::dolayout(const std::string& string) { //First, calculate the number of glyphs to draw. size_t chars = 0; @@ -909,7 +909,7 @@ void font::for_each_glyph(const std::string& str, uint32_t alignx, bool xdbl, bo } -color::color(const std::string& clr) throw(std::bad_alloc, std::runtime_error) +color::color(const std::string& clr) { int64_t col = -1; bool first = true; diff --git a/src/library/hex.cpp b/src/library/hex.cpp index 18f53cbd..f60b113c 100644 --- a/src/library/hex.cpp +++ b/src/library/hex.cpp @@ -10,12 +10,12 @@ namespace hex const char* chars = "0123456789abcdef"; const char* charsu = "0123456789abcdef"; -std::string to24(uint32_t data, bool prefix) throw(std::bad_alloc) +std::string to24(uint32_t data, bool prefix) { return to(data, prefix); } -std::string b_to(const uint8_t* data, size_t datalen, bool uppercase) throw(std::bad_alloc) +std::string b_to(const uint8_t* data, size_t datalen, bool uppercase) { const char* cset = uppercase ? charsu : chars; std::string s; @@ -27,13 +27,13 @@ std::string b_to(const uint8_t* data, size_t datalen, bool uppercase) throw(std: return s; } -template std::string to(T data, bool prefix) throw(std::bad_alloc) +template std::string to(T data, bool prefix) { return (stringfmt() << (prefix ? "0x" : "") << std::hex << std::setfill('0') << std::setw(2 * sizeof(T)) << (uint64_t)data).str(); } -void b_from(uint8_t* buf, const std::string& hex) throw(std::runtime_error) +void b_from(uint8_t* buf, const std::string& hex) { if(hex.length() & 1) throw std::runtime_error("hex::frombinary: Length of string must be even"); @@ -57,7 +57,7 @@ void b_from(uint8_t* buf, const std::string& hex) throw(std::runtime_error) } } -template T from(const std::string& hex) throw(std::runtime_error) +template T from(const std::string& hex) { if(hex.length() > 2 * sizeof(T)) throw std::runtime_error("hex::from: Hexadecimal value too long"); diff --git a/src/library/integer-pool.cpp b/src/library/integer-pool.cpp index 8d3ab68e..8a54abc1 100644 --- a/src/library/integer-pool.cpp +++ b/src/library/integer-pool.cpp @@ -79,7 +79,7 @@ integer_pool::integer_pool() throw() bits = &_bits2; } -uint64_t integer_pool::operator()() throw(std::bad_alloc) +uint64_t integer_pool::operator()() { if(invalid) throw std::bad_alloc(); //If the first byte is 0xFF, we got to expand the array. diff --git a/src/library/json.cpp b/src/library/json.cpp index a72744e2..79a870d7 100644 --- a/src/library/json.cpp +++ b/src/library/json.cpp @@ -315,8 +315,8 @@ bool node::number_holder::operator==(const number_holder& h) const node::node() throw() : node(null) {} node::node(null_tag) throw() { vtype = null; } node::node(boolean_tag, bool b) throw() { vtype = boolean; _boolean = b; } -node::node(string_tag, const std::u32string& str) throw(std::bad_alloc) { vtype = string; _string = str; } -node::node(string_tag, const std::string& str) throw(std::bad_alloc) { vtype = string; _string = utf8::to32(str); } +node::node(string_tag, const std::u32string& str) { vtype = string; _string = str; } +node::node(string_tag, const std::string& str) { vtype = string; _string = utf8::to32(str); } node::node(number_tag, double n) throw() { vtype = number; _number.from(n); } node::node(number_tag, int64_t n) throw() { vtype = number; _number.from(n); } node::node(number_tag, uint64_t n) throw() { vtype = number; _number.from(n); } @@ -330,7 +330,7 @@ node& node::set(number_tag, double n) throw() { set_helper(n); return *t node& node::set(number_tag, int64_t n) throw() { set_helper(n); return *this; } node& node::set(number_tag, uint64_t n) throw() { set_helper(n); return *this; } -node& node::set(string_tag, const std::u32string& key) throw(std::bad_alloc) +node& node::set(string_tag, const std::u32string& key) { std::u32string tmp = key; std::swap(_string, tmp); @@ -340,36 +340,36 @@ node& node::set(string_tag, const std::u32string& key) throw(std::bad_alloc) return *this; } -double node::as_double() const throw(error) +double node::as_double() const { return get_number_helper(); } -int64_t node::as_int() const throw(error) +int64_t node::as_int() const { return get_number_helper(); } -uint64_t node::as_uint() const throw(error) +uint64_t node::as_uint() const { return get_number_helper(); } -const std::u32string& node::as_string() const throw(std::bad_alloc, error) +const std::u32string& node::as_string() const { if(vtype != string) throw error(ERR_NOT_A_STRING); return _string; } -bool node::as_bool() const throw(error) +bool node::as_bool() const { if(vtype != boolean) throw error(ERR_NOT_A_BOOLEAN); return _boolean; } -size_t node::index_count() const throw(error) +size_t node::index_count() const { if(vtype != array) throw error(ERR_NOT_AN_ARRAY); @@ -396,7 +396,7 @@ errorcode node::index_soft(size_t index, node*& out) throw() return ERR_OK; } -size_t node::field_count(const std::u32string& key) const throw(error) +size_t node::field_count(const std::u32string& key) const { if(vtype != object) throw error(ERR_NOT_AN_OBJECT); @@ -405,7 +405,7 @@ size_t node::field_count(const std::u32string& key) const throw(error) return xobject.find(key)->second.size(); } -bool node::field_exists(const std::u32string& key) const throw(error) +bool node::field_exists(const std::u32string& key) const { return (field_count(key) > 0); } @@ -444,7 +444,7 @@ errorcode node::field_soft(const std::u32string& key, size_t subindex, node*& ou return ERR_INSTANCE_INVALID; } -node::node(const node& _node) throw(std::bad_alloc) +node::node(const node& _node) { std::u32string tmp1 = _node._string; std::list tmp2 = _node.xarray; @@ -461,7 +461,7 @@ node::node(const node& _node) throw(std::bad_alloc) fixup_nodes(_node); } -node& node::operator=(const node& _node) throw(std::bad_alloc) +node& node::operator=(const node& _node) { if(this == &_node) return *this; @@ -481,7 +481,7 @@ node& node::operator=(const node& _node) throw(std::bad_alloc) return *this; } -node& node::append(const node& _node) throw(std::bad_alloc, error) +node& node::append(const node& _node) { if(vtype != array) throw error(ERR_NOT_AN_ARRAY); @@ -499,7 +499,7 @@ node& node::append(const node& _node) throw(std::bad_alloc, error) } } -node& node::insert(const std::u32string& key, const node& _node) throw(std::bad_alloc, error) +node& node::insert(const std::u32string& key, const node& _node) { if(vtype != object) throw error(ERR_NOT_AN_OBJECT); @@ -546,7 +546,7 @@ namespace } -errorcode node::follow_soft(const std::u32string& pointer, const node*& current) const throw(std::bad_alloc) +errorcode node::follow_soft(const std::u32string& pointer, const node*& current) const { current = this; size_t ptr = 0; @@ -575,7 +575,7 @@ errorcode node::follow_soft(const std::u32string& pointer, const node*& current) return ERR_OK; } -errorcode node::follow_soft(const std::u32string& pointer, node*& current) throw(std::bad_alloc) +errorcode node::follow_soft(const std::u32string& pointer, node*& current) { current = this; size_t ptr = 0; @@ -875,7 +875,7 @@ bad: } } - std::u32string pointer_escape_field(const std::u32string& orig) throw(std::bad_alloc) + std::u32string pointer_escape_field(const std::u32string& orig) { std::basic_stringstream x; for(auto i : orig) { @@ -889,7 +889,7 @@ bad: return x.str(); } - std::u32string pointer_escape_index(uint64_t idx) throw(std::bad_alloc) + std::u32string pointer_escape_index(uint64_t idx) { std::string orig = (stringfmt() << idx).str(); std::basic_ostringstream x; @@ -899,7 +899,7 @@ bad: } } -std::string node::serialize(printer* _printer) const throw(std::bad_alloc, error) +std::string node::serialize(printer* _printer) const { printer xprinter; _printer = _printer ? _printer : &xprinter; @@ -939,7 +939,7 @@ std::string node::serialize(printer* _printer) const throw(std::bad_alloc, error throw error(ERR_UNKNOWN_TYPE); } -node::node(const std::string& doc) throw(std::bad_alloc, error) +node::node(const std::string& doc) { size_t tmp = 0; ctor(doc, tmp, doc.length()); @@ -948,7 +948,7 @@ node::node(const std::string& doc) throw(std::bad_alloc, error) throw error(ERR_GARBAGE_AFTER_END, PARSE_END_OF_DOCUMENT, tmp); } -void node::ctor(const std::string& doc, size_t& ptr, size_t len) throw(std::bad_alloc, error) +void node::ctor(const std::string& doc, size_t& ptr, size_t len) { size_t tmp3; tmp3 = ptr; @@ -1038,12 +1038,12 @@ void node::ctor(const std::string& doc, size_t& ptr, size_t len) throw(std::bad_ } } -node::node(const std::string& doc, size_t& ptr, size_t len) throw(std::bad_alloc, error) +node::node(const std::string& doc, size_t& ptr, size_t len) { ctor(doc, ptr, len); } -node& node::operator[](const std::u32string& pointer) throw(std::bad_alloc, error) +node& node::operator[](const std::u32string& pointer) { node* current = this; size_t ptr = 0; @@ -1078,7 +1078,7 @@ node& node::operator[](const std::u32string& pointer) throw(std::bad_alloc, erro return *current; } -node& node::insert_node(const std::u32string& pointer, const node& nwn) throw(std::bad_alloc, error) +node& node::insert_node(const std::u32string& pointer, const node& nwn) { size_t s = pointer.find_last_of(U"/"); node* base; @@ -1129,7 +1129,7 @@ node& node::insert_node(const std::u32string& pointer, const node& nwn) throw(st throw error(ERR_NOT_ARRAY_NOR_OBJECT); } -node node::delete_node(const std::u32string& pointer) throw(std::bad_alloc, error) +node node::delete_node(const std::u32string& pointer) { size_t s = pointer.find_last_of(U"/"); node* base; @@ -1170,7 +1170,7 @@ node node::delete_node(const std::u32string& pointer) throw(std::bad_alloc, erro throw error(ERR_NOT_ARRAY_NOR_OBJECT); } -node node::patch(const node& patch) const throw(std::bad_alloc, error) +node node::patch(const node& patch) const { node obj(*this); if(patch.type() != array) @@ -1234,7 +1234,7 @@ node node::patch(const node& patch) const throw(std::bad_alloc, error) node::iterator::iterator() throw() { n = NULL; } -node::iterator::iterator(node& _n) throw(error) +node::iterator::iterator(node& _n) { n = &_n; idx = 0; @@ -1250,21 +1250,21 @@ node::iterator::iterator(node& _n) throw(error) throw error(ERR_NOT_ARRAY_NOR_OBJECT); } -std::u32string node::iterator::key() throw(std::bad_alloc, error) +std::u32string node::iterator::key() { if(!n) throw error(ERR_ITERATOR_END); return (n->type() == object) ? _key : U""; } -size_t node::iterator::index() throw(error) +size_t node::iterator::index() { if(!n) throw error(ERR_ITERATOR_END); return idx; } -node& node::iterator::operator*() throw(error) +node& node::iterator::operator*() { if(!n) throw error(ERR_ITERATOR_END); @@ -1285,19 +1285,19 @@ node& node::iterator::operator*() throw(error) } } -node* node::iterator::operator->() throw(error) +node* node::iterator::operator->() { return &**this; } -node::iterator node::iterator::operator++(int) throw(error) +node::iterator node::iterator::operator++(int) { iterator tmp = *this; ++*this; return tmp; } -node::iterator& node::iterator::operator++() throw(error) +node::iterator& node::iterator::operator++() { if(!n) throw error(ERR_ITERATOR_END); @@ -1331,7 +1331,7 @@ bool node::iterator::operator!=(const iterator& i) throw() { return !(*this == i node::const_iterator::const_iterator() throw() { n = NULL; } -node::const_iterator::const_iterator(const node& _n) throw(error) +node::const_iterator::const_iterator(const node& _n) { n = &_n; idx = 0; @@ -1347,21 +1347,21 @@ node::const_iterator::const_iterator(const node& _n) throw(error) throw error(ERR_NOT_ARRAY_NOR_OBJECT); } -std::u32string node::const_iterator::key() throw(std::bad_alloc, error) +std::u32string node::const_iterator::key() { if(!n) throw error(ERR_ITERATOR_END); return (n->type() == object) ? _key : U""; } -size_t node::const_iterator::index() throw(error) +size_t node::const_iterator::index() { if(!n) throw error(ERR_ITERATOR_END); return idx; } -const node& node::const_iterator::operator*() throw(error) +const node& node::const_iterator::operator*() { if(!n) throw error(ERR_ITERATOR_END); @@ -1382,19 +1382,19 @@ const node& node::const_iterator::operator*() throw(error) } } -const node* node::const_iterator::operator->() throw(error) +const node* node::const_iterator::operator->() { return &**this; } -node::const_iterator node::const_iterator::operator++(int) throw(error) +node::const_iterator node::const_iterator::operator++(int) { const_iterator tmp = *this; ++*this; return tmp; } -node::const_iterator& node::const_iterator::operator++() throw(error) +node::const_iterator& node::const_iterator::operator++() { if(!n) throw error(ERR_ITERATOR_END); @@ -1426,7 +1426,7 @@ bool node::const_iterator::operator==(const const_iterator& i) throw() bool node::const_iterator::operator!=(const const_iterator& i) throw() { return !(*this == i); } -void node::erase_index(size_t idx) throw(error) +void node::erase_index(size_t idx) { if(type() == array) { if(idx >= xarray_index.size()) @@ -1442,7 +1442,7 @@ void node::erase_index(size_t idx) throw(error) throw error(ERR_NOT_AN_ARRAY); } -void node::erase_field(const std::u32string& fld, size_t idx) throw(error) +void node::erase_field(const std::u32string& fld, size_t idx) { if(type() == object) { if(xobject.count(fld)) { @@ -1460,7 +1460,7 @@ void node::erase_field(const std::u32string& fld, size_t idx) throw(error) throw error(ERR_NOT_AN_OBJECT); } -void node::erase_field_all(const std::u32string& fld) throw(error) +void node::erase_field_all(const std::u32string& fld) { if(type() == object) { if(xobject.count(fld)) @@ -1469,7 +1469,7 @@ void node::erase_field_all(const std::u32string& fld) throw(error) throw error(ERR_NOT_AN_OBJECT); } -void node::clear() throw(error) +void node::clear() { if(type() == object) xobject.clear(); @@ -1480,7 +1480,7 @@ void node::clear() throw(error) throw error(ERR_NOT_ARRAY_NOR_OBJECT); } -node::iterator node::erase(node::iterator itr) throw(error) +node::iterator node::erase(node::iterator itr) { if(itr.n != this) throw error(ERR_WRONG_OBJECT); @@ -1555,7 +1555,7 @@ bool node::operator==(const node& n) const } } -int node::type_of(const std::u32string& pointer) const throw(std::bad_alloc) +int node::type_of(const std::u32string& pointer) const { try { const node* n; @@ -1570,7 +1570,7 @@ int node::type_of(const std::u32string& pointer) const throw(std::bad_alloc) } } -int node::type_of_indirect(const std::u32string& pointer) const throw(std::bad_alloc) +int node::type_of_indirect(const std::u32string& pointer) const { try { const node* n; @@ -1588,7 +1588,7 @@ int node::type_of_indirect(const std::u32string& pointer) const throw(std::bad_a } } -std::u32string node::resolve_indirect(const std::u32string& pointer) const throw(std::bad_alloc) +std::u32string node::resolve_indirect(const std::u32string& pointer) const { try { const node& n = follow(pointer); @@ -1607,17 +1607,17 @@ pointer::pointer() { } -pointer::pointer(const std::string& ptr) throw(std::bad_alloc) +pointer::pointer(const std::string& ptr) { _pointer = utf8::to32(ptr); } -pointer::pointer(const std::u32string& ptr) throw(std::bad_alloc) +pointer::pointer(const std::u32string& ptr) { _pointer = ptr; } -pointer pointer::index(uint64_t idx) const throw(std::bad_alloc) +pointer pointer::index(uint64_t idx) const { if(_pointer.length()) return pointer(_pointer + U"/" + pointer_escape_index(idx)); @@ -1625,7 +1625,7 @@ pointer pointer::index(uint64_t idx) const throw(std::bad_alloc) return pointer(pointer_escape_index(idx)); } -pointer& pointer::index_inplace(uint64_t idx) throw(std::bad_alloc) +pointer& pointer::index_inplace(uint64_t idx) { if(_pointer.length()) _pointer = _pointer + U"/" + pointer_escape_index(idx); @@ -1634,7 +1634,7 @@ pointer& pointer::index_inplace(uint64_t idx) throw(std::bad_alloc) return *this; } -pointer pointer::field(const std::u32string& fld) const throw(std::bad_alloc) +pointer pointer::field(const std::u32string& fld) const { if(_pointer.length()) return pointer(_pointer + U"/" + pointer_escape_field(fld)); @@ -1642,7 +1642,7 @@ pointer pointer::field(const std::u32string& fld) const throw(std::bad_alloc) return pointer(pointer_escape_field(fld)); } -pointer& pointer::field_inplace(const std::u32string& fld) throw(std::bad_alloc) +pointer& pointer::field_inplace(const std::u32string& fld) { if(_pointer.length()) _pointer = _pointer + U"/" + pointer_escape_field(fld); @@ -1651,7 +1651,7 @@ pointer& pointer::field_inplace(const std::u32string& fld) throw(std::bad_alloc) return *this; } -pointer pointer::remove() const throw(std::bad_alloc) +pointer pointer::remove() const { size_t p = _pointer.find_last_of(U"/"); if(p >= _pointer.length()) @@ -1660,7 +1660,7 @@ pointer pointer::remove() const throw(std::bad_alloc) return pointer(_pointer.substr(0, p)); } -pointer& pointer::remove_inplace() throw(std::bad_alloc) +pointer& pointer::remove_inplace() { size_t p = _pointer.find_last_of(U"/"); if(p >= _pointer.length()) diff --git a/src/library/keyboard-mapper.cpp b/src/library/keyboard-mapper.cpp index 41a27467..2b4c958b 100644 --- a/src/library/keyboard-mapper.cpp +++ b/src/library/keyboard-mapper.cpp @@ -38,7 +38,7 @@ invbind_set::listener::~listener() { } -std::string mapper::fixup_command_polarity(std::string cmd, bool polarity) throw(std::bad_alloc) +std::string mapper::fixup_command_polarity(std::string cmd, bool polarity) { if(cmd == "" || cmd == "*") return ""; @@ -56,11 +56,11 @@ std::string mapper::fixup_command_polarity(std::string cmd, bool polarity) throw return cmd; } -keyspec::keyspec() throw(std::bad_alloc) +keyspec::keyspec() { } -keyspec::keyspec(const std::string& keyspec) throw(std::bad_alloc, std::runtime_error) +keyspec::keyspec(const std::string& keyspec) { regex_results r = regex("([^/]*)/([^|]*)\\|(.*)", keyspec, "Invalid keyspec"); mod = r[1]; @@ -68,7 +68,7 @@ keyspec::keyspec(const std::string& keyspec) throw(std::bad_alloc, std::runtime_ key = r[3]; } -keyspec::operator std::string() throw(std::bad_alloc) +keyspec::operator std::string() { return mod + "/" + mask + "|" + key; } @@ -100,7 +100,7 @@ bool keyspec::operator!=(const keyspec& keyspec) return (mod != keyspec.mod || mask != keyspec.mask || key != keyspec.key); } -std::set mapper::get_inverses() throw(std::bad_alloc) +std::set mapper::get_inverses() { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -111,7 +111,7 @@ std::set mapper::get_inverses() throw(std::bad_alloc) return r; } -invbind* mapper::get_inverse(const std::string& command) throw(std::bad_alloc) +invbind* mapper::get_inverse(const std::string& command) { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -121,7 +121,7 @@ invbind* mapper::get_inverse(const std::string& command) throw(std::bad_alloc) return NULL; } -std::set mapper::get_controller_keys() throw(std::bad_alloc) +std::set mapper::get_controller_keys() { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -132,7 +132,7 @@ std::set mapper::get_controller_keys() throw(std::bad_alloc) return r; } -ctrlrkey* mapper::get_controllerkey(const std::string& command) throw(std::bad_alloc) +ctrlrkey* mapper::get_controllerkey(const std::string& command) { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -142,7 +142,7 @@ ctrlrkey* mapper::get_controllerkey(const std::string& command) throw(std::bad_a return NULL; } -void mapper::do_register(const std::string& name, invbind& ibind) throw(std::bad_alloc) +void mapper::do_register(const std::string& name, invbind& ibind) { threads::arlock u(get_keymap_lock()); auto& state = mapper_internal_t::get(this); @@ -155,7 +155,7 @@ void mapper::do_register(const std::string& name, invbind& ibind) throw(std::bad } } -void mapper::do_unregister(const std::string& name, invbind& ibind) throw(std::bad_alloc) +void mapper::do_unregister(const std::string& name, invbind& ibind) { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -163,7 +163,7 @@ void mapper::do_unregister(const std::string& name, invbind& ibind) throw(std::b state->ibinds.erase(name); } -void mapper::do_register(const std::string& name, ctrlrkey& ckey) throw(std::bad_alloc) +void mapper::do_register(const std::string& name, ctrlrkey& ckey) { threads::arlock u(get_keymap_lock()); auto& state = mapper_internal_t::get(this); @@ -171,7 +171,7 @@ void mapper::do_register(const std::string& name, ctrlrkey& ckey) throw(std::bad state.ckeys[name] = &ckey; } -void mapper::do_unregister(const std::string& name, ctrlrkey& ckey) throw(std::bad_alloc) +void mapper::do_unregister(const std::string& name, ctrlrkey& ckey) { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -184,7 +184,7 @@ keyboard& mapper::get_keyboard() throw() return kbd; } -mapper::mapper(keyboard& _kbd, command::group& _domain) throw(std::bad_alloc) +mapper::mapper(keyboard& _kbd, command::group& _domain) : _listener(*this), kbd(_kbd), domain(_domain) { } @@ -258,7 +258,7 @@ bool mapper::triplet::operator==(const struct triplet& a) const return true; } -keyspec mapper::triplet::as_keyspec() const throw(std::bad_alloc) +keyspec mapper::triplet::as_keyspec() const { keyspec k; k.mod = mod; @@ -271,7 +271,7 @@ keyspec mapper::triplet::as_keyspec() const throw(std::bad_alloc) return k; } -std::list mapper::get_bindings() throw(std::bad_alloc) +std::list mapper::get_bindings() { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -288,7 +288,6 @@ command::group& mapper::get_command_group() throw() } void mapper::bind(std::string mod, std::string modmask, std::string keyname, std::string command) - throw(std::bad_alloc, std::runtime_error) { keyspec spec; spec.mod = mod; @@ -312,8 +311,7 @@ void mapper::bind(std::string mod, std::string modmask, std::string keyname, std change_command(spec, old_command, command); } -void mapper::unbind(std::string mod, std::string modmask, std::string keyname) throw(std::bad_alloc, - std::runtime_error) +void mapper::unbind(std::string mod, std::string modmask, std::string keyname) { keyspec spec; spec.mod = mod; @@ -332,7 +330,7 @@ void mapper::unbind(std::string mod, std::string modmask, std::string keyname) t change_command(spec, old_command, ""); } -std::string mapper::get(const keyspec& keyspec) throw(std::bad_alloc) +std::string mapper::get(const keyspec& keyspec) { triplet t(kbd, keyspec); threads::arlock u(get_keymap_lock()); @@ -363,8 +361,7 @@ void mapper::change_command(const keyspec& spec, const std::string& old, const s } } -void mapper::set(const keyspec& keyspec, const std::string& cmd) throw(std::bad_alloc, - std::runtime_error) +void mapper::set(const keyspec& keyspec, const std::string& cmd) { triplet t(kbd, keyspec); threads::arlock u(get_keymap_lock()); @@ -430,7 +427,6 @@ mapper::triplet::triplet(keyboard& k, const keyspec& spec) } std::list mapper::get_controllerkeys_kbdkey(key* kbdkey) - throw(std::bad_alloc) { threads::arlock u(get_keymap_lock()); auto state = mapper_internal_t::get_soft(this); @@ -503,7 +499,6 @@ void mapper::listener::kill(invbind_set& s) } invbind::invbind(mapper& kmapper, const std::string& _command, const std::string& _name, bool dynamic) - throw(std::bad_alloc) : _mapper(&kmapper), cmd(_command), oname(_name) { is_dynamic = dynamic; @@ -517,7 +512,7 @@ invbind::~invbind() throw() _mapper->do_unregister(cmd, *this); } -keyspec invbind::get(unsigned index) throw(std::bad_alloc) +keyspec invbind::get(unsigned index) { threads::arlock u(get_keymap_lock()); if(index >= specs.size()) @@ -525,7 +520,7 @@ keyspec invbind::get(unsigned index) throw(std::bad_alloc) return specs[index]; } -void invbind::clear(unsigned index) throw(std::bad_alloc) +void invbind::clear(unsigned index) { threads::arlock u(get_keymap_lock()); keyspec unbind; @@ -538,13 +533,13 @@ void invbind::clear(unsigned index) throw(std::bad_alloc) _mapper->set(unbind, ""); } -void invbind::append(const keyspec& keyspec) throw(std::bad_alloc) +void invbind::append(const keyspec& keyspec) { threads::arlock u(get_keymap_lock()); _mapper->set(keyspec, cmd); } -std::string invbind::getname() throw(std::bad_alloc) +std::string invbind::getname() { return oname; } @@ -557,7 +552,6 @@ void invbind::mapper_died() } invbind_info::invbind_info(invbind_set& set, const std::string& _command, const std::string& _name) - throw(std::bad_alloc) : in_set(&set) { command = _command; @@ -632,7 +626,7 @@ void invbind_set::do_unregister(const std::string& name, invbind_info& info) i->destroy(*this, name); } -void invbind_set::add_callback(invbind_set::listener& listener) throw(std::bad_alloc) +void invbind_set::add_callback(invbind_set::listener& listener) { threads::arlock u(get_keymap_lock()); auto& state = set_internal_t::get(this); @@ -656,7 +650,7 @@ void invbind_set::drop_callback(invbind_set::listener& listener) } ctrlrkey::ctrlrkey(mapper& kmapper, const std::string& _command, const std::string& _name, - bool _axis) throw(std::bad_alloc) + bool _axis) : _mapper(kmapper), cmd(_command), oname(_name) { axis = _axis; @@ -676,7 +670,7 @@ std::pair ctrlrkey::get(unsigned index) throw() return keys[index]; } -std::string ctrlrkey::get_string(unsigned index) throw(std::bad_alloc) +std::string ctrlrkey::get_string(unsigned index) { auto k = get(index); if(!k.first) @@ -713,14 +707,14 @@ void ctrlrkey::remove(key* _key, unsigned _subkey) throw() } } -void ctrlrkey::append(const std::string& _key) throw(std::bad_alloc, std::runtime_error) +void ctrlrkey::append(const std::string& _key) { auto g = keymapper_lookup_subkey(_mapper.get_keyboard(), _key, axis); append(g.first, g.second); } std::pair keymapper_lookup_subkey(keyboard& kbd, const std::string& name, - bool axis) throw(std::bad_alloc, std::runtime_error) + bool axis) { threads::arlock u(get_keymap_lock()); if(name == "") diff --git a/src/library/keyboard.cpp b/src/library/keyboard.cpp index d1fea188..c020ad48 100644 --- a/src/library/keyboard.cpp +++ b/src/library/keyboard.cpp @@ -21,7 +21,7 @@ namespace { typedef stateobject::type keyboard_internal_t; } -void keyboard::do_register(const std::string& name, modifier& mod) throw(std::bad_alloc) +void keyboard::do_register(const std::string& name, modifier& mod) { threads::arlock u(get_keyboard_lock()); auto& state = keyboard_internal_t::get(this); @@ -37,7 +37,7 @@ void keyboard::do_unregister(const std::string& name, modifier& mod) throw() state->modifiers.erase(name); } -modifier& keyboard::lookup_modifier(const std::string& name) throw(std::runtime_error) +modifier& keyboard::lookup_modifier(const std::string& name) { modifier* m = try_lookup_modifier(name); if(!m) @@ -54,7 +54,7 @@ modifier* keyboard::try_lookup_modifier(const std::string& name) throw() return state->modifiers[name]; } -std::list keyboard::all_modifiers() throw(std::bad_alloc) +std::list keyboard::all_modifiers() { threads::arlock u(get_keyboard_lock()); auto state = keyboard_internal_t::get_soft(this); @@ -65,7 +65,7 @@ std::list keyboard::all_modifiers() throw(std::bad_alloc) return r; } -void keyboard::do_register(const std::string& name, key& key) throw(std::bad_alloc) +void keyboard::do_register(const std::string& name, key& key) { threads::arlock u(get_keyboard_lock()); auto& state = keyboard_internal_t::get(this); @@ -81,7 +81,7 @@ void keyboard::do_unregister(const std::string& name, key& key) throw() state->keys.erase(name); } -key& keyboard::lookup_key(const std::string& name) throw(std::runtime_error) +key& keyboard::lookup_key(const std::string& name) { key* m = try_lookup_key(name); if(!m) @@ -98,7 +98,7 @@ key* keyboard::try_lookup_key(const std::string& name) throw() return state->keys[name]; } -std::list keyboard::all_keys() throw(std::bad_alloc) +std::list keyboard::all_keys() { threads::arlock u(get_keyboard_lock()); auto state = keyboard_internal_t::get_soft(this); @@ -130,7 +130,7 @@ key* keyboard::get_current_key() throw() return current_key; } -keyboard::keyboard() throw(std::bad_alloc) +keyboard::keyboard() { } @@ -142,20 +142,19 @@ keyboard::~keyboard() throw() keyboard_internal_t::clear(this); } -void modifier_set::add(modifier& mod, bool really) throw(std::bad_alloc) +void modifier_set::add(modifier& mod, bool really) { if(really) set.insert(&mod); } -void modifier_set::remove(modifier& mod, bool really) throw(std::bad_alloc) +void modifier_set::remove(modifier& mod, bool really) { if(really) set.erase(&mod); } modifier_set modifier_set::construct(keyboard& kbd, const std::string& _modifiers) - throw(std::bad_alloc, std::runtime_error) { modifier_set set; std::string modifiers = _modifiers; @@ -173,7 +172,7 @@ modifier_set modifier_set::construct(keyboard& kbd, const std::string& _modifier return set; } -bool modifier_set::valid(modifier_set& mask) throw(std::bad_alloc) +bool modifier_set::valid(modifier_set& mask) { //No element can be together with its linkage group. for(auto i : set) { @@ -219,7 +218,7 @@ bool modifier_set::operator<(const modifier_set& m) const throw() return (i2 != m.set.end()); } -modifier_set::operator std::string() const throw(std::bad_alloc) +modifier_set::operator std::string() const { std::string r; for(auto i : set) @@ -237,7 +236,6 @@ std::ostream& operator<<(std::ostream& os, const modifier_set& m) } bool modifier_set::triggers(const modifier_set& trigger, const modifier_set& mask) - throw(std::bad_alloc) { for(auto i : mask.set) { bool trigger_exact = trigger.set.count(i); @@ -332,14 +330,14 @@ int32_t event_hat::get_state() const throw() } key::key(keyboard& keyb, const std::string& _name, const std::string& _clazz, - keytype _type) throw(std::bad_alloc) + keytype _type) : kbd(keyb), clazz(_clazz), name(_name), type(_type) { exclusive_listener = NULL; kbd.do_register(name, *this); } -void key::add_listener(event_listener& listener, bool analog) throw(std::bad_alloc) +void key::add_listener(event_listener& listener, bool analog) { if(analog) { analog_listeners.insert(&listener); @@ -411,7 +409,6 @@ key_mouse* key::cast_mouse() throw() } key_key::key_key(keyboard& keyb, const std::string& name, const std::string& clazz) - throw(std::bad_alloc) : key(keyb, name, clazz, keytype::KBD_KEYTYPE_KEY) { state = 0; @@ -439,7 +436,7 @@ void key_key::set_state(modifier_set mods, int32_t _state) throw() int32_t key_key::get_state() const throw() { return state; } int32_t key_key::get_state_digital() const throw() { return state; } -std::vector key_key::get_subkeys() throw(std::bad_alloc) +std::vector key_key::get_subkeys() { std::vector r; r.push_back(""); @@ -447,7 +444,6 @@ std::vector key_key::get_subkeys() throw(std::bad_alloc) } key_hat::key_hat(keyboard& keyb, const std::string& name, const std::string& clazz) - throw(std::bad_alloc) : key(keyb, name, clazz, keytype::KBD_KEYTYPE_HAT) { state = 0; @@ -483,7 +479,7 @@ void key_hat::set_state(modifier_set mods, int32_t _state) throw() int32_t key_hat::get_state() const throw() { return state; } int32_t key_hat::get_state_digital() const throw() { return state; } -std::vector key_hat::get_subkeys() throw(std::bad_alloc) +std::vector key_hat::get_subkeys() { std::vector r; r.push_back("n"); @@ -494,7 +490,7 @@ std::vector key_hat::get_subkeys() throw(std::bad_alloc) } key_axis::key_axis(keyboard& keyb, const std::string& name, const std::string& clazz, - int mode) throw(std::bad_alloc) + int mode) : key(keyb, name, clazz, keytype::KBD_KEYTYPE_AXIS) { rawstate = 0; @@ -526,7 +522,7 @@ int key_axis::get_mode() const throw() return _mode; } -std::vector key_axis::get_subkeys() throw(std::bad_alloc) +std::vector key_axis::get_subkeys() { threads::arlock u(get_keyboard_lock()); std::vector r; @@ -580,7 +576,7 @@ void key_axis::set_mode(int mode, double tolerance) throw() } key_mouse::key_mouse(keyboard& keyb, const std::string& name, const std::string& clazz, - mouse_calibration _cal) throw(std::bad_alloc) + mouse_calibration _cal) : key(keyb, name, clazz, keytype::KBD_KEYTYPE_MOUSE) { rawstate = 0; @@ -596,7 +592,7 @@ int32_t key_mouse::get_state() const throw() return cal.get_calibrated_value(rawstate); } -std::vector key_mouse::get_subkeys() throw(std::bad_alloc) +std::vector key_mouse::get_subkeys() { return std::vector(); } diff --git a/src/library/loadlib.cpp b/src/library/loadlib.cpp index 7947a1d7..eab9df82 100644 --- a/src/library/loadlib.cpp +++ b/src/library/loadlib.cpp @@ -41,7 +41,7 @@ namespace #endif } -library::internal::internal(const std::string& filename) throw(std::bad_alloc, std::runtime_error) +library::internal::internal(const std::string& filename) { libname = filename; refs = 1; @@ -87,7 +87,7 @@ library::internal::~internal() throw() #endif } -void* library::internal::operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error) +void* library::internal::operator[](const std::string& symbol) const { #if !defined(NO_DLFCN) && !defined(_WIN32) && !defined(_WIN64) dlerror(); @@ -128,7 +128,7 @@ const std::string& library::extension() throw() } library* library::loading() throw() { return currently_loading; } -void library::set_loading(library* lib) throw(std::bad_alloc) { currently_loading = lib; } +void library::set_loading(library* lib) { currently_loading = lib; } namespace { @@ -183,7 +183,7 @@ module::module(const module& mod) } } -void* module::operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error) +void* module::operator[](const std::string& symbol) const { if(dynamic) return lib[symbol]; diff --git a/src/library/lua-framebuffer.cpp b/src/library/lua-framebuffer.cpp index b0049078..738dbe68 100644 --- a/src/library/lua-framebuffer.cpp +++ b/src/library/lua-framebuffer.cpp @@ -4,8 +4,7 @@ namespace lua { -framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname) throw(std::bad_alloc, - std::runtime_error) +framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname) { if(L.type(index) == LUA_TSTRING) return framebuffer::color(L.get_string(index, fname.c_str())); @@ -18,7 +17,6 @@ framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fna } framebuffer::color get_fb_color(lua::state& L, int index, const std::string& fname, int64_t dflt) - throw(std::bad_alloc, std::runtime_error) { if(L.type(index) == LUA_TSTRING) return framebuffer::color(L.get_string(index, fname.c_str())); diff --git a/src/library/lua.cpp b/src/library/lua.cpp index 8c6457ca..ed7001e9 100644 --- a/src/library/lua.cpp +++ b/src/library/lua.cpp @@ -312,7 +312,7 @@ namespace } } -state::state() throw(std::bad_alloc) +state::state() { master = NULL; lua_handle = NULL; @@ -464,7 +464,7 @@ bool state::charge_memory(size_t amount, bool release) } } -function::function(function_group& _group, const std::string& func) throw(std::bad_alloc) +function::function(function_group& _group, const std::string& func) : group(_group) { group.do_register(fname = func, *this); @@ -487,7 +487,7 @@ class_base::~class_base() throw() group.do_unregister(name, *this); } -void state::reset() throw(std::bad_alloc, std::runtime_error) +void state::reset() { if(master) return master->reset(); diff --git a/src/library/memorysearch.cpp b/src/library/memorysearch.cpp index b7fc6606..fd093d42 100644 --- a/src/library/memorysearch.cpp +++ b/src/library/memorysearch.cpp @@ -6,7 +6,7 @@ #include "int24.hpp" #include -memory_search::memory_search(memory_space& space) throw(std::bad_alloc) +memory_search::memory_search(memory_space& space) : mspace(space) { candidates = 0; @@ -455,7 +455,7 @@ uint64_t memory_search::get_candidate_count() throw() return candidates; } -std::list memory_search::get_candidates() throw(std::bad_alloc) +std::list memory_search::get_candidates() { std::list out; auto t = mspace.lookup_linear(0); @@ -563,7 +563,7 @@ uint64_t memory_search::cycle_candidate_vma(uint64_t addr, bool next) throw() return addr; } -void memory_search::reset() throw(std::bad_alloc) +void memory_search::reset() { uint64_t linearram = mspace.get_linear_size(); previous_content.resize(linearram); diff --git a/src/library/memorywatch-fb.cpp b/src/library/memorywatch-fb.cpp index fa4b47d7..6c3470cc 100644 --- a/src/library/memorywatch-fb.cpp +++ b/src/library/memorywatch-fb.cpp @@ -27,7 +27,7 @@ namespace ~fb_object() throw(); void operator()(struct framebuffer::fb& scr) throw(); void operator()(struct framebuffer::fb& scr) throw(); - void clone(framebuffer::queue& q) const throw(std::bad_alloc); + void clone(framebuffer::queue& q) const; private: template void draw(struct framebuffer::fb& scr) throw(); params p; @@ -44,7 +44,7 @@ namespace void fb_object::operator()(struct framebuffer::fb& scr) throw() { draw(scr); } void fb_object::operator()(struct framebuffer::fb& scr) throw() { draw(scr); } - void fb_object::clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void fb_object::clone(framebuffer::queue& q) const { q.clone_helper(this); } template void fb_object::draw(struct framebuffer::fb& scr) throw() { diff --git a/src/library/messagebuffer.cpp b/src/library/messagebuffer.cpp index 543e297c..6cd2e3f8 100644 --- a/src/library/messagebuffer.cpp +++ b/src/library/messagebuffer.cpp @@ -4,7 +4,7 @@ messagebuffer::update_handler::~update_handler() throw() { } -messagebuffer::messagebuffer(size_t maxmessages, size_t windowsize) throw(std::bad_alloc, std::logic_error) +messagebuffer::messagebuffer(size_t maxmessages, size_t windowsize) { if(windowsize > maxmessages) throw std::logic_error("Invalid window size"); @@ -22,7 +22,7 @@ messagebuffer::messagebuffer(size_t maxmessages, size_t windowsize) throw(std::b next_message_number_at_freeze = 0; } -void messagebuffer::add_message(const std::string& msg) throw(std::bad_alloc, std::runtime_error) +void messagebuffer::add_message(const std::string& msg) { messages_buf[next_message_number++] = msg; //If too many messages, erase one. @@ -41,7 +41,7 @@ void messagebuffer::add_message(const std::string& msg) throw(std::bad_alloc, st send_notifications(); } -const std::string& messagebuffer::get_message(size_t msgnum) throw(std::bad_alloc, std::logic_error) +const std::string& messagebuffer::get_message(size_t msgnum) { if(!messages_buf.count(msgnum)) throw std::logic_error("Invalid message number"); @@ -113,7 +113,7 @@ bool messagebuffer::unfreeze_updates() throw() return false; } -void messagebuffer::scroll_beginning() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_beginning() { if(window_start == first_present_message) return; @@ -121,7 +121,7 @@ void messagebuffer::scroll_beginning() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::scroll_up_page() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_up_page() { if(window_start == first_present_message) return; @@ -132,7 +132,7 @@ void messagebuffer::scroll_up_page() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::scroll_up_line() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_up_line() { if(window_start == first_present_message) return; @@ -140,7 +140,7 @@ void messagebuffer::scroll_up_line() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::scroll_down_line() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_down_line() { if(window_start + window_size >= next_message_number) return; @@ -148,7 +148,7 @@ void messagebuffer::scroll_down_line() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::scroll_down_page() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_down_page() { if(window_start + window_size >= next_message_number) return; @@ -158,7 +158,7 @@ void messagebuffer::scroll_down_page() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::scroll_end() throw(std::bad_alloc, std::runtime_error) +void messagebuffer::scroll_end() { if(first_present_message + window_size > next_message_number) return; @@ -166,7 +166,7 @@ void messagebuffer::scroll_end() throw(std::bad_alloc, std::runtime_error) send_notifications(); } -void messagebuffer::register_handler(messagebuffer::update_handler& handler) throw(std::bad_alloc) +void messagebuffer::register_handler(messagebuffer::update_handler& handler) { handlers.insert(&handler); } @@ -176,7 +176,7 @@ void messagebuffer::unregister_handler(messagebuffer::update_handler& handler) t handlers.erase(&handler); } -void messagebuffer::set_max_window_size(size_t windowsize) throw(std::bad_alloc, std::logic_error) +void messagebuffer::set_max_window_size(size_t windowsize) { if(windowsize > max_messages) throw std::logic_error("Invalid window size"); diff --git a/src/library/movie.cpp b/src/library/movie.cpp index efeabbff..c8b4bd56 100644 --- a/src/library/movie.cpp +++ b/src/library/movie.cpp @@ -34,22 +34,22 @@ void movie::set_all_DRDY() throw() pollcounters.set_all_DRDY(); } -std::string movie::rerecord_count() throw(std::bad_alloc) +std::string movie::rerecord_count() { return rerecords; } -void movie::rerecord_count(const std::string& count) throw(std::bad_alloc) +void movie::rerecord_count(const std::string& count) { rerecords = count; } -std::string movie::project_id() throw(std::bad_alloc) +std::string movie::project_id() { return _project_id; } -void movie::project_id(const std::string& id) throw(std::bad_alloc) +void movie::project_id(const std::string& id) { _project_id = id; } @@ -99,7 +99,7 @@ uint64_t movie::get_lag_frames() throw() return lag_frames; } -void movie::next_frame() throw(std::bad_alloc) +void movie::next_frame() { //Adjust lag count. Frame 0 MUST NOT be considered lag. bool pflag = pflag_handler ? pflag_handler->get_pflag() : false; @@ -133,12 +133,12 @@ void movie::next_frame() throw(std::bad_alloc) current_frame++; } -bool movie::get_DRDY(unsigned port, unsigned controller, unsigned ctrl) throw(std::logic_error) +bool movie::get_DRDY(unsigned port, unsigned controller, unsigned ctrl) { return pollcounters.get_DRDY(port, controller, ctrl); } -short movie::next_input(unsigned port, unsigned controller, unsigned ctrl) throw(std::bad_alloc, std::logic_error) +short movie::next_input(unsigned port, unsigned controller, unsigned ctrl) { pollcounters.clear_DRDY(port, controller, ctrl); @@ -193,7 +193,7 @@ short movie::next_input(unsigned port, unsigned controller, unsigned ctrl) throw } } -movie::movie() throw(std::bad_alloc) +movie::movie() : _listener(*this), tracker(memtracker::singleton(), movie_id, sizeof(*this)) { movie_data = NULL; @@ -209,7 +209,6 @@ movie::movie() throw(std::bad_alloc) } void movie::load(const std::string& rerecs, const std::string& project_id, portctrl::frame_vector& input) - throw(std::bad_alloc, std::runtime_error) { if(input.size() > 0 && !input[0].sync()) throw std::runtime_error("First subframe MUST have frame sync flag set"); @@ -231,7 +230,7 @@ unsigned movie::next_poll_number() return pollcounters.max_polls() + 1; } -void movie::readonly_mode(bool enable) throw(std::bad_alloc) +void movie::readonly_mode(bool enable) { bool was_in_readonly = readonly; readonly = enable; @@ -275,7 +274,6 @@ void movie::readonly_mode(bool enable) throw(std::bad_alloc) //Save state of movie code. void movie::save_state(std::string& proj_id, uint64_t& curframe, uint64_t& lagframes, std::vector& pcounters) - throw(std::bad_alloc) { pollcounters.save_state(pcounters); proj_id = _project_id; @@ -285,8 +283,7 @@ void movie::save_state(std::string& proj_id, uint64_t& curframe, uint64_t& lagfr //Restore state of movie code. Throws if state is invalid. Flag gives new state of readonly flag. size_t movie::restore_state(uint64_t curframe, uint64_t lagframe, const std::vector& pcounters, bool ro, - portctrl::frame_vector* old_movie, const std::string& old_projectid) throw(std::bad_alloc, - std::runtime_error) + portctrl::frame_vector* old_movie, const std::string& old_projectid) { if(!pollcounters.check(pcounters)) throw std::runtime_error("Wrong number of poll counters"); diff --git a/src/library/ogg.cpp b/src/library/ogg.cpp index c907522b..69eea6e0 100644 --- a/src/library/ogg.cpp +++ b/src/library/ogg.cpp @@ -420,7 +420,7 @@ page::page() throw() memset(packets, 0, sizeof(packets)); } -page::page(const char* buffer, size_t& advance) throw(std::runtime_error) +page::page(const char* buffer, size_t& advance) { //Check validity of page header. if(buffer[0] != 'O' || buffer[1] != 'g' || buffer[2] != 'g' || buffer[3] != 'S') @@ -551,12 +551,12 @@ bool page::scan(const char* buffer, size_t bufferlen, bool eof, size_t& advance) return false; } -std::string page::stream_debug_id() const throw(std::bad_alloc) +std::string page::stream_debug_id() const { return (stringfmt() << "Stream " << hex::to(stream)).str(); } -std::string page::page_debug_id() const throw(std::bad_alloc) +std::string page::page_debug_id() const { return (stringfmt() << stream_debug_id() << " page " << sequence).str(); } @@ -670,7 +670,7 @@ void stream_reader::set_errors_to(std::ostream& os) errors_to = &os; } -bool stream_reader::get_page(page& spage) throw(std::exception) +bool stream_reader::get_page(page& spage) { size_t advance; bool f; @@ -719,7 +719,7 @@ stream_writer::~stream_writer() throw() { } -void stream_writer::put_page(const page& page) throw(std::exception) +void stream_writer::put_page(const page& page) { char buffer[65536]; size_t s = page.serialize_size(); @@ -736,7 +736,7 @@ stream_reader_iostreams::~stream_reader_iostreams() throw() { } -size_t stream_reader_iostreams::read(char* buffer, size_t size) throw(std::exception) +size_t stream_reader_iostreams::read(char* buffer, size_t size) { if(!is) return 0; @@ -753,7 +753,7 @@ stream_writer_iostreams::~stream_writer_iostreams() throw() { } -void stream_writer_iostreams::write(const char* buffer, size_t size) throw(std::exception) +void stream_writer_iostreams::write(const char* buffer, size_t size) { if(!os) throw std::runtime_error("Error writing data"); diff --git a/src/library/opus-ogg.cpp b/src/library/opus-ogg.cpp index cf3e144d..47ce345d 100644 --- a/src/library/opus-ogg.cpp +++ b/src/library/opus-ogg.cpp @@ -6,7 +6,7 @@ namespace opus { -void ogg_header::parse(struct ogg::packet& packet) throw(std::runtime_error) +void ogg_header::parse(struct ogg::packet& packet) { struct ogg_header h; if(!packet.get_atomic()) @@ -53,7 +53,7 @@ void ogg_header::parse(struct ogg::packet& packet) throw(std::runtime_error) *this = h; } -void ogg_tags::parse(struct ogg::packet& packet) throw(std::bad_alloc, std::runtime_error) +void ogg_tags::parse(struct ogg::packet& packet) { struct ogg_tags h; if(!packet.get_first_page() || !packet.get_last_page()) @@ -90,7 +90,7 @@ void ogg_tags::parse(struct ogg::packet& packet) throw(std::bad_alloc, std::runt *this = h; } -ogg::page ogg_header::serialize() throw(std::runtime_error) +ogg::page ogg_header::serialize() { struct ogg::page page; unsigned char buffer[276]; @@ -128,7 +128,7 @@ ogg::page ogg_header::serialize() throw(std::runtime_error) } uint32_t ogg_tags::serialize(std::function output, - uint32_t strmid) throw(std::bad_alloc, std::runtime_error) + uint32_t strmid) { size_t needed = 8; needed += vendor.length(); diff --git a/src/library/portctrl-data.cpp b/src/library/portctrl-data.cpp index 479138a7..de49f145 100644 --- a/src/library/portctrl-data.cpp +++ b/src/library/portctrl-data.cpp @@ -78,7 +78,7 @@ type& get_default_system_port_type() return x; } -type::type(const std::string& iname, const std::string& _hname, size_t ssize) throw(std::bad_alloc) +type::type(const std::string& iname, const std::string& _hname, size_t ssize) : hname(_hname), storage_size(ssize), name(iname) { } @@ -138,7 +138,6 @@ type_set::type_set() throw() } type_set& type_set::make(std::vector types, struct index_map control_map) - throw(std::bad_alloc, std::runtime_error) { for(auto i : bindings()) if(i.matches(types)) @@ -315,21 +314,21 @@ void frame::display(unsigned port, unsigned controller_n, char32_t* buf) throw() *buf = '\0'; } -counters::counters() throw(std::bad_alloc) +counters::counters() { types = &dummytypes(); ctrs = new uint32_t[types->indices()]; clear(); } -counters::counters(const type_set& p) throw(std::bad_alloc) +counters::counters(const type_set& p) { types = &p; ctrs = new uint32_t[types->indices()]; clear(); } -counters::counters(const counters& p) throw(std::bad_alloc) +counters::counters(const counters& p) { ctrs = new uint32_t[p.types->indices()]; types = p.types; @@ -337,7 +336,7 @@ counters::counters(const counters& p) throw(std::bad_alloc) framepflag = p.framepflag; } -counters& counters::operator=(const counters& p) throw(std::bad_alloc) +counters& counters::operator=(const counters& p) { if(this == &p) return *this; @@ -407,7 +406,7 @@ uint32_t counters::max_polls() throw() return max; } -void counters::save_state(std::vector& mem) throw(std::bad_alloc) +void counters::save_state(std::vector& mem) { mem.resize(types->indices()); //Compatiblity fun. @@ -437,7 +436,7 @@ bool counters::get_framepflag() const throw() return framepflag; } -frame::frame(const type_set& p) throw(std::runtime_error) +frame::frame(const type_set& p) { memset(memory, 0, sizeof(memory)); backing = memory; @@ -446,7 +445,6 @@ frame::frame(const type_set& p) throw(std::runtime_error) } frame::frame(unsigned char* mem, const type_set& p, frame_vector* _host) - throw(std::runtime_error) { if(!mem) throw std::runtime_error("NULL backing memory not allowed"); @@ -465,7 +463,7 @@ frame::frame(const frame& obj) throw() host = NULL; } -frame& frame::operator=(const frame& obj) throw(std::runtime_error) +frame& frame::operator=(const frame& obj) { if(backing != memory && types != obj.types) throw std::runtime_error("Port types do not match"); @@ -540,7 +538,7 @@ size_t frame_vector::recount_frames() throw() return ret; } -void frame_vector::clear(const type_set& p) throw(std::runtime_error) +void frame_vector::clear(const type_set& p) { uint64_t old_frame_count = real_frame_count; frame_size = p.size(); @@ -575,7 +573,7 @@ frame_vector::frame_vector(const type_set& p) throw() clear(p); } -void frame_vector::append(frame cframe) throw(std::bad_alloc, std::runtime_error) +void frame_vector::append(frame cframe) { frame check(*types); if(!check.types_match(cframe)) @@ -596,7 +594,7 @@ void frame_vector::append(frame cframe) throw(std::bad_alloc, std::runtime_error frames++; } -frame_vector::frame_vector(const frame_vector& vector) throw(std::bad_alloc) +frame_vector::frame_vector(const frame_vector& vector) : tracker(memtracker::singleton(), movie_page_id, sizeof(*this)) { real_frame_count = 0; @@ -606,7 +604,6 @@ frame_vector::frame_vector(const frame_vector& vector) throw(std::bad_alloc) } frame_vector& frame_vector::operator=(const frame_vector& v) - throw(std::bad_alloc) { if(this == &v) return *this; @@ -631,7 +628,7 @@ frame_vector& frame_vector::operator=(const frame_vector& v) return *this; } -void frame_vector::resize(size_t newsize) throw(std::bad_alloc) +void frame_vector::resize(size_t newsize) { clear_cache(); if(newsize == 0) { @@ -747,7 +744,7 @@ uint64_t frame_vector::binary_size() const throw() return size() * get_stride(); } -void frame_vector::save_binary(binarystream::output& stream) const throw(std::runtime_error) +void frame_vector::save_binary(binarystream::output& stream) const { uint64_t stride = get_stride(); uint64_t pageframes = get_frames_per_page(); @@ -762,7 +759,7 @@ void frame_vector::save_binary(binarystream::output& stream) const throw(std::ru } } -void frame_vector::load_binary(binarystream::input& stream) throw(std::bad_alloc, std::runtime_error) +void frame_vector::load_binary(binarystream::input& stream) { uint64_t stride = get_stride(); uint64_t pageframes = get_frames_per_page(); diff --git a/src/library/portctrl-parse.cpp b/src/library/portctrl-parse.cpp index 443ba9a2..232205a1 100644 --- a/src/library/portctrl-parse.cpp +++ b/src/library/portctrl-parse.cpp @@ -680,7 +680,7 @@ ser_nothing: return DESERIALIZE_SPECIAL_BLANK; } -type_generic::type_generic(const JSON::node& root, const std::string& ptr) throw(std::exception) +type_generic::type_generic(const JSON::node& root, const std::string& ptr) : type(port_iname(root, ptr), port_hname(root, ptr), port_size(root, ptr)) { controller_info = pcs_parse_set(root, ptr); diff --git a/src/library/rrdata.cpp b/src/library/rrdata.cpp index a4c7e686..78463b96 100644 --- a/src/library/rrdata.cpp +++ b/src/library/rrdata.cpp @@ -108,7 +108,7 @@ rrdata_set::rrdata_set() throw() handle_open = false; } -void rrdata_set::read_base(const std::string& projectfile, bool lazy) throw(std::bad_alloc) +void rrdata_set::read_base(const std::string& projectfile, bool lazy) { if(projectfile == current_projectfile && (!lazy_mode || lazy)) return; @@ -171,7 +171,7 @@ void rrdata_set::close() throw() handle_open = false; } -void rrdata_set::add(const struct rrdata_set::instance& i) throw(std::bad_alloc) +void rrdata_set::add(const struct rrdata_set::instance& i) { if(_add(i) && handle_open) { //std::cerr << "New symbol: " << i << std::endl; @@ -258,7 +258,7 @@ uint64_t rrdata_set::emerg_action(struct rrdata_set::esave_state& state, char* b return rsize; } -uint64_t rrdata_set::write(std::vector& strm) throw(std::bad_alloc) +uint64_t rrdata_set::write(std::vector& strm) { uint64_t scount = 0; esave_state cstate; @@ -281,7 +281,6 @@ uint64_t rrdata_set::write(std::vector& strm) throw(std::bad_alloc) namespace { uint64_t read_set(std::vector& strm, std::function fn) - throw(std::bad_alloc) { uint64_t scount = 0; rrdata_set::instance decoding; @@ -321,7 +320,7 @@ namespace } } -uint64_t rrdata_set::read(std::vector& strm) throw(std::bad_alloc) +uint64_t rrdata_set::read(std::vector& strm) { return read_set(strm, [this](instance& d, unsigned rep) { bool any = false; @@ -340,7 +339,7 @@ uint64_t rrdata_set::read(std::vector& strm) throw(std::bad_alloc) }); } -uint64_t rrdata_set::count(std::vector& strm) throw(std::bad_alloc) +uint64_t rrdata_set::count(std::vector& strm) { return read_set(strm, [](instance& d, unsigned rep) {}); } diff --git a/src/library/settingvar.cpp b/src/library/settingvar.cpp index 254e39c0..6631bccf 100644 --- a/src/library/settingvar.cpp +++ b/src/library/settingvar.cpp @@ -38,7 +38,7 @@ set::listener::~listener() { } -group::group() throw(std::bad_alloc) +group::group() : _listener(*this) { } @@ -55,7 +55,7 @@ group::~group() throw() group_internal_t::clear(this); } -std::set group::get_settings_set() throw(std::bad_alloc) +std::set group::get_settings_set() { threads::arlock h(get_setting_lock()); auto state = group_internal_t::get_soft(this); @@ -92,14 +92,14 @@ void group::fire_listener(base& var) throw() } } -void group::add_listener(struct listener& listener) throw(std::bad_alloc) +void group::add_listener(struct listener& listener) { threads::arlock h(get_setting_lock()); auto& state = group_internal_t::get(this); state.listeners.insert(&listener); } -void group::remove_listener(struct listener& listener) throw(std::bad_alloc) +void group::remove_listener(struct listener& listener) { threads::arlock h(get_setting_lock()); auto state = group_internal_t::get_soft(this); @@ -107,7 +107,7 @@ void group::remove_listener(struct listener& listener) throw(std::bad_alloc) state->listeners.erase(&listener); } -void group::do_register(const std::string& name, base& _setting) throw(std::bad_alloc) +void group::do_register(const std::string& name, base& _setting) { threads::arlock h(get_setting_lock()); auto& state = group_internal_t::get(this); @@ -115,7 +115,7 @@ void group::do_register(const std::string& name, base& _setting) throw(std::bad_ state.settings[name] = &_setting; } -void group::do_unregister(const std::string& name, base& _setting) throw(std::bad_alloc) +void group::do_unregister(const std::string& name, base& _setting) { threads::arlock h(get_setting_lock()); auto state = group_internal_t::get_soft(this); @@ -123,7 +123,7 @@ void group::do_unregister(const std::string& name, base& _setting) throw(std::ba state->settings.erase(name); } -void group::add_set(set& s) throw(std::bad_alloc) +void group::add_set(set& s) { threads::arlock u(get_setting_lock()); auto& state = group_internal_t::get(this); @@ -226,7 +226,7 @@ void set::do_unregister(const std::string& name, superbase& info) i->destroy(*this, name); } -void set::add_callback(set::listener& listener) throw(std::bad_alloc) +void set::add_callback(set::listener& listener) { threads::arlock u(get_setting_lock()); auto& state = set_internal_t::get(this); @@ -250,7 +250,6 @@ void set::drop_callback(set::listener& listener) } base::base(group& _group, const std::string& _iname, const std::string& _hname, bool dynamic) - throw(std::bad_alloc) : sgroup(&_group), iname(_iname), hname(_hname), is_dynamic(dynamic) { sgroup->do_register(iname, *this); @@ -270,7 +269,7 @@ void base::group_died() if(is_dynamic) delete this; } -void superbase::_superbase(set& _s, const std::string& _iname) throw(std::bad_alloc) +void superbase::_superbase(set& _s, const std::string& _iname) { s = &_s; iname = _iname; @@ -311,7 +310,6 @@ std::set cache::get_keys() } void cache::set(const std::string& name, const std::string& value, bool allow_invalid) - throw(std::bad_alloc, std::runtime_error) { try { grp[name].str(value); @@ -328,18 +326,17 @@ void cache::set(const std::string& name, const std::string& value, bool allow_in } } -std::string cache::get(const std::string& name) throw(std::bad_alloc, std::runtime_error) +std::string cache::get(const std::string& name) { return grp[name].str(); } -const description& cache::get_description(const std::string& name) throw(std::bad_alloc, - std::runtime_error) +const description& cache::get_description(const std::string& name) { return grp[name].get_description(); } -std::string cache::get_hname(const std::string& name) throw(std::bad_alloc, std::runtime_error) +std::string cache::get_hname(const std::string& name) { return grp[name].get_hname(); } diff --git a/src/library/skein.cpp b/src/library/skein.cpp index 3dad0c7f..ac05051e 100644 --- a/src/library/skein.cpp +++ b/src/library/skein.cpp @@ -100,7 +100,7 @@ inline static void _skein1024_compress(uint64_t* a, const uint64_t* b, const uin #endif } -hash::hash(hash::variant v, uint64_t _outbits) throw(std::runtime_error) +hash::hash(hash::variant v, uint64_t _outbits) { memset(chain, 0, sizeof(chain)); memset(buffer, 0, sizeof(buffer)); @@ -163,7 +163,7 @@ void hash::typechange(uint8_t newtype) } } -void hash::write(const uint8_t* data, size_t datalen, hash::datatype type) throw(std::runtime_error) +void hash::write(const uint8_t* data, size_t datalen, hash::datatype type) { if(type < 0 || type == 4 || type > 62) throw std::runtime_error("Invalid data type to write"); @@ -260,7 +260,7 @@ void prng::write(const void* buffer, size_t size) throw() _is_seeded = true; } -void prng::read(void* buffer, size_t size) throw(std::runtime_error) +void prng::read(void* buffer, size_t size) { if(!_is_seeded) throw std::runtime_error("PRNG is not initialized"); diff --git a/src/library/string.cpp b/src/library/string.cpp index a06e31a3..196a65bb 100644 --- a/src/library/string.cpp +++ b/src/library/string.cpp @@ -91,8 +91,7 @@ std::pair regex_results::match(size_t i) const return matches[i]; } -regex_results regex(const std::string& regexp, const std::string& str, const char* ex) throw(std::bad_alloc, - std::runtime_error) +regex_results regex(const std::string& regexp, const std::string& str, const char* ex) { static threads::lock m; threads::alock h(m); @@ -128,7 +127,6 @@ regex_results regex(const std::string& regexp, const std::string& str, const cha } bool regex_match(const std::string& regexp, const std::string& str, enum regex_match_mode mode) - throw(std::bad_alloc, std::runtime_error) { static threads::lock m; static std::map> regexps; @@ -366,7 +364,6 @@ template void token_iterator::ctor_eos() } template void token_iterator::ctor_itr(std::initializer_list sep, bool whole_sequence) - throw(std::bad_alloc) { whole_seq = whole_sequence; is_end_iterator = false; @@ -398,14 +395,14 @@ template const std::basic_string& token_iterator::dereference( return tmp; } -template token_iterator token_iterator::postincrement() throw(std::bad_alloc) +template token_iterator token_iterator::postincrement() { token_iterator t = *this; ++*this; return t; } -template token_iterator& token_iterator::preincrement() throw(std::bad_alloc) +template token_iterator& token_iterator::preincrement() { bidx = eidx + is_sep(eidx); load_helper(); diff --git a/src/library/triplebuffer.cpp b/src/library/triplebuffer.cpp index 858aa40b..035595de 100644 --- a/src/library/triplebuffer.cpp +++ b/src/library/triplebuffer.cpp @@ -28,7 +28,7 @@ unsigned logic::get_read() throw() } } -void logic::put_read() throw(std::logic_error) +void logic::put_read() { threads::alock h(lock); if(!count_read) throw std::logic_error("Internal error: put_read() with 0 counter"); @@ -52,7 +52,7 @@ unsigned logic::get_write() throw() } } -void logic::put_write() throw(std::logic_error) +void logic::put_write() { threads::alock h(lock); if(!count_write) throw std::logic_error("Internal error: put_write() with 0 counter"); diff --git a/src/library/zip.cpp b/src/library/zip.cpp index c5c5776b..56355ed2 100644 --- a/src/library/zip.cpp +++ b/src/library/zip.cpp @@ -261,7 +261,7 @@ bool reader::has_member(const std::string& name) throw() return (offsets.count(name) > 0); } -std::string reader::find_first() throw(std::bad_alloc) +std::string reader::find_first() { if(offsets.empty()) return ""; @@ -269,7 +269,7 @@ std::string reader::find_first() throw(std::bad_alloc) return offsets.begin()->first; } -std::string reader::find_next(const std::string& name) throw(std::bad_alloc) +std::string reader::find_next(const std::string& name) { auto i = offsets.upper_bound(name); if(i == offsets.end()) @@ -278,7 +278,7 @@ std::string reader::find_next(const std::string& name) throw(std::bad_alloc) return i->first; } -std::istream& reader::operator[](const std::string& name) throw(std::bad_alloc, std::runtime_error) +std::istream& reader::operator[](const std::string& name) { if(!offsets.count(name)) throw std::runtime_error("No such file '" + name + "' in zip archive"); @@ -306,22 +306,22 @@ std::istream& reader::operator[](const std::string& name) throw(std::bad_alloc, throw std::runtime_error("Unsupported ZIP feature: Unsupported compression method"); } -reader::iterator reader::begin() throw(std::bad_alloc) +reader::iterator reader::begin() { return iterator(offsets.begin()); } -reader::iterator reader::end() throw(std::bad_alloc) +reader::iterator reader::end() { return iterator(offsets.end()); } -reader::riterator reader::rbegin() throw(std::bad_alloc) +reader::riterator reader::rbegin() { return riterator(offsets.rbegin()); } -reader::riterator reader::rend() throw(std::bad_alloc) +reader::riterator reader::rend() { return riterator(offsets.rend()); } @@ -334,7 +334,7 @@ reader::~reader() throw() } } -reader::reader(const std::string& zipfile) throw(std::bad_alloc, std::runtime_error) +reader::reader(const std::string& zipfile) { if(!directory::is_regular(zipfile)) throw std::runtime_error("Zipfile '" + zipfile + "' is not regular file"); @@ -367,7 +367,6 @@ reader::reader(const std::string& zipfile) throw(std::bad_alloc, std::runtime_er } bool reader::read_linefile(const std::string& member, std::string& out, bool conditional) - throw(std::bad_alloc, std::runtime_error) { if(conditional && !has_member(member)) return false; @@ -383,8 +382,7 @@ bool reader::read_linefile(const std::string& member, std::string& out, bool con return true; } -void reader::read_raw_file(const std::string& member, std::vector& out) throw(std::bad_alloc, - std::runtime_error) +void reader::read_raw_file(const std::string& member, std::vector& out) { std::vector _out; std::istream& m = (*this)[member]; @@ -399,7 +397,7 @@ void reader::read_raw_file(const std::string& member, std::vector& out) th out = _out; } -writer::writer(const std::string& zipfile, unsigned _compression) throw(std::bad_alloc, std::runtime_error) +writer::writer(const std::string& zipfile, unsigned _compression) { compression = _compression; zipfile_path = zipfile; @@ -411,7 +409,7 @@ writer::writer(const std::string& zipfile, unsigned _compression) throw(std::bad system_stream = true; } -writer::writer(std::ostream& stream, unsigned _compression) throw(std::bad_alloc, std::runtime_error) +writer::writer(std::ostream& stream, unsigned _compression) { compression = _compression; zipstream = &stream; @@ -427,7 +425,7 @@ writer::~writer() throw() delete zipstream; } -void writer::commit() throw(std::bad_alloc, std::logic_error, std::runtime_error) +void writer::commit() { if(committed) throw std::logic_error("Can't commit twice"); @@ -485,8 +483,7 @@ void writer::commit() throw(std::bad_alloc, std::logic_error, std::runtime_error committed = true; } -std::ostream& writer::create_file(const std::string& name) throw(std::bad_alloc, std::logic_error, - std::runtime_error) +std::ostream& writer::create_file(const std::string& name) { if(open_file != "") throw std::logic_error("Can't open file with file open"); @@ -505,7 +502,7 @@ std::ostream& writer::create_file(const std::string& name) throw(std::bad_alloc, return *s; } -void writer::close_file() throw(std::bad_alloc, std::logic_error, std::runtime_error) +void writer::close_file() { if(open_file == "") throw std::logic_error("Can't close file with no file open"); @@ -548,7 +545,6 @@ void writer::close_file() throw(std::bad_alloc, std::logic_error, std::runtime_e } void writer::write_linefile(const std::string& member, const std::string& value, bool conditional) - throw(std::bad_alloc, std::runtime_error) { if(conditional && value == "") return; @@ -562,8 +558,7 @@ void writer::write_linefile(const std::string& member, const std::string& value, } } -void writer::write_raw_file(const std::string& member, const std::vector& content) throw(std::bad_alloc, - std::runtime_error) +void writer::write_raw_file(const std::string& member, const std::vector& content) { std::ostream& m = create_file(member); try { @@ -677,14 +672,12 @@ namespace } } -std::string resolverel(const std::string& name, const std::string& referencing_path) throw(std::bad_alloc, - std::runtime_error) +std::string resolverel(const std::string& name, const std::string& referencing_path) { return combine_path(name, referencing_path); } -std::istream& openrel(const std::string& name, const std::string& referencing_path) throw(std::bad_alloc, - std::runtime_error) +std::istream& openrel(const std::string& name, const std::string& referencing_path) { std::string path_to_open = combine_path(name, referencing_path); std::string final_path = path_to_open; @@ -719,8 +712,7 @@ std::istream& openrel(const std::string& name, const std::string& referencing_pa } } -std::vector readrel(const std::string& name, const std::string& referencing_path) throw(std::bad_alloc, - std::runtime_error) +std::vector readrel(const std::string& name, const std::string& referencing_path) { std::vector out; std::istream& s = openrel(name, referencing_path); @@ -730,7 +722,7 @@ std::vector readrel(const std::string& name, const std::string& referencin return out; } -bool file_exists(const std::string& name) throw(std::bad_alloc) +bool file_exists(const std::string& name) { std::string path_to_open = name; std::string final_path = path_to_open; diff --git a/src/lua/gui-arrow.cpp b/src/lua/gui-arrow.cpp index 5d43aee0..f20670a5 100644 --- a/src/lua/gui-arrow.cpp +++ b/src/lua/gui-arrow.cpp @@ -45,7 +45,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: std::pair offsetrange() { diff --git a/src/lua/gui-bitmap.cpp b/src/lua/gui-bitmap.cpp index 24e8901d..6ea2fb2b 100644 --- a/src/lua/gui-bitmap.cpp +++ b/src/lua/gui-bitmap.cpp @@ -134,7 +134,7 @@ namespace } void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-box.cpp b/src/lua/gui-box.cpp index 666008de..918bea8a 100644 --- a/src/lua/gui-box.cpp +++ b/src/lua/gui-box.cpp @@ -35,7 +35,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-circle.cpp b/src/lua/gui-circle.cpp index 5d5ca623..eed0610c 100644 --- a/src/lua/gui-circle.cpp +++ b/src/lua/gui-circle.cpp @@ -44,7 +44,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-crosshair.cpp b/src/lua/gui-crosshair.cpp index b81ecacd..46d1f95f 100644 --- a/src/lua/gui-crosshair.cpp +++ b/src/lua/gui-crosshair.cpp @@ -26,7 +26,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-line.cpp b/src/lua/gui-line.cpp index 0de3cd6d..a20cc5e4 100644 --- a/src/lua/gui-line.cpp +++ b/src/lua/gui-line.cpp @@ -81,7 +81,7 @@ nodraw2: } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x1; int32_t y1; diff --git a/src/lua/gui-pixel.cpp b/src/lua/gui-pixel.cpp index 8a92f1a2..19883ff1 100644 --- a/src/lua/gui-pixel.cpp +++ b/src/lua/gui-pixel.cpp @@ -22,7 +22,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-rectangle.cpp b/src/lua/gui-rectangle.cpp index befbac3e..4620ccd9 100644 --- a/src/lua/gui-rectangle.cpp +++ b/src/lua/gui-rectangle.cpp @@ -32,7 +32,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-text-cf.cpp b/src/lua/gui-text-cf.cpp index cc31cc53..4c2ab686 100644 --- a/src/lua/gui-text-cf.cpp +++ b/src/lua/gui-text-cf.cpp @@ -101,7 +101,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-text.cpp b/src/lua/gui-text.cpp index 74d344ec..e94512ec 100644 --- a/src/lua/gui-text.cpp +++ b/src/lua/gui-text.cpp @@ -47,7 +47,7 @@ namespace } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } void operator()(struct framebuffer::fb& scr) throw() { op(scr); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/gui-tilemap.cpp b/src/lua/gui-tilemap.cpp index 775ea844..4f546046 100644 --- a/src/lua/gui-tilemap.cpp +++ b/src/lua/gui-tilemap.cpp @@ -222,7 +222,7 @@ namespace } void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } void operator()(struct framebuffer::fb& x) throw() { composite_op(x); } - void clone(framebuffer::queue& q) const throw(std::bad_alloc) { q.clone_helper(this); } + void clone(framebuffer::queue& q) const { q.clone_helper(this); } private: int32_t x; int32_t y; diff --git a/src/lua/ibind.cpp b/src/lua/ibind.cpp index ae127861..7abe08e8 100644 --- a/src/lua/ibind.cpp +++ b/src/lua/ibind.cpp @@ -29,7 +29,7 @@ public: L.pushvalue(idx); L.rawset(LUA_REGISTRYINDEX); } - void invoke(const std::string& arguments) throw(std::bad_alloc, std::runtime_error) + void invoke(const std::string& arguments) { L.pushlightuserdata(this); L.rawget(LUA_REGISTRYINDEX); diff --git a/src/lua/lua.cpp b/src/lua/lua.cpp index 97c57f31..e9c1ab21 100644 --- a/src/lua/lua.cpp +++ b/src/lua/lua.cpp @@ -515,7 +515,7 @@ const std::map& lua_state::get_watch_vars() return watch_vars; } -bool lua_state::run_lua_fragment() throw(std::bad_alloc) +bool lua_state::run_lua_fragment() { bool result = true; if(recursive_flag) @@ -565,7 +565,7 @@ bool lua_state::run_lua_fragment() throw(std::bad_alloc) return result; } -void lua_state::do_eval_lua(const std::string& c) throw(std::bad_alloc) +void lua_state::do_eval_lua(const std::string& c) { L.pushlstring(c.c_str(), c.length()); L.setglobal(TEMPORARY); @@ -573,7 +573,7 @@ void lua_state::do_eval_lua(const std::string& c) throw(std::bad_alloc) run_lua_fragment(); } -void lua_state::do_run_lua(const std::string& c) throw(std::bad_alloc) +void lua_state::do_run_lua(const std::string& c) { L.pushlstring(c.c_str(), c.length()); L.setglobal(TEMPORARY); diff --git a/src/lua/memory.cpp b/src/lua/memory.cpp index ea85e24d..c7b7b4fd 100644 --- a/src/lua/memory.cpp +++ b/src/lua/memory.cpp @@ -460,7 +460,7 @@ namespace } command::fnptr<> CMD_callbacks_show_lua(lsnes_cmds, CLUA::scb, - []() throw(std::bad_alloc, std::runtime_error) { + []() { auto& core = CORE(); lua::state& L = *core.lua; lua_debug_callback2* D; diff --git a/src/platform/libao/sound.cpp b/src/platform/libao/sound.cpp index e3c9d831..78afe47e 100644 --- a/src/platform/libao/sound.cpp +++ b/src/platform/libao/sound.cpp @@ -120,7 +120,7 @@ namespace } command::fnptr x(lsnes_cmds, CLIBAOSND::setid, - [](const std::string& value) throw(std::bad_alloc, std::runtime_error) { + [](const std::string& value) { driver_id = parse_value(value); }); diff --git a/src/platform/wxwidgets/main.cpp b/src/platform/wxwidgets/main.cpp index 42506a67..18321d49 100644 --- a/src/platform/wxwidgets/main.cpp +++ b/src/platform/wxwidgets/main.cpp @@ -339,27 +339,27 @@ end: } } -wxString towxstring(const std::string& str) throw(std::bad_alloc) +wxString towxstring(const std::string& str) { return wxString(str.c_str(), wxConvUTF8); } -std::string tostdstring(const wxString& str) throw(std::bad_alloc) +std::string tostdstring(const wxString& str) { return std::string(str.mb_str(wxConvUTF8)); } -wxString towxstring(const std::u32string& str) throw(std::bad_alloc) +wxString towxstring(const std::u32string& str) { return wxString(utf8::to8(str).c_str(), wxConvUTF8); } -std::u32string tou32string(const wxString& str) throw(std::bad_alloc) +std::u32string tou32string(const wxString& str) { return utf8::to32(std::string(str.mb_str(wxConvUTF8))); } -std::string pick_archive_member(wxWindow* parent, const std::string& filename) throw(std::bad_alloc) +std::string pick_archive_member(wxWindow* parent, const std::string& filename) { CHECK_UI_THREAD; //Did we pick a .zip file? diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index 18d0bbf4..9fb5de11 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -1896,7 +1896,7 @@ namespace struct command::stub _exit_fullscreen = {"exit-fullscreen", "Exit fullscreen", "Syntax: exit_fullscreen\nExit fullscreen"}; command::fnptr<> exit_fullscreen(lsnes_cmds, _exit_fullscreen, - []() throw(std::bad_alloc, std::runtime_error) { + []() { runuifun([]() { if(is_fs) main_window->enter_or_leave_fullscreen(false); diff --git a/src/video/avi.cpp b/src/video/avi.cpp index 672677c7..c6b4989a 100644 --- a/src/video/avi.cpp +++ b/src/video/avi.cpp @@ -489,7 +489,7 @@ again: ctor_notify(); } ~adv_avi_dumper() throw(); - std::set list_submodes() throw(std::bad_alloc) + std::set list_submodes() { std::set x; for(auto v = avi_video_codec_type::find_next(NULL); v; v = avi_video_codec_type::find_next(v)) @@ -506,11 +506,11 @@ again: { return ""; //Not interesting } - std::string name() throw(std::bad_alloc) + std::string name() { return "AVI (internal)"; } - std::string modename(const std::string& mode) throw(std::bad_alloc) + std::string modename(const std::string& mode) { avi_video_codec_type* vcodec; avi_audio_codec_type* acodec; @@ -518,7 +518,6 @@ again: return vcodec->get_hname() + std::string(" / ") + acodec->get_hname(); } avi_dumper_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix) - throw(std::bad_alloc, std::runtime_error) { return new avi_dumper_obj(_mdumper, *this, mode, prefix); } diff --git a/src/video/jmd.cpp b/src/video/jmd.cpp index 6359695d..4de5d157 100644 --- a/src/video/jmd.cpp +++ b/src/video/jmd.cpp @@ -377,7 +377,7 @@ out: ctor_notify(); } ~adv_jmd_dumper() throw(); - std::set list_submodes() throw(std::bad_alloc) + std::set list_submodes() { std::set x; x.insert("file"); @@ -392,16 +392,15 @@ out: { return "jmd"; //Ignored if tcp mode. } - std::string name() throw(std::bad_alloc) + std::string name() { return "JMD"; } - std::string modename(const std::string& mode) throw(std::bad_alloc) + std::string modename(const std::string& mode) { return (mode == "tcp") ? "over TCP/IP" : "to file"; } jmd_dump_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix) - throw(std::bad_alloc, std::runtime_error) { return new jmd_dump_obj(_mdumper, *this, mode, prefix); } diff --git a/src/video/null.cpp b/src/video/null.cpp index 7adabe49..3c6ff5a9 100644 --- a/src/video/null.cpp +++ b/src/video/null.cpp @@ -77,7 +77,7 @@ namespace ctor_notify(); } ~adv_null_dumper() throw(); - std::set list_submodes() throw(std::bad_alloc) + std::set list_submodes() { std::set x; return x; @@ -90,16 +90,15 @@ namespace { return ""; //Nothing interesting. } - std::string name() throw(std::bad_alloc) + std::string name() { return "NULL"; } - std::string modename(const std::string& mode) throw(std::bad_alloc) + std::string modename(const std::string& mode) { return ""; } null_dump_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix) - throw(std::bad_alloc, std::runtime_error) { return new null_dump_obj(_mdumper, *this, mode, prefix); } diff --git a/src/video/pipedec.cpp b/src/video/pipedec.cpp index 2e2c68c2..6d8ab9fd 100644 --- a/src/video/pipedec.cpp +++ b/src/video/pipedec.cpp @@ -226,7 +226,7 @@ namespace ctor_notify(); } ~adv_pipedec_dumper() throw(); - std::set list_submodes() throw(std::bad_alloc) + std::set list_submodes() { std::set x; x.insert("RGB24"); @@ -247,16 +247,15 @@ namespace { return "sox"; } - std::string name() throw(std::bad_alloc) + std::string name() { return "PIPEDEC"; } - std::string modename(const std::string& mode) throw(std::bad_alloc) + std::string modename(const std::string& mode) { return "!" + mode; } pipedec_dump_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix) - throw(std::bad_alloc, std::runtime_error) { return new pipedec_dump_obj(_mdumper, *this, mode, prefix); } diff --git a/src/video/raw.cpp b/src/video/raw.cpp index 67a42ce8..efcae6f2 100644 --- a/src/video/raw.cpp +++ b/src/video/raw.cpp @@ -183,7 +183,7 @@ namespace ctor_notify(); } ~adv_raw_dumper() throw(); - std::set list_submodes() throw(std::bad_alloc) + std::set list_submodes() { std::set x; for(size_t i = 0; i < (socket_address::supported() ? 2 : 1); i++) @@ -201,11 +201,11 @@ namespace { return ""; //Nothing interesting. } - std::string name() throw(std::bad_alloc) + std::string name() { return "RAW"; } - std::string modename(const std::string& mode) throw(std::bad_alloc) + std::string modename(const std::string& mode) { unsigned _mode = strhash(mode); std::string x = std::string((IS_RGB(_mode) ? "RGB" : "BGR")) + @@ -213,7 +213,6 @@ namespace return x; } raw_dump_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix) - throw(std::bad_alloc, std::runtime_error) { return new raw_dump_obj(_mdumper, *this, mode, prefix); } diff --git a/src/video/sox.cpp b/src/video/sox.cpp index 651fd0b7..c0406b07 100644 --- a/src/video/sox.cpp +++ b/src/video/sox.cpp @@ -28,8 +28,7 @@ namespace } } -sox_dumper::sox_dumper(const std::string& filename, double samplerate, uint32_t channels) throw(std::bad_alloc, - std::runtime_error) +sox_dumper::sox_dumper(const std::string& filename, double samplerate, uint32_t channels) { sox_file.open(filename.c_str(), std::ios::out | std::ios::binary); if(!sox_file) @@ -59,7 +58,7 @@ sox_dumper::~sox_dumper() throw() } } -void sox_dumper::close() throw(std::bad_alloc, std::runtime_error) +void sox_dumper::close() { sox_file.seekp(8, std::ios::beg); uint8_t buffer[8];