From ccbb0f705f6f29269e0e8964ecff484b73e62863 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 22 Jan 2016 10:18:07 +0000 Subject: mpd: frozen_string_literal + copyright updates for 2016 --- bin/dtas-mpd-emu | 5 +++-- lib/dtas/mpd_emu_client.rb | 9 +++++---- lib/dtas/server_loop.rb | 7 ++++--- test/test_mpd_emu.rb | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/dtas-mpd-emu b/bin/dtas-mpd-emu index d95d545..385c863 100755 --- a/bin/dtas-mpd-emu +++ b/bin/dtas-mpd-emu @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -# Copyright (C) 2015 all contributors -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# Copyright (C) 2015-2016 all contributors +# License: GPL-3.0+ +# frozen_string_literal: true # MPD protocol emulation proxy in front of dtas-player require 'socket' diff --git a/lib/dtas/mpd_emu_client.rb b/lib/dtas/mpd_emu_client.rb index 25c96a0..f073b9e 100644 --- a/lib/dtas/mpd_emu_client.rb +++ b/lib/dtas/mpd_emu_client.rb @@ -1,5 +1,6 @@ -# Copyright (C) 2015 all contributors -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# Copyright (C) 2015-2016 all contributors +# License: GPL-3.0+ +# frozen_string_literal: true # emulate the MPD protocol require_relative '../dtas' @@ -98,7 +99,7 @@ class DTAS::MpdEmuClient # :nodoc: buf.slice!(0, rv).clear tot -= rv when :wait_writable - @wbuf = buf + @wbuf = buf.dup return rv end while tot > 0 true # all done @@ -120,7 +121,7 @@ class DTAS::MpdEmuClient # :nodoc: tot = @wbuf.size case rv = @to_io.write_nonblock(@wbuf, exception: false) when Integer - @wbuf.slice!(0, rv).clear + @wbuf.slice!(0, rv).clear # free the written portion tot -= rv return :wait_readable if tot == 0 when :wait_writable then return rv diff --git a/lib/dtas/server_loop.rb b/lib/dtas/server_loop.rb index f0936aa..d4e56b3 100644 --- a/lib/dtas/server_loop.rb +++ b/lib/dtas/server_loop.rb @@ -1,5 +1,6 @@ -# Copyright (C) 2015 all contributors -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# Copyright (C) 2015-2016 all contributors +# License: GPL-3.0+ +# frozen_string_literal: true require_relative '../dtas' @@ -8,7 +9,7 @@ class DTAS::ServerLoop def initialize(listeners, client_class) @rd = {} @wr = {} - @rbuf = '' + @rbuf = ''.b @client_class = client_class listeners.each { |l| @rd[l] = true } end diff --git a/test/test_mpd_emu.rb b/test/test_mpd_emu.rb index 487e743..869bff4 100644 --- a/test/test_mpd_emu.rb +++ b/test/test_mpd_emu.rb @@ -1,11 +1,12 @@ -# Copyright (C) 2013-2015 all contributors -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# Copyright (C) 2013-2016 all contributors +# License: GPL-3.0+ +# frozen_string_literal: true require_relative 'helper' require 'socket' require 'dtas/mpd_emu_client' require 'dtas/server_loop' -class TestMlib < Testcase +class TestMpdEmu < Testcase class Quit attr_reader :to_io -- cgit v1.2.3-24-ge0c7