vdr-1.4.7/tools.h File Reference

#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/stat.h>
#include <sys/types.h>

Include dependency graph for tools.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cString
class  cBase64Encoder
class  cTimeMs
class  cReadLine
class  cPoller
class  cReadDir
class  cFile
class  cSafeFile
class  cUnbufferedFile
class  cLockFile
class  cListObject
class  cListBase
class  cList< T >
class  cHashObject
class  cHashBase
class  cHash< T >

Defines

#define uint64   uint64_t
#define esyslog(a...)   void( (SysLogLevel > 0) ? syslog_with_tid(LOG_ERR, a) : void() )
#define isyslog(a...)   void( (SysLogLevel > 1) ? syslog_with_tid(LOG_INFO, a) : void() )
#define dsyslog(a...)   void( (SysLogLevel > 2) ? syslog_with_tid(LOG_DEBUG, a) : void() )
#define LOG_ERROR   esyslog("ERROR (%s,%d): %m", __FILE__, __LINE__)
#define LOG_ERROR_STR(s)   esyslog("ERROR: %s: %m", s)
#define SECSINDAY   86400
#define KILOBYTE(n)   ((n) * 1024)
#define MEGABYTE(n)   ((n) * 1024 * 1024)
#define MALLOC(type, size)   (type *)malloc(sizeof(type) * (size))
#define DELETENULL(p)   (delete (p), p = NULL)
#define CHECK(s)   { if ((s) < 0) LOG_ERROR; }
#define FATALERRNO   (errno && errno != EAGAIN && errno != EINTR)
#define BCDCHARTOINT(x)   (10 * ((x & 0xF0) >> 4) + (x & 0xF))
#define HASHSIZE   512

Typedefs

typedef unsigned char uchar

Functions

template<class T>
min (T a, T b)
template<class T>
max (T a, T b)
template<class T>
int sgn (T a)
template<class T>
void swap (T &a, T &b)
void syslog_with_tid (int priority, const char *format,...) __attribute__((format(printf
int BCD2INT (int x)
template<class T>
get_unaligned (T *p)
template<class T>
void put_unaligned (unsigned int v, T *p)
ssize_t safe_read (int filedes, void *buffer, size_t size)
ssize_t safe_write (int filedes, const void *buffer, size_t size)
void writechar (int filedes, char c)
int WriteAllOrNothing (int fd, const uchar *Data, int Length, int TimeoutMs=0, int RetryMs=0)
char * strcpyrealloc (char *dest, const char *src)
char * strn0cpy (char *dest, const char *src, size_t n)
char * strreplace (char *s, char c1, char c2)
char * strreplace (char *s, const char *s1, const char *s2)
 re-allocates 's' and deletes the original string if necessary!
char * skipspace (const char *s)
char * stripspace (char *s)
char * compactspace (char *s)
cString strescape (const char *s, const char *chars)
bool startswith (const char *s, const char *p)
bool endswith (const char *s, const char *p)
bool isempty (const char *s)
int numdigits (int n)
bool isnumber (const char *s)
cString itoa (int n)
cString AddDirectory (const char *DirName, const char *FileName)
int FreeDiskSpaceMB (const char *Directory, int *UsedMB=NULL)
bool DirectoryOk (const char *DirName, bool LogErrors=false)
bool MakeDirs (const char *FileName, bool IsDirectory=false)
bool RemoveFileOrDir (const char *FileName, bool FollowSymlinks=false)
bool RemoveEmptyDirectories (const char *DirName, bool RemoveThis=false)
int DirSizeMB (const char *DirName)
 returns the total size of the files in the given directory, or -1 in case of an error
char * ReadLink (const char *FileName)
 returns a new string allocated on the heap, which the caller must delete (or NULL in case of an error)
bool SpinUpDisk (const char *FileName)
void TouchFile (const char *FileName)
time_t LastModifiedTime (const char *FileName)
cString WeekDayName (int WeekDay)
cString WeekDayName (time_t t)
cString DayDateTime (time_t t=0)
cString TimeToString (time_t t)
cString DateString (time_t t)
cString TimeString (time_t t)
ucharRgbToJpeg (uchar *Mem, int Width, int Height, int &Size, int Quality=100)

Variables

int SysLogLevel


Define Documentation

#define BCDCHARTOINT (  )     (10 * ((x & 0xF0) >> 4) + (x & 0xF))

Definition at line 58 of file tools.h.

Referenced by BCD2INT().

#define CHECK (  )     { if ((s) < 0) LOG_ERROR; }

Definition at line 46 of file tools.h.

Referenced by cDvbTuner::cDvbTuner(), cDvbDevice::Clear(), cDvbDevice::Freeze(), cDvbDevice::GetAudioChannelDevice(), cDvbDevice::Mute(), cDvbDevice::Play(), cDvbDevice::SetAudioChannelDevice(), cDvbDevice::SetChannelDevice(), cDvbTuner::SetFrontend(), cDvbDevice::SetPid(), cDvbDevice::SetPlayMode(), cDvbDevice::SetVideoDisplayFormat(), cDvbDevice::SetVideoFormat(), cDvbDevice::SetVolumeDevice(), cDvbDevice::StillPicture(), cDvbDevice::TrickSpeed(), and cDvbDevice::TurnOffLiveMode().

#define DELETENULL (  )     (delete (p), p = NULL)

Definition at line 44 of file tools.h.

Referenced by cSVDRP::Close(), cSVDRP::CmdPUTE(), cRecordControl::cRecordControl(), cSVDRP::Execute(), cRecordControls::Process(), cEvent::Read(), cRecordControls::Shutdown(), cRecordControl::Stop(), and cOsdMenu::~cOsdMenu().

#define dsyslog ( a...   )     void( (SysLogLevel > 2) ? syslog_with_tid(LOG_DEBUG, a) : void() )

Definition at line 32 of file tools.h.

Referenced by cTransfer::Action(), cSectionHandler::Action(), cCaDescriptors::AddCaDescriptor(), cDvbDevice::cDvbDevice(), cStatusTest::ChannelSwitch(), cSVDRP::CmdGRAB(), cMenuCam::cMenuCam(), cCiTransportConnection::CreateConnection(), cReceiver::cReceiver(), cRecordControl::cRecordControl(), cChannels::DeleteDuplicateChannels(), cDvbSpuDecoder::Draw(), cDevice::EnsureAudioTrack(), cCommand::Execute(), cCaDescriptors::GetCaDescriptors(), cRecordControl::GetEvent(), cDvbDevice::GrabImage(), cPalette::Index(), cInterface::LearnKeys(), cDigiboxDevice::LircSend(), main(), MakeDirs(), cChannels::NewChannel(), cFileName::Open(), cStatusTest::OsdChannel(), cStatusTest::OsdClear(), cStatusTest::OsdCurrentItem(), cStatusTest::OsdHelpKeys(), cStatusTest::OsdProgramme(), cStatusTest::OsdStatusMessage(), cStatusTest::OsdTextItem(), cStatusTest::OsdTitle(), cDevice::PlayPesPacket(), cDvbDevice::Probe(), cSkins::ProcessQueuedMessages(), cInterface::QueryKeys(), cSkins::QueueMessage(), cSchedules::Read(), cStatusTest::Recording(), RemoveEmptyDirectories(), RemoveFileOrDir(), cStatusTest::Replaying(), ReportEpgBugFixStats(), cFileWriter::RunningLowOnDiskSpace(), safe_read(), safe_write(), cMenuCam::Select(), cChannel::SetCableTransponderData(), cChannel::SetCaDescriptors(), cChannel::SetCaIds(), cDevice::SetChannel(), cChannel::SetId(), cChannel::SetLinkChannels(), cChannel::SetName(), cFileName::SetOffset(), cChannel::SetPids(), cChannel::SetPortalName(), cChannel::SetSatTransponderData(), cChannel::SetTerrTransponderData(), cStatusTest::SetVolume(), SpinUpDisk(), cRecordControls::Start(), cThread::StartThread(), cDevice::SwitchChannel(), cTS2PES::ts_to_pes(), cRingBuffer::UpdatePercentage(), cRingBuffer::~cRingBuffer(), and cTS2PES::~cTS2PES().

#define esyslog ( a...   )     void( (SysLogLevel > 0) ? syslog_with_tid(LOG_ERR, a) : void() )

Definition at line 30 of file tools.h.

Referenced by cFileWriter::Action(), cLircRemote::Action(), cDvbPlayer::Action(), cTSBuffer::Action(), cCuttingThread::Action(), cPoller::Add(), cCiCaPmt::AddCaDescriptors(), cDevice::AddPid(), cDevice::AttachReceiver(), cThread::Cancel(), cIndexFile::CatchUp(), cCuttingThread::cCuttingThread(), cDevice::cDevice(), cDvbDevice::cDvbDevice(), cDvbOsd::cDvbOsd(), cDvbPlayer::cDvbPlayer(), cFileName::cFileName(), cFileWriter::cFileWriter(), cFrame::cFrame(), cIndexFile::cIndexFile(), cCiHandler::CloseSession(), cDiseqc::Codes(), cPlugin::ConfigDirectory(), cOsd::cOsd(), cCiHandler::CreateCiHandler(), cRecording::cRecording(), cResumeFile::cResumeFile(), cRingBufferLinear::cRingBufferLinear(), cTDT::cTDT(), cTPDU::cTPDU(), cTS2PES::cTS2PES(), cRingBufferLinear::Del(), DirectoryOk(), cRingBufferFrame::Drop(), cThread::EmergencyExit(), cCommand::Execute(), cTheme::FileNameOk(), cSource::FromString(), cTSBuffer::Get(), cIndexFile::GetNextIFrame(), cDvbDevice::GetSTC(), cCiMMI::GetText(), cDvbDevice::GrabImage(), I18nTranslate(), cPluginSky::Initialize(), cTS2PES::instant_repack(), cInterface::LearnKeys(), cTheme::Load(), cDll::Load(), cConfig< cSkyChannel >::Load(), cSetup::Load(), cBitmap::LoadXpm(), cLockFile::Lock(), cRepacker::LogAllowed(), main(), cSkins::Message(), cCiTransportLayer::ModuleReady(), cOsdProvider::NewOsd(), cDevice::NextCardIndex(), cFile::Open(), cDvbDevice::OpenFilter(), cCiHandler::OpenSession(), OpenVideoFile(), cTimer::Parse(), cKeyMacro::Parse(), cEvent::Parse(), cDiseqc::Parse(), cChannel::Parse(), ParseParameter(), cExternalAudio::Play(), cPlayer::PlayPes(), cDevice::PlayPesPacket(), cCiHandler::Process(), cCiMMI::Process(), cCiDateTime::Process(), cCiConditionalAccessSupport::Process(), cCiApplicationInformation::Process(), cCiResourceManager::Process(), cRemux::Put(), cRepacker::Put(), cKeys::PutSetup(), cRecordingInfo::Read(), cSchedule::Read(), cEvent::Read(), cNonBlockingFileReader::Read(), cTPDU::Read(), ReadFrame(), cPesAssembler::Realloc(), cCiTransportConnection::RecvTPDU(), cRecording::Remove(), RemoveFileOrDir(), cSVDRP::Reply(), cRingBuffer::ReportOverflow(), cCiTransportLayer::ResetSlot(), cCiSession::SendData(), cOsd::SetAreas(), cDevice::SetAvailableTrack(), cDvbDevice::SetChannelDevice(), cSkins::SetCurrent(), cDvbTuner::SetFrontend(), cThread::SetMainThreadId(), cFileName::SetOffset(), cDevice::SetPrimaryDevice(), cBitmap::SetSize(), cDvbSpuDecoder::setTime(), cBitmap::SetXpm(), SkipQuote(), SpinUpDisk(), cRecordControls::Start(), cCutter::Stop(), strcpyrealloc(), cChannel::StringToParameters(), cDevice::SwitchChannel(), cDiseqc::Wait(), Watchdog(), and cTPDU::Write().

#define FATALERRNO   (errno && errno != EAGAIN && errno != EINTR)

Definition at line 47 of file tools.h.

Referenced by cTransfer::Action(), cDvbPlayer::Action(), cNonBlockingFileReader::Action(), cTSBuffer::Action(), cCiTransportConnection::RecvTPDU(), and WriteAllOrNothing().

#define HASHSIZE   512

Definition at line 349 of file tools.h.

#define isyslog ( a...   )     void( (SysLogLevel > 1) ? syslog_with_tid(LOG_INFO, a) : void() )

Definition at line 31 of file tools.h.

Referenced by cSocket::Accept(), cLircRemote::Action(), cDvbPlayer::Action(), cDvbTuner::Action(), AssertFreeDiskSpace(), cDvbPlayer::cDvbPlayer(), cRecordControls::ChannelDataModified(), cIndexFile::cIndexFile(), cSchedules::Cleanup(), cSVDRP::Close(), cSVDRP::CmdDELC(), cSVDRP::CmdDELT(), cSVDRP::CmdMESG(), cSVDRP::CmdMODC(), cSVDRP::CmdMODT(), cSVDRP::CmdMOVC(), cSVDRP::CmdNEWC(), cSVDRP::CmdNEWT(), cSVDRP::CmdUPDT(), cInterface::Confirm(), cRcuRemote::cRcuRemote(), cCiHandler::CreateCiHandler(), cRecordControl::cRecordControl(), cSVDRP::cSVDRP(), cTDT::cTDT(), cRecording::Delete(), cMenuRecordings::Delete(), cMenuTimers::Delete(), cMenuChannels::Delete(), cTimers::DeleteExpired(), cMenuTimers::Edit(), cDevice::GrabImageFile(), cRcuRemote::Initialize(), cDvbDevice::Initialize(), cPluginManager::InitializePlugins(), cRecordingUserCommand::InvokeCommand(), cTheme::Load(), cDll::Load(), cConfig< cSkyChannel >::Load(), main(), cSkins::Message(), cMenuChannels::Move(), cMenuTimers::OnOff(), cSVDRP::Process(), cCiApplicationInformation::Process(), cMenuEditTimer::ProcessKey(), cMenuEditChannel::ProcessKey(), cMenuSchedule::Record(), cMenuWhatsOn::Record(), cRecording::Remove(), cSetup::Save(), cRecordings::ScanVideoDir(), cSkins::SetCurrent(), cTimer::SetEvent(), cTimer::SetInVpsMargin(), cDevice::SetPrimaryDevice(), cTimer::SetRecording(), cEvent::SetRunningStatus(), cPluginManager::Shutdown(), cRecordControls::Start(), cPluginManager::StartPlugins(), cRecordControls::Stop(), cCutter::Stop(), cPluginManager::StopPlugins(), and cDevice::SwitchChannel().

#define KILOBYTE (  )     ((n) * 1024)

Definition at line 39 of file tools.h.

Referenced by cUnbufferedFile::Open().

#define LOG_ERROR   esyslog("ERROR (%s,%d): %m", __FILE__, __LINE__)

Definition at line 34 of file tools.h.

Referenced by cSocket::Accept(), cTransfer::Action(), cDvbPlayer::Action(), cNonBlockingFileReader::Action(), cTSBuffer::Action(), cThread::Active(), cDigiboxDevice::cDigiboxDevice(), cDvbDevice::cDvbDevice(), cIndexFile::cIndexFile(), cSchedules::Cleanup(), cPipe::Close(), cPUTEhandler::cPUTEhandler(), cDvbDevice::GetVideoSystem(), cDigiboxDevice::LircSend(), cPipe::Open(), cSocket::Open(), cExternalAudio::Play(), cSchedules::Read(), ReadFrame(), cRcuRemote::ReceiveByte(), cSVDRP::Send(), cRcuRemote::SendByteHandshake(), cDvbDevice::SetPid(), cThread::SetPriority(), cThread::Start(), and SystemExec().

#define LOG_ERROR_STR (  )     esyslog("ERROR: %s: %m", s)

Definition at line 35 of file tools.h.

Referenced by cFileWriter::Action(), cIndexFile::CatchUp(), cIndexFile::cIndexFile(), cSafeFile::Close(), cFileName::Close(), cSVDRP::CmdGRAB(), cLircRemote::Connect(), cRcuRemote::cRcuRemote(), cCiHandler::CreateCiHandler(), cRecording::cRecording(), cResumeFile::Delete(), DirectoryOk(), DirSizeMB(), DvbOpen(), FreeDiskSpaceMB(), cDvbDevice::GrabImage(), cDevice::GrabImageFile(), cTheme::Load(), cConfig< cSkyChannel >::Load(), cLockFile::Lock(), MakeDirs(), cSafeFile::Open(), cPipe::Open(), cFileName::Open(), OpenVideoFile(), cDvbDevice::Probe(), cResumeFile::Read(), cKbdRemote::ReadKey(), ReadLink(), RemoveEmptyDirectories(), RemoveFileOrDir(), RenameVideoFile(), cResumeFile::Save(), cFileName::SetOffset(), SpinUpDisk(), SystemExec(), TouchFile(), cIndexFile::Write(), and cRecording::WriteInfo().

#define MALLOC ( type,
size   )     (type *)malloc(sizeof(type) * (size))

Definition at line 42 of file tools.h.

Referenced by cDvbPlayer::Action(), cBase64Encoder::cBase64Encoder(), cCaDescriptor::cCaDescriptor(), cFileName::cFileName(), cFrame::cFrame(), cIndexFile::cIndexFile(), cMenuCamEnquiry::cMenuCamEnquiry(), CopyString(), cRecording::cRecording(), cResumeFile::cResumeFile(), cRingBufferLinear::cRingBufferLinear(), cSafeFile::cSafeFile(), cSVDRP::cSVDRP(), cTS2PES::cTS2PES(), cDvbDevice::GrabImage(), JpegCompressInitDestination(), cBitmap::LoadXpm(), cTimer::Parse(), cCommand::Parse(), cSVDRP::Process(), RemoveFileOrDir(), cTextWrapper::Set(), cBitmap::SetSize(), cRecording::SortName(), cDvbDevice::StillPicture(), strescape(), and cRecording::Title().

#define MEGABYTE (  )     ((n) * 1024 * 1024)

Definition at line 40 of file tools.h.

Referenced by cCuttingThread::Action(), DirSizeMB(), cFileWriter::NextFile(), cDigiboxDevice::OpenDvr(), cDvbDevice::OpenDvr(), and cUnbufferedFile::Write().

#define SECSINDAY   86400

Definition at line 37 of file tools.h.

Referenced by AssertFreeDiskSpace(), cTimer::Matches(), cMenuEditDateItem::ProcessKey(), and cMenuTimerItem::Set().

#define uint64   uint64_t

Definition at line 26 of file tools.h.


Typedef Documentation

typedef unsigned char uchar

Definition at line 25 of file tools.h.


Function Documentation

cString AddDirectory ( const char *  DirName,
const char *  FileName 
)

Definition at line 272 of file tools.c.

Referenced by cPluginSky::Initialize(), cThemes::Load(), cMarks::Load(), main(), and cRecordings::UpdateFileName().

int BCD2INT ( int  x  ) 

Definition at line 45 of file tools.c.

References BCDCHARTOINT.

Referenced by cNitFilter::Process().

char* compactspace ( char *  s  ) 

Definition at line 188 of file tools.c.

References skipspace(), and stripspace().

Referenced by cEvent::FixEpgBugs(), cSetupLine::Parse(), and cSdtFilter::Process().

Here is the call graph for this function:

cString DateString ( time_t  t  ) 

Definition at line 649 of file tools.c.

References WeekDayName().

Referenced by cEvent::GetDateString(), cSkinSTTNGDisplayMenu::SetRecording(), cSkinClassicDisplayMenu::SetRecording(), cSkinCursesDisplayMenu::SetRecording(), and cPluginSvdrpdemo::SVDRPCommand().

Here is the call graph for this function:

cString DayDateTime ( time_t  t = 0  ) 

Definition at line 628 of file tools.c.

References WeekDayName().

Referenced by cSkinSTTNGDisplayMenu::Flush(), cSkinSTTNGDisplayChannel::Flush(), cSkinClassicDisplayMenu::Flush(), cSkinClassicDisplayChannel::Flush(), cSkinCursesDisplayMenu::Flush(), cSkinCursesDisplayChannel::Flush(), and cSkinSTTNGDisplayMenu::SetButtons().

Here is the call graph for this function:

bool DirectoryOk ( const char *  DirName,
bool  LogErrors = false 
)

Definition at line 303 of file tools.c.

References esyslog, and LOG_ERROR_STR.

Referenced by cLockFile::cLockFile(), main(), cVideoDirectory::Next(), and SpinUpDisk().

int DirSizeMB ( const char *  DirName  ) 

returns the total size of the files in the given directory, or -1 in case of an error

Definition at line 444 of file tools.c.

References DirSizeMB(), LOG_ERROR_STR, MEGABYTE, cReadDir::Next(), and cReadDir::Ok().

Referenced by cRecordings::DelByName(), DirSizeMB(), and cRecordings::ScanVideoDir().

Here is the call graph for this function:

bool endswith ( const char *  s,
const char *  p 
)

Definition at line 237 of file tools.c.

Referenced by cRecording::Remove(), and cRecordings::ScanVideoDir().

int FreeDiskSpaceMB ( const char *  Directory,
int *  UsedMB = NULL 
)

Definition at line 286 of file tools.c.

References LOG_ERROR_STR.

Referenced by cVideoDirectory::FreeMB(), OpenVideoFile(), and cFileWriter::RunningLowOnDiskSpace().

template<class T>
T get_unaligned ( T *  p  )  [inline]

Definition at line 64 of file tools.h.

Referenced by cCiHandler::Process(), cCiApplicationInformation::Process(), and cCiHandler::ResourceIdToInt().

bool isempty ( const char *  s  ) 

Definition at line 248 of file tools.c.

References skipspace().

Referenced by cPluginManager::Active(), cRecording::cRecording(), cTimer::cTimer(), cOsdMenu::Display(), cEvent::Dump(), cTheme::FileNameOk(), cEvent::FixEpgBugs(), tComponent::FromString(), cTheme::Load(), cConfig< cSkyChannel >::Load(), cCommand::Parse(), cSkins::QueueMessage(), cComponents::SetComponent(), cRecordingInfo::SetData(), cSkinSTTNGDisplayMenu::SetEvent(), cSkinClassicDisplayMenu::SetEvent(), cSkinCursesDisplayMenu::SetEvent(), cTimer::SetFile(), cChannel::SetName(), cChannel::SetPortalName(), cSkinSTTNGDisplayMenu::SetRecording(), cSkinClassicDisplayMenu::SetRecording(), cSkinCursesDisplayMenu::SetRecording(), cChannel::ShortName(), and cChannel::ToText().

Here is the call graph for this function:

bool isnumber ( const char *  s  ) 

Definition at line 260 of file tools.c.

Referenced by cSVDRP::CmdCHAN(), cSVDRP::CmdDELC(), cSVDRP::CmdDELR(), cSVDRP::CmdDELT(), cSVDRP::CmdEDIT(), cSVDRP::CmdGRAB(), cSVDRP::CmdLSTC(), cSVDRP::CmdLSTE(), cSVDRP::CmdLSTR(), cSVDRP::CmdLSTT(), cSVDRP::CmdPLAY(), cSVDRP::CmdVOLU(), main(), and cTimer::Parse().

cString itoa ( int  n  ) 

Definition at line 279 of file tools.c.

Referenced by cDisplayTracks::cDisplayTracks(), cResumeFile::cResumeFile(), cMenuTimerItem::Set(), and cTimer::ToText().

time_t LastModifiedTime ( const char *  FileName  ) 

Definition at line 535 of file tools.c.

Referenced by cRecordings::NeedsUpdate().

bool MakeDirs ( const char *  FileName,
bool  IsDirectory = false 
)

Definition at line 321 of file tools.c.

References dsyslog, and LOG_ERROR_STR.

Referenced by cPlugin::ConfigDirectory(), cRecordControl::cRecordControl(), OpenVideoFile(), cThemes::SetThemesDirectory(), and cCutter::Start().

template<class T>
T max ( a,
b 
) [inline]

Definition at line 51 of file tools.h.

Referenced by cDvbSpuDecoder::CalcAreaSize(), cSkinClassicDisplayTracks::cSkinClassicDisplayTracks(), cSkinCursesDisplayTracks::cSkinCursesDisplayTracks(), cSkinSTTNGDisplayReplay::cSkinSTTNGDisplayReplay(), cSkinSTTNGDisplayTracks::cSkinSTTNGDisplayTracks(), cOsdMenu::CursorDown(), cOsdMenu::CursorUp(), cBitmap::DrawRectangle(), cDevice::GetDevice(), cDvbPlayer::GetIndex(), cTimer::Matches(), cOsdMenu::PageDown(), cDevice::Priority(), cUnbufferedFile::Read(), cPesAssembler::Realloc(), cOsd::SetAreas(), cDevice::SetVolume(), cDvbPlayer::SkipSeconds(), cCondWait::SleepMs(), strcpyrealloc(), and cUnbufferedFile::Write().

template<class T>
T min ( a,
b 
) [inline]

Definition at line 50 of file tools.h.

Referenced by cDvbSpuDecoder::CalcAreaSize(), cSkinCursesDisplayTracks::cSkinCursesDisplayTracks(), cBitmap::DrawRectangle(), cSkinSTTNGDisplayChannel::Flush(), cDevice::GetDevice(), cTimer::Matches(), cDevice::PlayPes(), cNitFilter::Process(), cUnbufferedFile::Read(), cTextScroller::Set(), cDvbTuner::SetFrontend(), cDevice::SetVolume(), cReplayControl::TimeSearchProcess(), and cUnbufferedFile::Write().

int numdigits ( int  n  ) 

Definition at line 253 of file tools.c.

template<class T>
void put_unaligned ( unsigned int  v,
T *  p 
) [inline]

Definition at line 70 of file tools.h.

Referenced by cCiHandler::Send().

char* ReadLink ( const char *  FileName  ) 

returns a new string allocated on the heap, which the caller must delete (or NULL in case of an error)

Definition at line 480 of file tools.c.

References LOG_ERROR_STR.

Referenced by cSafeFile::cSafeFile(), and cRecordings::ScanVideoDir().

bool RemoveEmptyDirectories ( const char *  DirName,
bool  RemoveThis = false 
)

Definition at line 404 of file tools.c.

References dsyslog, LOG_ERROR_STR, cReadDir::Next(), cReadDir::Ok(), and RemoveEmptyDirectories().

Referenced by RemoveEmptyDirectories(), and RemoveEmptyVideoDirectories().

Here is the call graph for this function:

bool RemoveFileOrDir ( const char *  FileName,
bool  FollowSymlinks = false 
)

Definition at line 349 of file tools.c.

References dsyslog, esyslog, LOG_ERROR_STR, MALLOC, cReadDir::Next(), and cReadDir::Ok().

Referenced by RemoveVideoFile().

Here is the call graph for this function:

uchar* RgbToJpeg ( uchar Mem,
int  Width,
int  Height,
int &  Size,
int  Quality = 100 
)

Converts the given Memory to a JPEG image and returns a pointer to the resulting image. Mem must point to a data block of exactly (Width * Height) triplets of RGB image data bytes. Upon return, Size will hold the number of bytes of the resulting JPEG data. Quality can be in the range 0..100 and controls the quality of the resulting image, where 100 is "best". The caller takes ownership of the result and has to delete it once it is no longer needed. The result may be NULL in case of an error.

Definition at line 714 of file tools.c.

References JpegCompressEmptyOutputBuffer(), JpegCompressInitDestination(), JpegCompressTermDestination(), tJpegCompressData::mem, and tJpegCompressData::size.

Referenced by cDvbDevice::GrabImage().

Here is the call graph for this function:

ssize_t safe_read ( int  filedes,
void *  buffer,
size_t  size 
)

Definition at line 53 of file tools.c.

References dsyslog.

Referenced by cSectionHandler::Action(), cLircRemote::Action(), cIndexFile::CatchUp(), cIndexFile::cIndexFile(), cSVDRP::Process(), cUnbufferedFile::Read(), cRingBufferLinear::Read(), cResumeFile::Read(), cTPDU::Read(), cKbdRemote::ReadKey(), and cRcuRemote::ReceiveByte().

ssize_t safe_write ( int  filedes,
const void *  buffer,
size_t  size 
)

Definition at line 65 of file tools.c.

References dsyslog.

Referenced by cSVDRP::CmdGRAB(), cDevice::GrabImageFile(), cResumeFile::Save(), cSVDRP::Send(), cUnbufferedFile::Write(), cIndexFile::Write(), cTPDU::Write(), and writechar().

template<class T>
int sgn ( a  )  [inline]

Definition at line 52 of file tools.h.

Referenced by cDevice::SwitchChannel().

char* skipspace ( const char *  s  ) 

Definition at line 169 of file tools.c.

Referenced by cPluginManager::AddPlugin(), cSVDRP::CmdMODC(), cSVDRP::CmdMODT(), cSVDRP::CmdMOVC(), cSVDRP::CmdPLAY(), cSVDRP::CmdPLUG(), cDiseqc::Codes(), compactspace(), cSVDRP::Execute(), cOsdMenu::HotKey(), isempty(), cTheme::Load(), cDll::Load(), cBitmap::LoadXpm(), cTimer::Parse(), cMark::Parse(), cKey::Parse(), cEvent::Parse(), cCommand::Parse(), cChannel::Parse(), cTimer::ParseDay(), cSdtFilter::Process(), cRecordingInfo::Read(), cSchedule::Read(), cEvent::Read(), and cBitmap::SetXpm().

bool SpinUpDisk ( const char *  FileName  ) 

Definition at line 494 of file tools.c.

References DirectoryOk(), dsyslog, esyslog, and LOG_ERROR_STR.

Referenced by cRecorder::cRecorder().

Here is the call graph for this function:

bool startswith ( const char *  s,
const char *  p 
)

Definition at line 228 of file tools.c.

char* strcpyrealloc ( char *  dest,
const char *  src 
)

Definition at line 114 of file tools.c.

References esyslog, and max().

Referenced by cEvent::FixEpgBugs(), cChannel::operator=(), cChannel::Parse(), cMenuEditChannel::ProcessKey(), cComponents::SetComponent(), cEvent::SetDescription(), cChannel::SetName(), cChannel::SetPortalName(), cEvent::SetShortText(), and cEvent::SetTitle().

Here is the call graph for this function:

cString strescape ( const char *  s,
const char *  chars 
)

Definition at line 205 of file tools.c.

References MALLOC.

Referenced by cMenuRecordings::Commands(), cRecordingUserCommand::InvokeCommand(), and main().

char* stripspace ( char *  s  ) 

Definition at line 176 of file tools.c.

Referenced by compactspace(), cTheme::Load(), cDll::Load(), cConfig< cSkyChannel >::Load(), cCommand::Parse(), cMenuEditStrItem::ProcessKey(), cTextWrapper::Set(), and cRecording::Title().

char* strn0cpy ( char *  dest,
const char *  src,
size_t  n 
)

Definition at line 131 of file tools.c.

Referenced by cDigiboxDevice::cDigiboxDevice(), cEIT::cEIT(), cRecording::cRecording(), cRecordingInfo::cRecordingInfo(), cTimer::cTimer(), cSkinSTTNGDisplayChannel::Flush(), cTimer::Parse(), cSetup::Parse(), cCommand::Parse(), cChannel::Parse(), cSetup::ParseLanguages(), cPatFilter::Process(), cMenuSetupOSD::ProcessKey(), cDevice::SetAvailableTrack(), cComponents::SetComponent(), cTimer::SetFile(), cSkinClassicDisplayReplay::SetMode(), cSkinCursesDisplayReplay::SetMode(), cChannel::SetPids(), cMenuEditChannel::Setup(), cRecording::Title(), and WeekDayName().

char* strreplace ( char *  s,
const char *  s1,
const char *  s2 
)

re-allocates 's' and deletes the original string if necessary!

Definition at line 152 of file tools.c.

char* strreplace ( char *  s,
char  c1,
char  c2 
)

Definition at line 139 of file tools.c.

Referenced by CopyString(), cRecording::cRecording(), cEvent::Dump(), cEvent::FixEpgBugs(), cTimer::Parse(), cEvent::Parse(), cChannel::Parse(), cRecording::SortName(), cTimer::ToText(), and cChannel::ToText().

template<class T>
void swap ( T &  a,
T &  b 
) [inline]

Definition at line 53 of file tools.h.

Referenced by cMarks::Sort().

void syslog_with_tid ( int  priority,
const char *  format,
  ... 
)

cString TimeString ( time_t  t  ) 

Definition at line 660 of file tools.c.

Referenced by cEvent::GetEndTimeString(), cEvent::GetTimeString(), cSkinSTTNGDisplayMenu::SetRecording(), cSkinClassicDisplayMenu::SetRecording(), cSkinCursesDisplayMenu::SetRecording(), and cPluginSvdrpdemo::SVDRPCommand().

cString TimeToString ( time_t  t  ) 

Definition at line 639 of file tools.c.

Referenced by cSVDRP::CmdNEXT(), cTDT::cTDT(), main(), and cSVDRP::Process().

void TouchFile ( const char *  FileName  ) 

Definition at line 529 of file tools.c.

References LOG_ERROR_STR.

Referenced by cRecordings::TouchUpdate().

cString WeekDayName ( time_t  t  ) 

Definition at line 622 of file tools.c.

References WeekDayName().

Here is the call graph for this function:

cString WeekDayName ( int  WeekDay  ) 

Definition at line 608 of file tools.c.

References strn0cpy(), and tr.

Referenced by DateString(), DayDateTime(), cMenuEditDateItem::Set(), cMenuTimerItem::Set(), and WeekDayName().

Here is the call graph for this function:

int WriteAllOrNothing ( int  fd,
const uchar Data,
int  Length,
int  TimeoutMs = 0,
int  RetryMs = 0 
)

Writes either all Data to the given file descriptor, or nothing at all. If TimeoutMs is greater than 0, it will only retry for that long, otherwise it will retry forever. RetryMs defines the time between two retries.

Definition at line 90 of file tools.c.

References cTimeMs::Elapsed(), FATALERRNO, and cPoller::Poll().

Referenced by cDvbDevice::PlayAudio(), and cDvbDevice::PlayVideo().

Here is the call graph for this function:

void writechar ( int  filedes,
char  c 
)

Definition at line 85 of file tools.c.

References safe_write().

Referenced by cIndexFile::cIndexFile().

Here is the call graph for this function:


Variable Documentation

int SysLogLevel

Definition at line 31 of file tools.c.

Referenced by main().


Generated on Tue Nov 6 20:04:09 2007 for VDR by  doxygen 1.5.3-20071008