spacing fixes

This commit is contained in:
Isaac Connor 2020-07-07 16:14:57 -04:00
parent af74ecac4c
commit c79c65e72e
4 changed files with 48 additions and 60 deletions

View File

@ -385,7 +385,7 @@ bool MonitorStream::sendFrame(Image *image, struct timeval *timestamp) {
gettimeofday(&frameStartTime, NULL);
fputs("--ZoneMinderFrame\r\n", stdout);
switch( type ) {
switch ( type ) {
case STREAM_JPEG :
send_image->EncodeJpeg(img_buffer, &img_buffer_size);
fputs("Content-Type: image/jpeg\r\n", stdout);

View File

@ -44,12 +44,9 @@ std::string trimSet(std::string str, std::string trimset) {
size_t endpos = str.find_last_not_of(trimset); // Find the first character position from reverse af
// if all spaces or empty return an empty string
if(( std::string::npos == startpos ) || ( std::string::npos == endpos))
{
if ( ( std::string::npos == startpos ) || ( std::string::npos == endpos) ) {
return std::string("");
}
else
return str.substr( startpos, endpos-startpos+1 );
return str.substr(startpos, endpos-startpos+1);
}
std::string trimSpaces(const std::string &str) {
@ -57,48 +54,46 @@ std::string trimSpaces(const std::string &str) {
}
std::string replaceAll(std::string str, std::string from, std::string to) {
if(from.empty())
if ( from.empty() )
return str;
size_t start_pos = 0;
while((start_pos = str.find(from, start_pos)) != std::string::npos) {
while ( (start_pos = str.find(from, start_pos)) != std::string::npos ) {
str.replace(start_pos, from.length(), to);
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
}
return str;
}
const std::string stringtf( const char *format, ... )
{
const std::string stringtf( const char *format, ... ) {
va_list ap;
char tempBuffer[8192];
std::string tempString;
va_start(ap, format );
vsnprintf( tempBuffer, sizeof(tempBuffer), format , ap );
va_start(ap, format);
vsnprintf(tempBuffer, sizeof(tempBuffer), format , ap);
va_end(ap);
tempString = tempBuffer;
return( tempString );
return tempString;
}
const std::string stringtf( const std::string format, ... )
{
const std::string stringtf(const std::string format, ...) {
va_list ap;
char tempBuffer[8192];
std::string tempString;
va_start(ap, format );
vsnprintf( tempBuffer, sizeof(tempBuffer), format.c_str() , ap );
va_start(ap, format);
vsnprintf(tempBuffer, sizeof(tempBuffer), format.c_str(), ap);
va_end(ap);
tempString = tempBuffer;
return( tempString );
return tempString;
}
bool startsWith(const std::string &haystack, const std::string &needle) {
return( haystack.substr(0, needle.length()) == needle );
return ( haystack.substr(0, needle.length()) == needle );
}
StringVector split(const std::string &string, const std::string &chars, int limit) {
@ -145,8 +140,7 @@ const std::string join(const StringVector &v, const char * delim=",") {
const std::string base64Encode(const std::string &inString) {
static char base64_table[64] = { '\0' };
if ( !base64_table[0] )
{
if ( !base64_table[0] ) {
int i = 0;
for ( char c = 'A'; c <= 'Z'; c++ )
base64_table[i++] = c;
@ -159,59 +153,52 @@ const std::string base64Encode(const std::string &inString) {
}
std::string outString;
outString.reserve( 2 * inString.size() );
outString.reserve(2 * inString.size());
const char *inPtr = inString.c_str();
while( *inPtr )
{
while ( *inPtr ) {
unsigned char selection = *inPtr >> 2;
unsigned char remainder = (*inPtr++ & 0x03) << 4;
outString += base64_table[selection];
if ( *inPtr )
{
if ( *inPtr ) {
selection = remainder | (*inPtr >> 4);
remainder = (*inPtr++ & 0x0f) << 2;
outString += base64_table[selection];
if ( *inPtr )
{
if ( *inPtr ) {
selection = remainder | (*inPtr >> 6);
outString += base64_table[selection];
selection = (*inPtr++ & 0x3f);
outString += base64_table[selection];
}
else
{
} else {
outString += base64_table[remainder];
outString += '=';
}
}
else
{
} else {
outString += base64_table[remainder];
outString += '=';
outString += '=';
}
}
return( outString );
return outString;
}
int split(const char* string, const char delim, std::vector<std::string>& items) {
if(string == NULL)
if ( string == NULL )
return -1;
if(string[0] == 0)
if ( string[0] == 0 )
return -2;
std::string str(string);
while(true) {
while ( true ) {
size_t pos = str.find(delim);
items.push_back(str.substr(0, pos));
str.erase(0, pos+1);
if(pos == std::string::npos)
if ( pos == std::string::npos )
break;
}
@ -219,16 +206,16 @@ int split(const char* string, const char delim, std::vector<std::string>& items)
}
int pairsplit(const char* string, const char delim, std::string& name, std::string& value) {
if(string == NULL)
if ( string == NULL )
return -1;
if(string[0] == 0)
if ( string[0] == 0 )
return -2;
std::string str(string);
size_t pos = str.find(delim);
if(pos == std::string::npos || pos == 0 || pos >= str.length())
if ( pos == std::string::npos || pos == 0 || pos >= str.length() )
return -3;
name = str.substr(0, pos);
@ -277,33 +264,33 @@ void hwcaps_detect() {
);
#endif
if (r_ebx & 0x00000020) {
if ( r_ebx & 0x00000020 ) {
sseversion = 52; /* AVX2 */
Debug(1,"Detected a x86\\x86-64 processor with AVX2");
} else if (r_ecx & 0x10000000) {
Debug(1, "Detected a x86\\x86-64 processor with AVX2");
} else if ( r_ecx & 0x10000000 ) {
sseversion = 51; /* AVX */
Debug(1,"Detected a x86\\x86-64 processor with AVX");
} else if (r_ecx & 0x00100000) {
Debug(1, "Detected a x86\\x86-64 processor with AVX");
} else if ( r_ecx & 0x00100000 ) {
sseversion = 42; /* SSE4.2 */
Debug(1,"Detected a x86\\x86-64 processor with SSE4.2");
} else if (r_ecx & 0x00080000) {
Debug(1, "Detected a x86\\x86-64 processor with SSE4.2");
} else if ( r_ecx & 0x00080000 ) {
sseversion = 41; /* SSE4.1 */
Debug(1,"Detected a x86\\x86-64 processor with SSE4.1");
} else if (r_ecx & 0x00000200) {
Debug(1, "Detected a x86\\x86-64 processor with SSE4.1");
} else if ( r_ecx & 0x00000200 ) {
sseversion = 35; /* SSSE3 */
Debug(1,"Detected a x86\\x86-64 processor with SSSE3");
} else if (r_ecx & 0x00000001) {
} else if ( r_ecx & 0x00000001 ) {
sseversion = 30; /* SSE3 */
Debug(1,"Detected a x86\\x86-64 processor with SSE3");
} else if (r_edx & 0x04000000) {
Debug(1, "Detected a x86\\x86-64 processor with SSE3");
} else if ( r_edx & 0x04000000 ) {
sseversion = 20; /* SSE2 */
Debug(1,"Detected a x86\\x86-64 processor with SSE2");
} else if (r_edx & 0x02000000) {
Debug(1, "Detected a x86\\x86-64 processor with SSE2");
} else if ( r_edx & 0x02000000 ) {
sseversion = 10; /* SSE */
Debug(1,"Detected a x86\\x86-64 processor with SSE");
Debug(1, "Detected a x86\\x86-64 processor with SSE");
} else {
sseversion = 0;
Debug(1,"Detected a x86\\x86-64 processor");
Debug(1, "Detected a x86\\x86-64 processor");
}
#elif defined(__arm__)
// ARM processor in 32bit mode

View File

@ -259,7 +259,8 @@ int main(int argc, char *argv[]) {
Debug(1, "Failed to prime capture of initial monitor");
}
prime_capture_log_count ++;
sleep(10);
if ( !zm_terminate )
sleep(10);
continue;
}

View File

@ -1 +1 @@
1.34.16
1.35.5