1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

Try to finish fighting to make cvs get the right patch files.

This commit is contained in:
Brian Feldman 2004-09-01 01:48:06 +00:00
parent b53f2958fe
commit f90aa270de
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=117777
7 changed files with 46 additions and 147 deletions

View File

@ -1,9 +0,0 @@
--- correlate.cc.orig Thu Apr 15 16:15:24 2004
+++ correlate.cc Sat Aug 14 11:15:59 2004
@@ -1,5 +1,6 @@
#include <assert.h>
#include <iostream>
+#include <math.h>
#include "correlate.h"
#include "strmanip.h"

View File

@ -1,17 +0,0 @@
--- fetcher.cc.orig Sun Jan 25 16:55:21 2004
+++ fetcher.cc Wed Feb 11 18:34:39 2004
@@ -200,8 +200,12 @@
return identified;
// Erase the first occurrence of the artist
- list<string>::iterator i = find(file_parts.begin(), file_parts.end(),
- artist);
+ list<string>::iterator i = file_parts.begin();
+ while (i != file_parts.end()) {
+ if (*i == artist)
+ break;
+ i++;
+ }
if (i != file_parts.end())
file_parts.erase(i);

View File

@ -1,38 +0,0 @@
--- picker.cc.orig Thu Apr 15 16:15:24 2004
+++ picker.cc Sat Aug 14 11:19:33 2004
@@ -2,6 +2,7 @@
#include <algorithm>
#include <math.h>
+#include <math.h>
#include "picker.h"
#include "strmanip.h"
@@ -53,9 +54,12 @@
SongData data(position, path);
- if (find(candidates.begin(), candidates.end(), data)
- != candidates.end())
- return true;
+ Candidates::iterator i = candidates.begin();
+ while (i != candidates.end()) {
+ if (*i == data)
+ return true;
+ i++;
+ }
if (fetch_song_info(data))
{
@@ -83,8 +87,9 @@
void SongPicker::do_events()
{
- bool more;
- for (int i = 0; i < 4 && (more = add_candidate()); ++i);
+ bool more = true;
+ for (int i = 0; i < 4 && more; ++i)
+ more = add_candidate();
if (!more)
identify_more();
}

View File

@ -1,55 +0,0 @@
--- plugin.cc.orig Sun Jan 25 16:55:21 2004
+++ plugin.cc Wed Feb 11 18:51:51 2004
@@ -5,6 +5,9 @@
#include <string>
#include <iostream>
#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <limits.h>
#include <xmms/plugin.h>
#include <xmms/xmmsctrl.h>
@@ -21,6 +24,7 @@
// Local vars
static Imms *imms = NULL;
+static int urandom = -1;
unsigned int time_left = 1000, sloppy_skips = 0;
int last_plpos = -2, cur_plpos, pl_length = -1;
int good_length = 0, song_length = 0, delay = 0;
@@ -39,6 +43,15 @@
FIND_NEXT = 2
} state;
+// Random
+int imms_random(int max)
+{
+ unsigned long rand_num;
+ (void)read(urandom, &rand_num, sizeof(rand_num));
+ double cof = rand_num / (ULONG_MAX + 1.0);
+ return (int)(max * cof);
+}
+
// Wrapper that frees memory
string imms_get_playlist_item(int at)
{
@@ -62,14 +75,17 @@
void imms_init()
{
- if (!imms)
+ if (!imms) {
imms = new Imms();
+ urandom = open("/dev/urandom", O_RDONLY);
+ }
state = IDLE;
}
void imms_cleanup(void)
{
+ close(urandom);
delete imms;
imms = 0;
}

View File

@ -1,14 +0,0 @@
--- plugin.h.orig Thu Apr 15 16:15:24 2004
+++ plugin.h Sat Aug 14 11:08:55 2004
@@ -1,7 +1,11 @@
#ifndef __PLUGIN_H
#define __PLUGIN_H
+#ifdef HAVE_STDIN
#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
#include "immsconf.h"
#ifdef __cplusplus

View File

@ -1,14 +0,0 @@
--- spectrum.h.orig Sun Jan 25 16:55:21 2004
+++ spectrum.h Wed Feb 11 17:45:20 2004
@@ -1,7 +1,11 @@
#ifndef __SPECTRUM_H
#define __SPECTRUM_H
+#if HAVE_STDINT_H
#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
#include <time.h>
#include <sys/time.h>

View File

@ -0,0 +1,46 @@
--- utils.h.orig Wed Aug 18 01:56:28 2004
+++ utils.h Tue Aug 31 21:40:20 2004
@@ -1,7 +1,9 @@
#ifndef __UTILS_H
#define __UTILS_H
+#include <fcntl.h>
#include <sys/time.h>
+#include <stdexcept>
#include <string>
#define HOUR (60*60)
@@ -10,8 +12,32 @@
using std::string;
-int imms_random(int max);
time_t usec_diff(struct timeval &tv1, struct timeval &tv2);
+
+class ImmsRandom
+{
+public:
+ ImmsRandom()
+ {
+ urandom = open("/dev/urandom", O_RDONLY);
+ if (urandom == -1)
+ throw std::runtime_error("could not open /dev/urandom");
+ }
+ ~ImmsRandom()
+ {
+ (void)close(urandom);
+ }
+ int imms_random(int max)
+ {
+ unsigned long rand_num;
+
+ (void)read(urandom, &rand_num, sizeof(rand_num));
+ double cof = rand_num / (ULONG_MAX + 1.0);
+ return (int)(max * cof);
+ }
+private:
+ int urandom;
+};
class StackTimer
{