vdr-1.6.0/tools.h File Reference

#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <iconv.h>
#include <poll.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.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  cCharSetConv
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  cVector< T >
class  cStringList
class  cFileNameList
class  cHashObject
class  cHashBase
class  cHash< T >

Defines

#define esyslog(a...)   void( (SysLogLevel > 0) ? syslog_with_tid(LOG_ERR, a) : void() )
#define isyslog(a...)   void( (SysLogLevel > 1) ? syslog_with_tid(LOG_ERR, a) : void() )
#define dsyslog(a...)   void( (SysLogLevel > 2) ? syslog_with_tid(LOG_ERR, 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 Utf8BufSize(s)   ((s) * 4)
#define Utf8to(conv, c)   (cCharSetConv::SystemCharacterTable() ? to##conv(c) : tow##conv(c))
#define Utf8is(ccls, c)   (cCharSetConv::SystemCharacterTable() ? is##ccls(c) : isw##ccls(c))
#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)
int Utf8CharLen (const char *s)
uint Utf8CharGet (const char *s, int Length=0)
int Utf8CharSet (uint c, char *s=NULL)
int Utf8SymChars (const char *s, int Symbols)
int Utf8StrLen (const char *s)
char * Utf8Strn0Cpy (char *Dest, const char *Src, int n)
int Utf8ToArray (const char *s, uint *a, int Size)
int Utf8FromArray (const uint *a, char *s, int Size, int Max=-1)
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)
bool EntriesOnSameFileSystem (const char *File1, const char *File2)
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 WeekDayNameFull (int WeekDay)
cString WeekDayNameFull (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)
int CompareStrings (const void *a, const void *b)

Variables

int SysLogLevel


Define Documentation

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

Definition at line 59 of file tools.h.

Referenced by BCD2INT().

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

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

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

Definition at line 33 of file tools.h.

Referenced by cTransfer::Action(), cSectionHandler::Action(), cCaDescriptors::AddCaDescriptor(), cCamSlot::Assign(), cCamSlot::CanDecrypt(), cDvbDevice::cDvbDevice(), cStatusTest::ChannelSwitch(), cShutdownHandler::CheckManualStart(), cSVDRP::CmdGRAB(), cReceiver::cReceiver(), cRecordControl::cRecordControl(), cChannels::DeleteDuplicateChannels(), cShutdownHandler::DoShutdown(), cDvbSpuDecoder::Draw(), cDevice::EnsureAudioTrack(), cCommand::Execute(), cCaDescriptors::GetCaDescriptors(), cRecordControl::GetEvent(), cDvbDevice::GrabImage(), I18nInitialize(), I18nSetLocale(), cInterface::LearnKeys(), cDigiboxDevice::LircSend(), main(), MakeDirs(), cMenuSetupCAM::Menu(), cChannels::NewChannel(), cTimeMs::Now(), cFileName::Open(), cStatusTest::OsdChannel(), cStatusTest::OsdClear(), cStatusTest::OsdCurrentItem(), cStatusTest::OsdHelpKeys(), cStatusTest::OsdProgramme(), cStatusTest::OsdStatusMessage(), cStatusTest::OsdTextItem(), cStatusTest::OsdTitle(), cTimer::Parse(), cDevice::PlayPesPacket(), cDvbDevice::Probe(), cCiConditionalAccessSupport::Process(), cSkins::ProcessQueuedMessages(), cInterface::QueryKeys(), cSkins::QueueMessage(), cSchedules::Read(), cStatusTest::Recording(), cPlugin::RegisterI18n(), RemoveEmptyDirectories(), RemoveFileOrDir(), cStatusTest::Replaying(), ReportEpgBugFixStats(), cShutdownHandler::RequestEmergencyExit(), cFileWriter::RunningLowOnDiskSpace(), safe_read(), safe_write(), cMenuCam::Select(), cMenuCam::Set(), cStatusTest::SetAudioChannel(), cStatusTest::SetAudioTrack(), cRemux::SetBrokenLink(), cChannel::SetCableTransponderData(), cChannel::SetCaDescriptors(), cChannel::SetCaIds(), cChannel::SetId(), cChannel::SetLinkChannels(), cChannel::SetName(), cFileName::SetOffset(), cChannel::SetPids(), cChannel::SetPortalName(), cChannel::SetSatTransponderData(), cStatusTest::SetSubtitleTrack(), cChannel::SetTerrTransponderData(), cStatusTest::SetVolume(), SpinUpDisk(), cRecordControls::Start(), cThread::StartThread(), cDevice::SwitchChannel(), cStatusTest::TimerChange(), 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 31 of file tools.h.

Referenced by cFileWriter::Action(), cLircRemote::Action(), cDvbPlayer::Action(), cTSBuffer::Action(), cCuttingThread::Action(), cPoller::Add(), cCiCaPmt::AddCaDescriptors(), cCiAdapter::AddCamSlot(), cDevice::AddPid(), cDevice::AttachReceiver(), cShutdownHandler::CallShutdownCommand(), cThread::Cancel(), cIndexFile::CatchUp(), cCuttingThread::cCuttingThread(), cDevice::cDevice(), cDvbCiAdapter::cDvbCiAdapter(), cDvbDevice::cDvbDevice(), cDvbOsd::cDvbOsd(), cDvbPlayer::cDvbPlayer(), cFileName::cFileName(), cFileWriter::cFileWriter(), cFrame::cFrame(), cFreetypeFont::cFreetypeFont(), cIndexFile::cIndexFile(), cCiTransportConnection::CloseSession(), cDiseqc::Codes(), cPlugin::ConfigDirectory(), cRecording::cRecording(), cResumeFile::cResumeFile(), cRingBufferLinear::cRingBufferLinear(), cTDT::cTDT(), cTPDU::cTPDU(), cTS2PES::cTS2PES(), cRingBufferLinear::Del(), DirectoryOk(), cRingBufferFrame::Drop(), cCommand::Execute(), cTheme::FileNameOk(), cSource::FromString(), cRemux::Get(), cTSBuffer::Get(), cFont::GetFontFileName(), cIndexFile::GetNextIFrame(), cSubtitleClut::GetPalette(), cDvbDevice::GetSTC(), cCiMMI::GetText(), cFreetypeFont::Glyph(), cDvbDevice::GrabImage(), cCiTransportConnection::HandleSessions(), I18nInitialize(), 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(), cDvbCiAdapter::ModuleStatus(), cCamSlot::NewConnection(), cOsdProvider::NewOsd(), cDevice::NextCardIndex(), cTimeMs::Now(), cFile::Open(), cDvbDevice::OpenFilter(), cCiTransportConnection::OpenSession(), OpenVideoFile(), cTimer::Parse(), cKeyMacro::Parse(), cEvent::Parse(), cDiseqc::Parse(), cChannel::Parse(), ParseParameter(), cExternalAudio::Play(), cPlayer::PlayPes(), cDevice::PlayPesPacket(), cCiTransportConnection::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(), cDvbCiAdapter::Read(), ReadFrame(), cDvbSubtitleAssembler::Realloc(), cPesAssembler::Realloc(), cRecording::Remove(), RemoveFileOrDir(), cSVDRP::Reply(), cRingBuffer::ReportOverflow(), cShutdownHandler::RequestEmergencyExit(), cDvbCiAdapter::Reset(), cCiSession::SendData(), cOsd::SetAreas(), cDevice::SetAvailableTrack(), cDvbDevice::SetChannelDevice(), cSubtitleClut::SetColor(), cSkins::SetCurrent(), cDvbTuner::SetFrontend(), cThread::SetMainThreadId(), cFileName::SetOffset(), cDevice::SetPrimaryDevice(), cBitmap::SetSize(), cDvbSpuDecoder::setTime(), cBitmap::SetXpm(), SkipQuote(), SpinUpDisk(), cString::sprintf(), cRecordControls::Start(), cCutter::Stop(), strcpyrealloc(), cChannel::StringToParameters(), cDevice::SwitchChannel(), cRecording::Undelete(), cDiseqc::Wait(), Watchdog(), cDvbCiAdapter::Write(), and cReceiver::~cReceiver().

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

#define HASHSIZE   512

Definition at line 533 of file tools.h.

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

Definition at line 32 of file tools.h.

Referenced by cSocket::Accept(), cLircRemote::Action(), cDvbPlayer::Action(), cDvbTuner::Action(), AssertFreeDiskSpace(), cShutdownHandler::CallShutdownCommand(), cDvbCiAdapter::cDvbCiAdapter(), 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(), 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(), cCamSlot::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(), cDevice::SwitchChannel(), and cRecording::Undelete().

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

Definition at line 40 of file tools.h.

Referenced by cPicturePlayer::cPicturePlayer(), and cUnbufferedFile::Open().

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

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

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

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

#define SECSINDAY   86400

#define Utf8BufSize (  )     ((s) * 4)

Definition at line 118 of file tools.h.

Referenced by cEIT::cEIT(), and cSdtFilter::Process().

#define Utf8is ( ccls,
 )     (cCharSetConv::SystemCharacterTable() ? is##ccls(c) : isw##ccls(c))

Definition at line 124 of file tools.h.

Referenced by cMenuEditStrItem::AdvancePos(), and cMenuEditStrItem::ProcessKey().

#define Utf8to ( conv,
 )     (cCharSetConv::SystemCharacterTable() ? to##conv(c) : tow##conv(c))

Definition at line 123 of file tools.h.

Referenced by cMenuEditStrItem::ProcessKey().


Typedef Documentation

typedef unsigned char uchar

Definition at line 27 of file tools.h.


Function Documentation

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

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 182 of file tools.c.

References skipspace(), and stripspace().

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

Here is the call graph for this function:

int CompareStrings ( const void *  a,
const void *  b 
) [inline]

Definition at line 487 of file tools.h.

Referenced by cStringList::Sort().

cString DateString ( time_t  t  ) 

cString DayDateTime ( time_t  t = 0  ) 

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

Definition at line 312 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 449 of file tools.c.

References AddDirectory(), 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 231 of file tools.c.

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

bool EntriesOnSameFileSystem ( const char *  File1,
const char *  File2 
)

Definition at line 280 of file tools.c.

References LOG_ERROR_STR.

Referenced by IsOnVideoDirectoryFileSystem().

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

Definition at line 295 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]

bool isempty ( const char *  s  ) 

bool isnumber ( const char *  s  ) 

cString itoa ( int  n  ) 

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 
)

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

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

int numdigits ( int  n  ) 

Definition at line 247 of file tools.c.

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

Definition at line 71 of file tools.h.

Referenced by cCiTransportConnection::SendTag().

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 483 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 411 of file tools.c.

References AddDirectory(), 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 358 of file tools.c.

References AddDirectory(), 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 1041 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 
)

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

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

Definition at line 53 of file tools.h.

Referenced by cDevice::SwitchChannel().

char* skipspace ( const char *  s  )  [inline]

bool SpinUpDisk ( const char *  FileName  ) 

Definition at line 497 of file tools.c.

References DirectoryOk(), dsyslog, esyslog, LOG_ERROR_STR, and cString::sprintf().

Referenced by cRecorder::cRecorder().

Here is the call graph for this function:

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

Definition at line 222 of file tools.c.

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

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

char* stripspace ( char *  s  ) 

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

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 
)

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

Definition at line 54 of file tools.h.

Referenced by cMarks::Sort().

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

cString TimeString ( time_t  t  ) 

cString TimeToString ( time_t  t  ) 

void TouchFile ( const char *  FileName  ) 

Definition at line 529 of file tools.c.

References LOG_ERROR_STR.

Referenced by cRecordings::TouchUpdate().

uint Utf8CharGet ( const char *  s,
int  Length = 0 
)

Returns the UTF-8 symbol at the beginning of the given string. Length can be given from a previous call to Utf8CharLen() to avoid calculating it again. If no Length is given, Utf8CharLen() will be called.

Definition at line 626 of file tools.c.

References cCharSetConv::SystemCharacterTable(), SystemToUtf8, and Utf8CharLen().

Referenced by cFreetypeFont::DrawText(), cTextWrapper::Set(), cCharSetConv::SetSystemCharacterTable(), Utf8ToArray(), and cFreetypeFont::Width().

Here is the call graph for this function:

int Utf8CharLen ( const char *  s  ) 

Returns the number of character bytes at the beginning of the given string that form a UTF-8 symbol.

Definition at line 612 of file tools.c.

References MT, and cCharSetConv::SystemCharacterTable().

Referenced by cFreetypeFont::DrawText(), cTimer::PrintDay(), cTextWrapper::Set(), cCharSetConv::SetSystemCharacterTable(), Utf8CharGet(), Utf8StrLen(), Utf8Strn0Cpy(), Utf8SymChars(), Utf8ToArray(), and cFreetypeFont::Width().

Here is the call graph for this function:

int Utf8CharSet ( uint  c,
char *  s = NULL 
)

Converts the given UTF-8 symbol to a sequence of character bytes and copies them to the given string. Returns the number of bytes written. If no string is given, only the number of bytes is returned and nothing is copied.

Definition at line 640 of file tools.c.

References cCharSetConv::SystemCharacterTable().

Referenced by Utf8FromArray().

Here is the call graph for this function:

int Utf8FromArray ( const uint *  a,
char *  s,
int  Size,
int  Max = -1 
)

Converts the given array of UTF-8 symbols (including the terminating 0) into a sequence of character bytes of at most Size length. Returns the number of character bytes written (without the terminating 0). If Max is given, only that many symbols will be converted. The resulting string is always zero-terminated if Size is big enough.

Definition at line 736 of file tools.c.

References cCharSetConv::SystemCharacterTable(), and Utf8CharSet().

Referenced by cMenuEditStrItem::LeaveEditMode(), and cMenuEditStrItem::Set().

Here is the call graph for this function:

int Utf8StrLen ( const char *  s  ) 

Returns the number of UTF-8 symbols formed by the given string of character bytes.

Definition at line 687 of file tools.c.

References cCharSetConv::SystemCharacterTable(), and Utf8CharLen().

Referenced by cSkinCursesDisplayMenu::Flush(), cSkinCursesDisplayChannel::Flush(), cSkinCursesDisplayReplay::SetCurrent(), cSkinCursesDisplayMenu::SetEvent(), cSkinCursesDisplayReplay::SetTotal(), cSkinCursesDisplayVolume::SetVolume(), and cCursesFont::Width().

Here is the call graph for this function:

char* Utf8Strn0Cpy ( char *  Dest,
const char *  Src,
int  n 
)

Copies at most n character bytes from Src to Dst, making sure that the resulting copy ends with a complete UTF-8 symbol. The copy is guaranteed to be zero terminated. Returns a pointer to Dest.

Definition at line 699 of file tools.c.

References strn0cpy(), cCharSetConv::SystemCharacterTable(), and Utf8CharLen().

Referenced by cRecording::cRecording(), cTimer::cTimer(), cTimer::Parse(), cSetup::Parse(), cMenuSetupOSD::ProcessKey(), cDevice::SetAvailableTrack(), and cTimer::SetFile().

Here is the call graph for this function:

int Utf8SymChars ( const char *  s,
int  Symbols 
)

Returns the number of character bytes at the beginning of the given string that form at most the given number of UTF-8 symbols.

Definition at line 674 of file tools.c.

References cCharSetConv::SystemCharacterTable(), and Utf8CharLen().

Referenced by cMenuScheduleItem::Update(), and WeekDayName().

Here is the call graph for this function:

int Utf8ToArray ( const char *  s,
uint *  a,
int  Size 
)

Converts the given character bytes (including the terminating 0) into an array of UTF-8 symbols of the given Size. Returns the number of symbols in the array (without the terminating 0).

Definition at line 718 of file tools.c.

References cCharSetConv::SystemCharacterTable(), Utf8CharGet(), and Utf8CharLen().

Referenced by cMenuEditStrItem::EnterEditMode().

Here is the call graph for this function:

cString WeekDayName ( time_t  t  ) 

Definition at line 928 of file tools.c.

References WeekDayName().

Here is the call graph for this function:

cString WeekDayName ( int  WeekDay  ) 

Definition at line 913 of file tools.c.

References min(), strn0cpy(), tr, and Utf8SymChars().

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

Here is the call graph for this function:

cString WeekDayNameFull ( time_t  t  ) 

Definition at line 949 of file tools.c.

References WeekDayNameFull().

Here is the call graph for this function:

cString WeekDayNameFull ( int  WeekDay  ) 

Definition at line 934 of file tools.c.

References tr.

Referenced by WeekDayNameFull().

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

Definition at line 31 of file tools.c.

Referenced by main().


Generated on Tue Nov 4 19:57:16 2008 for VDR by  doxygen 1.5.6