fix compilation if there were no curl dev files installed

This commit is contained in:
Andrzej Rybczak
2009-05-03 13:53:15 +02:00
parent b0317b695a
commit 72acc09b26
3 changed files with 11 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ std::string Info::Title()
return itsTitle; return itsTitle;
} }
#ifdef HAVE_PTHREAD_H #if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
void Info::Update() void Info::Update()
{ {
if (!ArtistReady) if (!ArtistReady)
@@ -86,7 +86,7 @@ void Info::Update()
Downloader = 0; Downloader = 0;
ArtistReady = 0; ArtistReady = 0;
} }
#endif // HAVE_PTHREAD_H #endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
void Info::GetSong() void Info::GetSong()
{ {

View File

@@ -34,9 +34,9 @@ class Info : public Screen<Scrollpad>
virtual std::string Title(); virtual std::string Title();
# ifdef HAVE_PTHREAD_H # if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
virtual void Update(); virtual void Update();
# endif // HAVE_PTHREAD_H # endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
virtual void EnterPressed() { } virtual void EnterPressed() { }
virtual void SpacePressed() { } virtual void SpacePressed() { }

View File

@@ -58,12 +58,12 @@ bool Lyrics::Reload = 0;
#ifdef HAVE_CURL_CURL_H #ifdef HAVE_CURL_CURL_H
bool Lyrics::Ready = 0; bool Lyrics::Ready = 0;
#endif // HAVE_CURL_CURL_H
#ifdef HAVE_PTHREAD_H #ifdef HAVE_PTHREAD_H
pthread_t *Lyrics::Downloader = 0; pthread_t *Lyrics::Downloader = 0;
pthread_mutex_t Global::CurlLock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t Global::CurlLock = PTHREAD_MUTEX_INITIALIZER;
#endif // HAVE_PTHREAD_H #endif // HAVE_PTHREAD_H
#endif // HAVE_CURL_CURL_H
Lyrics *myLyrics = new Lyrics; Lyrics *myLyrics = new Lyrics;
@@ -81,10 +81,10 @@ void Lyrics::Resize()
void Lyrics::Update() void Lyrics::Update()
{ {
# ifdef HAVE_PTHREAD_H # if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
if (myLyrics->Ready) if (myLyrics->Ready)
myLyrics->Take(); myLyrics->Take();
# endif // HAVE_PTHREAD_H # endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
if (!Reload) if (!Reload)
return; return;
@@ -104,7 +104,7 @@ void Lyrics::SwitchTo()
} }
else else
{ {
# ifdef HAVE_PTHREAD_H # if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
if (Downloader && !Ready) if (Downloader && !Ready)
{ {
ShowMessage("Lyrics are being downloaded..."); ShowMessage("Lyrics are being downloaded...");
@@ -112,7 +112,7 @@ void Lyrics::SwitchTo()
} }
else if (Ready) else if (Ready)
Take(); Take();
# endif // HAVE_PTHREAD_H # endif // HAVE_CURL_CURL_H && HAVE_PTHREAD_H
const MPD::Song *s = Reload ? myPlaylist->NowPlayingSong() : myScreen->CurrentSong(); const MPD::Song *s = Reload ? myPlaylist->NowPlayingSong() : myScreen->CurrentSong();
@@ -136,10 +136,10 @@ void Lyrics::SwitchTo()
# ifdef HAVE_CURL_CURL_H # ifdef HAVE_CURL_CURL_H
static_cast<Window &>(*w) << "Fetching lyrics..."; static_cast<Window &>(*w) << "Fetching lyrics...";
w->Window::Refresh(); w->Window::Refresh();
# endif // HAVE_CURL_CURL_H
# ifdef HAVE_PTHREAD_H # ifdef HAVE_PTHREAD_H
if (!Downloader) if (!Downloader)
# endif // HAVE_PTHREAD_H # endif // HAVE_PTHREAD_H
# endif // HAVE_CURL_CURL_H
{ {
string file = locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt"; string file = locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt";
EscapeUnallowedChars(file); EscapeUnallowedChars(file);
@@ -168,7 +168,7 @@ void Lyrics::SwitchTo()
} }
else else
{ {
# ifdef HAVE_PTHREAD_H # if defined(HAVE_CURL_CURL_H) && defined(HAVE_PTHREAD_H)
Downloader = new pthread_t; Downloader = new pthread_t;
pthread_create(Downloader, 0, Get, this); pthread_create(Downloader, 0, Get, this);
# elif defined(HAVE_CURL_CURL_H) # elif defined(HAVE_CURL_CURL_H)