[gnome-games] Remove DataInputStream and Game Boy magic check



commit f783f90bb99bf3e3af02f93448ef1b7c88b8a0c5
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Jan 26 11:55:51 2017 +0100

    Remove DataInputStream and Game Boy magic check
    
    DataInputStream has been added in the previous commit to help fix a bug
    in the GameBoyHeader, though it broke the compilation: it clashed with
    Glib.DataInputStream.
    
    Remove DataInputStream and don't check the Game Boy header as it's
    already done by shared-mime-info.
    
    This fixes compilation and makes the code simpler.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777777

 plugins/game-boy/src/game-boy-header.vala |    9 ---------
 plugins/game-boy/src/game-boy-plugin.vala |    1 -
 src/Makefile.am                           |    1 -
 src/utils/data-input-stream.vala          |   19 -------------------
 4 files changed, 0 insertions(+), 30 deletions(-)
---
diff --git a/plugins/game-boy/src/game-boy-header.vala b/plugins/game-boy/src/game-boy-header.vala
index c449150..6af9040 100644
--- a/plugins/game-boy/src/game-boy-header.vala
+++ b/plugins/game-boy/src/game-boy-header.vala
@@ -2,9 +2,6 @@
 
 // Documentation: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
 private class Games.GameBoyHeader : Object {
-       private const size_t MAGIC_OFFSET = 0x104;
-       private const uint8[] MAGIC_VALUE = { 0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d, 0x00, 0x0b, 0x03, 0x73, 
0x00, 0x83, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x08, 0x11, 0x1f, 0x88, 0x89, 0x00, 0x0e };
-
        private const size_t COLOR_TYPE_OFFSET = 0x143;
        private const uint8 COLOR_ENABLED_VALUE = 0x80;
        private const uint8 COLOR_ONLY_VALUE = 0xC0;
@@ -91,12 +88,6 @@ private class Games.GameBoyHeader : Object {
                this.file = file;
        }
 
-       public void check_validity () throws Error {
-               var stream = new DataInputStream (file);
-               if (!stream.has_data (MAGIC_OFFSET, MAGIC_VALUE))
-                       throw new GameBoyError.INVALID_HEADER (_("The file doesn't have a Game Boy header."));
-       }
-
        public bool is_classic () {
                switch (game_boy_type) {
                case GameBoyType.SUPER_ENABLED:
diff --git a/plugins/game-boy/src/game-boy-plugin.vala b/plugins/game-boy/src/game-boy-plugin.vala
index 8780d3f..c1262f2 100644
--- a/plugins/game-boy/src/game-boy-plugin.vala
+++ b/plugins/game-boy/src/game-boy-plugin.vala
@@ -28,7 +28,6 @@ private class Games.GameBoyPlugin : Object, Plugin {
        private static Game game_for_uri (string uri) throws Error {
                var file = File.new_for_uri (uri);
                var header = new GameBoyHeader (file);
-               header.check_validity ();
 
                string prefix;
                string mime_type;
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ff086c..1d8d3d6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -131,7 +131,6 @@ gnome_games_SOURCES = \
        utils/cue-sheet/cue-sheet-file-node.vala \
        utils/cue-sheet/cue-sheet-track-mode.vala \
        utils/cue-sheet/cue-sheet-track-node.vala \
-       utils/data-input-stream.vala \
        utils/directory.vala \
        utils/filename-title.vala \
        utils/fingerprint.vala \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]