Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Aug 2015 14:03:57 +0000 (UTC)
From:      Thomas Zander <riggs@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r393424 - in head/audio/ncmpcpp: . files
Message-ID:  <201508021403.t72E3v5Q064712@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: riggs
Date: Sun Aug  2 14:03:56 2015
New Revision: 393424
URL: https://svnweb.freebsd.org/changeset/ports/393424

Log:
  Fix shuffle playback
  (random number generator is not initialised properly)
  
  While on it:
  Pet portlint
  
  PR:		201645
  Submitted by:	yamagi@yamagi.org (maintainer)
  MFH:		2015Q3

Added:
  head/audio/ncmpcpp/files/patch-src_mpdpp.cpp   (contents, props changed)
  head/audio/ncmpcpp/files/patch-src_mpdpp.h   (contents, props changed)
Modified:
  head/audio/ncmpcpp/Makefile
  head/audio/ncmpcpp/files/patch-src__status.cpp

Modified: head/audio/ncmpcpp/Makefile
==============================================================================
--- head/audio/ncmpcpp/Makefile	Sun Aug  2 13:47:42 2015	(r393423)
+++ head/audio/ncmpcpp/Makefile	Sun Aug  2 14:03:56 2015	(r393424)
@@ -2,6 +2,7 @@
 
 PORTNAME=	ncmpcpp
 PORTVERSION=	0.6.5
+PORTREVISION=	1
 CATEGORIES=	audio
 MASTER_SITES=	http://ncmpcpp.rybczak.net/stable/
 

Modified: head/audio/ncmpcpp/files/patch-src__status.cpp
==============================================================================
--- head/audio/ncmpcpp/files/patch-src__status.cpp	Sun Aug  2 13:47:42 2015	(r393423)
+++ head/audio/ncmpcpp/files/patch-src__status.cpp	Sun Aug  2 14:03:56 2015	(r393424)
@@ -1,5 +1,5 @@
---- src/status.cpp_orig	2014-11-16 09:21:55.651181899 +0100
-+++ src/status.cpp	2014-11-16 09:21:59.233203196 +0100
+--- src/status.cpp.orig	2015-07-05 02:18:34 UTC
++++ src/status.cpp
 @@ -21,6 +21,8 @@
  #include <boost/date_time/posix_time/posix_time.hpp>
  #include <netinet/tcp.h>

Added: head/audio/ncmpcpp/files/patch-src_mpdpp.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/ncmpcpp/files/patch-src_mpdpp.cpp	Sun Aug  2 14:03:56 2015	(r393424)
@@ -0,0 +1,29 @@
+--- src/mpdpp.cpp.orig	2015-07-05 02:18:34 UTC
++++ src/mpdpp.cpp
+@@ -38,6 +38,8 @@ Connection::Connection() : m_connection(
+ 				m_port(6600),
+ 				m_timeout(15)
+ {
++	std::random_device rd;
++	m_gen.seed(rd());
+ }
+ 
+ Connection::~Connection()
+@@ -504,7 +506,7 @@ bool Connection::AddRandomTag(mpd_tag_ty
+ 	}
+ 	else
+ 	{
+-		std::random_shuffle(tags.begin(), tags.end());
++		std::shuffle(tags.begin(), tags.end(), m_gen);
+ 		auto it = tags.begin();
+ 		for (size_t i = 0; i < number && it != tags.end(); ++i)
+ 		{
+@@ -544,7 +546,7 @@ bool Connection::AddRandomSongs(size_t n
+ 	}
+ 	else
+ 	{
+-		std::random_shuffle(files.begin(), files.end());
++		std::shuffle(files.begin(), files.end(), m_gen);
+ 		StartCommandsList();
+ 		auto it = files.begin();
+ 		for (size_t i = 0; i < number && it != files.end(); ++i, ++it)

Added: head/audio/ncmpcpp/files/patch-src_mpdpp.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/ncmpcpp/files/patch-src_mpdpp.h	Sun Aug  2 14:03:56 2015	(r393424)
@@ -0,0 +1,19 @@
+--- src/mpdpp.h.orig	2015-07-05 02:18:34 UTC
++++ src/mpdpp.h
+@@ -23,6 +23,7 @@
+ 
+ #include <cassert>
+ #include <exception>
++#include <random>
+ #include <set>
+ #include <vector>
+ 
+@@ -277,6 +278,8 @@ private:
+ 	std::string m_password;
+ 	
+ 	mpd_tag_type m_searched_field;
++
++	std::mt19937 m_gen;
+ };
+ 
+ }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508021403.t72E3v5Q064712>