spacing and braces, remove a dead unused function

This commit is contained in:
Isaac Connor 2018-04-11 10:50:28 -04:00
parent 22f86da372
commit 989ed65f52
3 changed files with 31 additions and 65 deletions

View File

@ -108,10 +108,10 @@ private:
bool mFlush;
private:
static void usrHandler( int sig );
static void usrHandler(int sig);
public:
friend void logInit( const char *name, const Options &options );
friend void logInit(const char *name, const Options &options);
friend void logTerm();
static Logger *fetch() {
@ -120,7 +120,7 @@ public:
Options options;
smInstance->initialise( "undef", options );
}
return( smInstance );
return smInstance;
}
private:
@ -128,16 +128,16 @@ private:
~Logger();
public:
void initialise( const std::string &id, const Options &options );
void initialise(const std::string &id, const Options &options);
void terminate();
private:
int limit( int level ) {
int limit(int level) {
if ( level > DEBUG9 )
return( DEBUG9 );
return DEBUG9;
if ( level < NOLOG )
return( NOLOG );
return( level );
return NOLOG;
return level;
}
bool boolEnv(const std::string &name, bool defaultValue=false);
@ -157,19 +157,19 @@ public:
Level level() const {
return mLevel;
}
Level level( Level=NOOPT );
Level level(Level=NOOPT);
bool debugOn() {
return( mEffectiveLevel >= DEBUG1 );
return mEffectiveLevel >= DEBUG1;
}
Level terminalLevel( Level=NOOPT );
Level databaseLevel( Level=NOOPT );
Level fileLevel( Level=NOOPT );
Level syslogLevel( Level=NOOPT );
Level terminalLevel(Level=NOOPT);
Level databaseLevel(Level=NOOPT);
Level fileLevel(Level=NOOPT);
Level syslogLevel(Level=NOOPT);
private:
void logFile( const std::string &logFile );
void logFile(const std::string &logFile);
void openFile();
void closeFile();
void openSyslog();
@ -177,22 +177,19 @@ private:
void closeDatabase();
public:
void logPrint( bool hex, const char * const filepath, const int line, const int level, const char *fstring, ... );
void logPrint(bool hex, const char * const filepath, const int line, const int level, const char *fstring, ...);
};
void logInit( const char *name, const Logger::Options &options=Logger::Options() );
void logInit(const char *name, const Logger::Options &options=Logger::Options());
void logTerm();
inline const std::string &logId() {
return( Logger::fetch()->id() );
return Logger::fetch()->id();
}
inline Logger::Level logLevel() {
return( Logger::fetch()->level() );
}
inline void logCapLevel( Logger::Level level ) {
Logger::fetch()->level( level );
return Logger::fetch()->level();
}
inline Logger::Level logDebugging() {
return( Logger::fetch()->debugOn() );
return Logger::fetch()->debugOn();
}
#define logPrintf(logLevel,params...) {\

View File

@ -78,19 +78,16 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
// Check for incoming command
switch( (MsgCommand)msg->msg_data[0] ) {
case CMD_PAUSE :
{
Debug( 1, "Got PAUSE command" );
Debug(1, "Got PAUSE command");
// Set paused flag
paused = true;
// Set delayed flag
delayed = true;
last_frame_sent = TV_2_FLOAT( now );
last_frame_sent = TV_2_FLOAT(now);
break;
}
case CMD_PLAY :
{
Debug( 1, "Got PLAY command" );
Debug(1, "Got PLAY command");
if ( paused ) {
// Clear paused flag
paused = false;
@ -99,10 +96,8 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
}
replay_rate = ZM_RATE_BASE;
break;
}
case CMD_VARPLAY :
{
Debug( 1, "Got VARPLAY command" );
Debug(1, "Got VARPLAY command");
if ( paused ) {
// Clear paused flag
paused = false;
@ -111,20 +106,16 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
}
replay_rate = ntohs(((unsigned char)msg->msg_data[2]<<8)|(unsigned char)msg->msg_data[1])-32768;
break;
}
case CMD_STOP :
{
Debug( 1, "Got STOP command" );
Debug(1, "Got STOP command");
// Clear paused flag
paused = false;
// Clear delayed_play flag
delayed = false;
break;
}
case CMD_FASTFWD :
{
Debug( 1, "Got FAST FWD command" );
Debug(1, "Got FAST FWD command");
if ( paused ) {
// Clear paused flag
paused = false;
@ -132,8 +123,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
delayed = true;
}
// Set play rate
switch ( replay_rate )
{
switch ( replay_rate ) {
case 2 * ZM_RATE_BASE :
replay_rate = 5 * ZM_RATE_BASE;
break;
@ -152,9 +142,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
break;
}
break;
}
case CMD_SLOWFWD :
{
Debug( 1, "Got SLOW FWD command" );
// Set paused flag
paused = true;
@ -165,9 +153,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
// Set step
step = 1;
break;
}
case CMD_SLOWREV :
{
Debug( 1, "Got SLOW REV command" );
// Set paused flag
paused = true;
@ -178,9 +164,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
// Set step
step = -1;
break;
}
case CMD_FASTREV :
{
Debug( 1, "Got FAST REV command" );
if ( paused ) {
// Clear paused flag
@ -208,9 +192,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
break;
}
break;
}
case CMD_ZOOMIN :
{
x = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
y = ((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
Debug( 1, "Got ZOOM IN command, to %d,%d", x, y );
@ -233,9 +215,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
break;
}
break;
}
case CMD_ZOOMOUT :
{
Debug( 1, "Got ZOOM OUT command" );
switch ( zoom ) {
case 500:
@ -256,36 +236,25 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
break;
}
break;
}
case CMD_PAN :
{
x = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
y = ((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
Debug( 1, "Got PAN command, to %d,%d", x, y );
break;
}
case CMD_SCALE :
{
scale = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
Debug( 1, "Got SCALE command, to %d", scale );
break;
}
case CMD_QUIT :
{
Info ("User initiated exit - CMD_QUIT");
break;
}
case CMD_QUERY :
{
Debug( 1, "Got QUERY command, sending STATUS" );
break;
}
default :
{
Error( "Got unexpected command %d", msg->msg_data[0] );
break;
}
}
} // end switch command
struct {
int id;
@ -331,7 +300,7 @@ void MonitorStream::processCommand( const CmdMsg *msg ) {
status_msg.msg_type = MSG_DATA_WATCH;
memcpy( &status_msg.msg_data, &status_data, sizeof(status_data) );
int nbytes = 0;
if ( (nbytes = sendto( sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr) )) < 0 ) {
if ( (nbytes = sendto(sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr))) < 0 ) {
//if ( errno != EAGAIN )
{
Error( "Can't sendto on sd %d: %s", sd, strerror(errno) );
@ -346,7 +315,7 @@ Debug(2, "NUmber of bytes sent to (%s): (%d)", rem_addr.sun_path, nbytes );
exit(0);
}
Debug(2,"Updating framrate");
Debug(2,"Updating framerate");
updateFrameRate( monitor->GetFPS() );
} // end void MonitorStream::processCommand( const CmdMsg *msg )

@ -1 +1 @@
Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5
Subproject commit 1351dde6b4c75b215099ae8bcf5a21d6c6e10298