#define OPTIONTYPE_TEXT 1
#define OPTIONTYPE_INT 2
-//#define SCREENWIDTH 720
-//#define SCREENHEIGHT 576
-//#define SCREENHEIGHT 480
-
-//extern int SCREENWIDTH;
-//extern int SCREENHEIGHT;
-
ULLONG htonll(ULLONG a);
ULLONG ntohll(ULLONG a);
+#ifdef WIN32
+#define SNPRINTF _snprintf
+#define VSNPRINTF _vsnprintf
+#else
+#define SNPRINTF snprintf
+#define VSNPRINTF vsnprintf
+#endif
+
#endif
gettimeofday(&tv, NULL);
struct tm* tms = localtime(&tv.tv_sec);
spaceLeft -= strftime(buffer, spaceLeft, "%H:%M:%S.", tms);
- spaceLeft -= snprintf(&buffer[150-spaceLeft], spaceLeft, "%06lu ", (unsigned long)tv.tv_usec);
+ spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%06lu ", (unsigned long)tv.tv_usec);
char levelString[10];
if (level == INFO) strcpy(levelString, "[info] ");
if (level == DEBUG) strcpy(levelString, "[debug] ");
- spaceLeft -= snprintf(&buffer[150-spaceLeft], spaceLeft, "%s %s - ", levelString, fromModule);
+ spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %s - ", levelString, fromModule);
va_list ap;
va_start(ap, message);
- spaceLeft = vsnprintf(&buffer[150-spaceLeft], spaceLeft, message, ap);
+ spaceLeft = VSNPRINTF(&buffer[150-spaceLeft], spaceLeft, message, ap);
va_end(ap);
int messageLength = strlen(buffer);
#include <sys/time.h>
#include <string.h>
#include <stdarg.h>
+#include "defines.h"
class Log
{
switch(first)
{
- case 0 ... 9:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
{
sprintf(text, "%i", first);
drawText(text, 7, 5, Colour::LIGHTTEXT);
switch(second)
{
- case 0 ... 9:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
{
sprintf(text, "%i", second);
drawText(text, 20, 5, Colour::LIGHTTEXT);
switch(third)
{
- case 0 ... 9:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
{
sprintf(text, "%i", third);
drawText(text, 33, 5, Colour::LIGHTTEXT);
{
switch(command)
{
- case Remote::ZERO ... Remote::NINE:
+ case Remote::ZERO:
+ case Remote::ONE:
+ case Remote::TWO:
+ case Remote::THREE:
+ case Remote::FOUR:
+ case Remote::FIVE:
+ case Remote::SIX:
+ case Remote::SEVEN:
+ case Remote::EIGHT:
+ case Remote::NINE:
{
if (numGot == 2) first = second;
second = third;
strcpy(eventTitle, event->title);
for(UINT i=0; i < strlen(eventTitle); i++) if (eventTitle[i] == ':') eventTitle[i] = '|';
- snprintf(timerString, 1023, "%i:%lu:%s:%s:%s:%s:%s:%s:",
+ SNPRINTF(timerString, 1023, "%i:%lu:%s:%s:%s:%s:%s:%s:",
flags, channel->number, dateString,
startString, endString,
priority, lifetime, eventTitle);
// get the data
char ttitleText[100];
- snprintf(ttitleText, 99, "%03lu - %s", currentChannel->number, currentChannel->name);
+ SNPRINTF(ttitleText, 99, "%03lu - %s", currentChannel->number, currentChannel->name);
setTitleText(ttitleText);
eventList = VDR::getInstance()->getChannelSchedule(currentChannel->number);
btime = localtime((time_t*)&event->time);
strftime(tempString2, 299, "%0H:%0M ", btime);
- snprintf(tempString, 299, "%s %s", tempString2, event->title);
+ SNPRINTF(tempString, 299, "%s %s", tempString2, event->title);
event->index = sl.addOption(tempString, first);
first = 0;
}
for (i = recDir->dirList.begin(); i != recDir->dirList.end(); i++)
{
dir = *i;
- snprintf(tempA, 299, tr("<dir> %lu\t%s"), dir->getNumRecordings(), dir->name);
+ SNPRINTF(tempA, 299, tr("<dir> %lu\t%s"), dir->getNumRecordings(), dir->name);
dir->index = sl.addOption(tempA, first);
first = 0;
}
char title[300];
if (myParent)
{
- snprintf(title, 299, tr("Recordings - %s"), recDir->name);
+ SNPRINTF(title, 299, tr("Recordings - %s"), recDir->name);
setTitleText(title);
}
else
char freeSpace[50];
int gigFree = Directory::freeSpace / 1024;
- snprintf(freeSpace, 49, tr("%lu%% used, %iGB free"), Directory::usedPercent, gigFree);
+ SNPRINTF(freeSpace, 49, tr("%lu%% used, %iGB free"), Directory::usedPercent, gigFree);
drawTextRJ(freeSpace, 560, 5, Colour::LIGHTTEXT);
// Symbols
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
// Channel
- snprintf(buffer, 999, "%lu", recTimer->channelNumber);
+ SNPRINTF(buffer, 999, "%lu", recTimer->channelNumber);
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
// Name
- snprintf(buffer, 999, "%s", recTimer->getName());
+ SNPRINTF(buffer, 999, "%s", recTimer->getName());
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
// Directory
- if (recTimer->getDirectory()) snprintf(buffer, 999, "%s", recTimer->getDirectory());
+ if (recTimer->getDirectory()) SNPRINTF(buffer, 999, "%s", recTimer->getDirectory());
else strcpy(buffer, "");
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
ypos += surface->getFontHeight();
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
// Priority
- snprintf(buffer, 999, "%lu", recTimer->priority);
+ SNPRINTF(buffer, 999, "%lu", recTimer->priority);
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
// Lifetime
- snprintf(buffer, 999, "%lu", recTimer->lifeTime);
+ SNPRINTF(buffer, 999, "%lu", recTimer->lifeTime);
drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
ypos += surface->getFontHeight();
btime = localtime((time_t*)&recTimer->startTime);
strftime(strA, 299, "%d/%m %H:%M ", btime);
- snprintf(strB, 299, "%s\t%s", strA, recTimer->getName());
+ SNPRINTF(strB, 299, "%s\t%s", strA, recTimer->getName());
recTimer->index = sl.addOption(strB, first);
first = 0;
}
}
else
{
- snprintf(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", chours, cminutes, cseconds, ehours, eminutes, eseconds);
+ SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", chours, cminutes, cseconds, ehours, eminutes, eseconds);
}
drawText(buffer, clocksRegion.x, clocksRegion.y, Colour::LIGHTTEXT);