diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index 64ecf4bb4..81d888128 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -640,7 +640,7 @@ int parse_response(URL *url, void *opt, CSTATE *state) /* then return now with the content length as return value */ getHeaderVal("Content-Length:", rval); // dprintf(stderr, "file size: %d\n", rval); - if(rval >= 0) + if(rval >= 0) return rval; /* yet another hack: this is only implemented to be able to fetch */ @@ -654,7 +654,7 @@ int parse_response(URL *url, void *opt, CSTATE *state) /* no content length indication from the server ? Then treat it as stream */ getHeaderVal("icy-metaint:", meta_interval); - if(meta_interval < 0) + if(meta_interval < 0) meta_interval = 0; if (state != NULL) { @@ -1069,7 +1069,7 @@ FILE *f_open(const char *filename, const char *acctype) /* try to connect to all servers until we find one that */ /* is willing to serve us */ { - int i; + int i; for(i=0, fd = NULL; ((fd == NULL) && (i<25)); i++) { const char* const chptr = strstr(servers[i], "://"); @@ -1415,7 +1415,7 @@ int push(FILE *fd, char *buf, long len) for(j=0; j<2; j++) { - if(amt[j] > blen) + if(amt[j] > blen) amt[j] = blen; if(amt[j]) @@ -1576,7 +1576,7 @@ int pop(FILE *fd, char *buf, long len) if(cache[i].filter_arg) if(cache[i].filter_arg->state) - cache[i].filter_arg->state->buffered = 65536L * (long long)cache[i].filled / (long long)CACHESIZE; + cache[i].filter_arg->state->buffered = 65536L * (int64_t)cache[i].filled / (int64_t)CACHESIZE; return rval; } @@ -1618,11 +1618,11 @@ void CacheFillThread(void *c) if (ret > 0 && (pfd.revents & POLLIN) == POLLIN) { #if 0 //FIXME: fread blocks i/o on dead connection rval = fread(buf, 1, datalen, scache->fd); - if ((rval == 0) && feof(scache->fd)) + if ((rval == 0) && feof(scache->fd)) break; /* exit cache fill thread if eof and nothing to push */ #else rval = read(fileno(scache->fd), buf, datalen); - if (rval == 0) + if (rval == 0) break; /* exit cache fill thread if eof and nothing to push */ #endif /* if there is a filter function set up for this stream, then */ @@ -1638,7 +1638,7 @@ void CacheFillThread(void *c) if( push(scache->fd, buf, rval) < 0) break; } - } + } while(!scache->closed); //while( (rval == datalen) && (!scache->closed) ); @@ -1719,7 +1719,7 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) ptr = strchr(md, '='); strncpy(state->title, ptr + 2, 4096); ptr = strchr(state->title, ';'); - if(ptr) + if(ptr) *(ptr - 1) = 0; state->artist[0] = 0; } @@ -1728,7 +1728,7 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) SKIP(ptr); strcpy(state->title, ptr); ptr = strchr(state->title, ';'); - if(ptr) + if(ptr) *(ptr - 1) = 0; ptr = strstr(md, "StreamTitle="); @@ -1738,7 +1738,7 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) if(!ptr) ptr = strstr(state->artist, ", "); - if(ptr) + if(ptr) *ptr = 0; } state->state = RUNNING; @@ -1749,9 +1749,9 @@ void ShoutCAST_DestroyFilter(void *a) { STREAM_FILTER *arg = (STREAM_FILTER*)a; - if(arg->state) + if(arg->state) free(arg->state), arg->state = NULL; - if(arg->user) + if(arg->user) free(arg->user), arg->user = NULL; } @@ -1937,14 +1937,14 @@ void parseURL_url(URL& url) { /* extract the file path from the url */ ptr = strchr(ptr + 3, '/'); - if(ptr) + if(ptr) strcpy(url.file, ptr); - else + else strcpy(url.file, "/"); /* extract the host part from the url */ ptr = strchr(url.host, '/'); - if(ptr) + if(ptr) *ptr = 0; if ((ptr = strchr(url.host, '@'))) diff --git a/src/gui/alphasetup.cpp b/src/gui/alphasetup.cpp index 67e2cbd1e..47e887289 100644 --- a/src/gui/alphasetup.cpp +++ b/src/gui/alphasetup.cpp @@ -103,7 +103,7 @@ int CAlphaSetup::exec(CMenuTarget* parent, const std::string &) int selected = 0; // int max = 1; - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings ::TIMING_MENU]); bool loop=true; diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index b858b3513..59694a4fe 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -55,11 +55,11 @@ typedef std::pair CTitle2PosItem; class CAudiofileExt : public CAudiofile { public: - + CAudiofileExt(); CAudiofileExt(std::string name, CFile::FileType type); - + CAudiofileExt(const CAudiofileExt& src); void operator=(const CAudiofileExt& src); @@ -80,7 +80,7 @@ class RandomNumber int operator()(int n) { - return ((long long)n * rand() / RAND_MAX); + return ((int64_t)n * rand() / RAND_MAX); } }; @@ -207,9 +207,9 @@ class CAudioPlayerGui : public CMenuTarget void getFileInfoToDisplay(std::string& fileInfo, CAudiofileExt &file); void printSearchTree(); - + void buildSearchTree(); - + unsigned char getFirstChar(CAudiofileExt &file); void printTimevalDiff(timeval &start, timeval &end); @@ -225,7 +225,7 @@ class CAudioPlayerGui : public CMenuTarget * Example: * absFilename: /mnt/audio/A/abc.mp3 * fromDir: /mnt/audio/B - * => ../A/abc.mp3 will be returned + * => ../A/abc.mp3 will be returned * @param fromDir the directory from where we want to * access the file * @param absFilename the file we want to access in a @@ -235,8 +235,8 @@ class CAudioPlayerGui : public CMenuTarget */ std::string absPath2Rel(const std::string& fromDir, const std::string& absFilename); - - /** + + /** * Asks the user if the file filename should be overwritten or not * @param filename the name of the file * @return true if file should be overwritten, false otherwise @@ -248,7 +248,7 @@ class CAudioPlayerGui : public CMenuTarget bool shufflePlaylist(void); bool playNext(bool allow_rotate = false); bool playPrev(bool allow_rotate = false); - + public: CAudioPlayerGui(bool inetmode = false); ~CAudioPlayerGui(); diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 9ef958571..5a6ea7aac 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -253,7 +253,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) int res = -1; - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); uint32_t msg; uint32_t data; diff --git a/src/gui/cam_menu.h b/src/gui/cam_menu.h index 09d629bee..4290b83ca 100644 --- a/src/gui/cam_menu.h +++ b/src/gui/cam_menu.h @@ -34,7 +34,7 @@ class CCAMMenuHandler : public CMenuTarget private: CHintBox * hintBox; cDvbCi * ci; - unsigned long long timeoutEnd; + uint64_t timeoutEnd; //int slot; int doMenu(int slot); int doMainMenu(); diff --git a/src/gui/dmx_tspidbandwidth.c b/src/gui/dmx_tspidbandwidth.c index 7f6fccb7e..07ced12f5 100644 --- a/src/gui/dmx_tspidbandwidth.c +++ b/src/gui/dmx_tspidbandwidth.c @@ -24,7 +24,7 @@ int ts_pidbandwidth (OPTION *opt) int dmxfd; struct timeval tv,last_tv, first_tv; int pid; - unsigned long long b_total; + uint64_t b_total; long b; long packets_bad; long packets_total; @@ -113,7 +113,7 @@ int ts_pidbandwidth (OPTION *opt) b_len = read(pfd.fd, buf, sizeof(buf)); gettimeofday (&tv, NULL); - + if (b_len >= TS_LEN) { b_start = sync_ts (buf, b_len); } else { @@ -134,7 +134,7 @@ int ts_pidbandwidth (OPTION *opt) // -- calc bandwidth { - unsigned long long bit_s; + uint64_t bit_s; long d_tim_ms; int packets; @@ -142,36 +142,36 @@ int ts_pidbandwidth (OPTION *opt) packets_total += packets; - // output on different verbosity levels + // output on different verbosity levels // -- current bandwidth d_tim_ms = delta_time_ms (&tv, &last_tv); - if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs + if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs out (3, "packets read: %3d/(%ld) d_time: %2ld.%03ld s = ", packets, packets_total, d_tim_ms / 1000UL, d_tim_ms % 1000UL); // -- current bandwidth in kbit/sec - // --- cast to unsigned long long so it doesn't overflow as + // --- cast to uint64_t so it doesn't overflow as // --- early, add time / 2 before division for correct rounding - bit_s = (((unsigned long long)b * 8000ULL) + ((unsigned long long)d_tim_ms / 2ULL)) - / (unsigned long long)d_tim_ms; + bit_s = (((uint64_t)b * 8000ULL) + ((uint64_t)d_tim_ms / 2ULL)) + / (uint64_t)d_tim_ms; out (1, "%5llu.%03llu kbit/s", bit_s / 1000ULL, bit_s % 1000ULL); // -- average bandwidth d_tim_ms = delta_time_ms (&tv,&first_tv); - if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs + if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs - bit_s = ((b_total * 8000ULL) + ((unsigned long long)d_tim_ms / 2ULL)) - / (unsigned long long)d_tim_ms; + bit_s = ((b_total * 8000ULL) + ((uint64_t)d_tim_ms / 2ULL)) + / (uint64_t)d_tim_ms; last_avg.kb_sec = (unsigned long) (bit_s / 1000ULL); last_avg.b_sec = (unsigned long) (bit_s % 1000ULL); out (2, " (Avrg: %5lu.%03lu kbit/s)", last_avg.kb_sec, last_avg.b_sec); - + // -- bad packet(s) check in buffer { int bp; diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index b1f5b8172..208bee4ce 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -167,7 +167,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) while (!istheend) { - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd_MS(250); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS(250); msg = CRCInput::RC_nokey; while (!(msg == CRCInput::RC_timeout) && (!(msg == CRCInput::RC_home))) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 8f6ecc051..1b3e414da 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -920,7 +920,7 @@ int CMovieBrowser::exec(const char* path) if ( timeout == -1 ) timeout = g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]; - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout ); if(m_settings.remount == true) { @@ -1195,7 +1195,7 @@ void CMovieBrowser::refreshMovieInfo(void) std::string lname; if(g_PicViewer->GetLogoName(m_movieSelectionHandler->epgEpgId >>16, m_movieSelectionHandler->epgChannel, lname)) g_PicViewer->DisplayImage(lname, lx, ly, PIC_W, PIC_H); - + if(logo_ok) { #if 0 lx = m_cBoxFrameInfo.iX+m_cBoxFrameInfo.iWidth - picw -10; diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index f74bcaac4..bf9a5e943 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -142,7 +142,7 @@ int CStreamInfo2::doSignalStrengthLoop () lastsnr = lastsig = -1; neutrino_msg_t msg; - unsigned long long maxb, minb, lastb, tmp_rate; + uint64_t maxb, minb, lastb, tmp_rate; int cnt = 0,i=0; uint16_t ssig, ssnr; uint32_t ber; @@ -156,7 +156,7 @@ int CStreamInfo2::doSignalStrengthLoop () while (1) { neutrino_msg_data_t data; - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd_MS (100); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100); g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); ssig = frontend->getSignalStrength(); @@ -696,7 +696,7 @@ long delta_time_ms (struct timeval *tv, struct timeval *last_tv) return timeval_to_ms (tv) - timeval_to_ms (last_tv); } -unsigned long long b_total; +uint64_t b_total; static cDemux * dmx; int CStreamInfo2::ts_setup () @@ -749,15 +749,15 @@ int CStreamInfo2::update_rate () if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs - bit_s = (((unsigned long long) b * 8000ULL) + ((unsigned long long) d_tim_ms / 2ULL)) - / (unsigned long long) d_tim_ms; + bit_s = (((uint64_t) b * 8000ULL) + ((uint64_t) d_tim_ms / 2ULL)) + / (uint64_t) d_tim_ms; d_tim_ms = delta_time_ms (&tv, &first_tv); if (d_tim_ms <= 0) d_tim_ms = 1; // ignore usecs - abit_s = ((b_total * 8000ULL) + ((unsigned long long) d_tim_ms / 2ULL)) - / (unsigned long long) d_tim_ms; + abit_s = ((b_total * 8000ULL) + ((uint64_t) d_tim_ms / 2ULL)) + / (uint64_t) d_tim_ms; last_tv.tv_sec = tv.tv_sec; last_tv.tv_usec = tv.tv_usec; diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index 99896fa7a..878821f46 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -42,7 +42,7 @@ class CStreamInfo2 : public CMenuTarget int hheight,iheight,sheight; // head/info/small font height int max_height; // Frambuffer 0.. max - int max_width; + int max_width; int yypos; int paint_mode; @@ -67,7 +67,7 @@ class CStreamInfo2 : public CMenuTarget unsigned long sig, old_sig, max_sig, min_sig; unsigned long snr, old_snr, max_snr, min_snr; } signal; - + struct bitrate { unsigned int short_average, max_short_average, min_short_average; } rate; @@ -76,9 +76,9 @@ class CStreamInfo2 : public CMenuTarget int dvrfd, dmxfd; struct timeval tv, last_tv, first_tv; - unsigned long long bit_s; - unsigned long long abit_s; - unsigned long long b_total; + uint64_t bit_s; + uint64_t abit_s; + uint64_t b_total; int update_rate(); int ts_setup(); diff --git a/src/gui/widget/lcdcontroler.cpp b/src/gui/widget/lcdcontroler.cpp index 8e1f228f7..f12a127f8 100644 --- a/src/gui/widget/lcdcontroler.cpp +++ b/src/gui/widget/lcdcontroler.cpp @@ -99,7 +99,7 @@ int CLcdControler::exec(CMenuTarget* parent, const std::string &) CLCD::getInstance()->setAutoDimm(0); // autodimm deactivated to control and see the real settings paint(); - unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); bool loop=true; while (loop) diff --git a/src/nhttpd/yhttpd_core/ywebserver.cpp b/src/nhttpd/yhttpd_core/ywebserver.cpp index 2984ef1df..3c0a38b27 100644 --- a/src/nhttpd/yhttpd_core/ywebserver.cpp +++ b/src/nhttpd/yhttpd_core/ywebserver.cpp @@ -1,6 +1,6 @@ //============================================================================= // YHTTPD -// Webserver Class : Until now: exact one instance +// Webserver Class : Until now: exact one instance //============================================================================= // c++ #include @@ -52,7 +52,7 @@ CWebserver::CWebserver() //pthread_attr_init(&attr); //pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); port=80; - + } //----------------------------------------------------------------------------- @@ -61,22 +61,22 @@ CWebserver::~CWebserver() listenSocket.close(); } //============================================================================= -// Start Webserver. Main-Loop. +// Start Webserver. Main-Loop. //----------------------------------------------------------------------------- // Wait for Connection and schedule ist to handle_connection() // HTTP/1.1 should can handle "keep-alive" connections to reduce socket -// creation and handling. This is handled using FD_SET and select Socket +// creation and handling. This is handled using FD_SET and select Socket // mechanism. -// select wait for socket-activity. Cases: +// select wait for socket-activity. Cases: // 1) get a new connection // 2) re-use a socket -// 3) timeout: close unused sockets +// 3) timeout: close unused sockets //----------------------------------------------------------------------------- // from RFC 2616: // 8 Connections // 8.1 Persistent Connections // 8.1.1 Purpose -// +// // Prior to persistent connections, a separate TCP connection was // established to fetch each URL, increasing the load on HTTP servers // and causing congestion on the Internet. The use of inline images and @@ -87,32 +87,32 @@ CWebserver::~CWebserver() // measurements of actual HTTP/1.1 (RFC 2068) implementations show good // results [39]. Alternatives have also been explored, for example, // T/TCP [27]. -// +// // Persistent HTTP connections have a number of advantages: -// +// // - By opening and closing fewer TCP connections, CPU time is saved // in routers and hosts (clients, servers, proxies, gateways, // tunnels, or caches), and memory used for TCP protocol control // blocks can be saved in hosts. -// +// // - HTTP requests and responses can be pipelined on a connection. // Pipelining allows a client to make multiple requests without // waiting for each response, allowing a single TCP connection to // be used much more efficiently, with much lower elapsed time. -// +// // - Network congestion is reduced by reducing the number of packets // caused by TCP opens, and by allowing TCP sufficient time to // determine the congestion state of the network. -// +// // - Latency on subsequent requests is reduced since there is no time // spent in TCP's connection opening handshake. -// +// // - HTTP can evolve more gracefully, since errors can be reported // without the penalty of closing the TCP connection. Clients using // future versions of HTTP might optimistically try a new feature, // but if communicating with an older server, retry with old // semantics after an error is reported. -// +// // HTTP implementations SHOULD implement persistent connections. //============================================================================= #define MAX_TIMEOUTS_TO_CLOSE 10 @@ -134,7 +134,7 @@ bool CWebserver::run(void) fcntl(listener, F_SETFD , O_NONBLOCK); // listener master socket non-blocking int timeout_counter = 0; // Counter for Connection Timeout checking int test_counter = 0; // Counter for Testing long running Connections - + // main Webserver Loop while(!terminate) { @@ -143,8 +143,8 @@ bool CWebserver::run(void) tv.tv_usec = 10000; // microsec: Timeout for select ! for re-use / keep-alive socket tv.tv_sec = 0; // seconds int fd = -1; - - // select : wait for socket activity + + // select : wait for socket activity if(open_connections <= 0) // No open Connection. Wait in select. fd = select(fdmax+1,&read_fds, NULL, NULL, NULL);// wait for socket activity else @@ -167,7 +167,7 @@ bool CWebserver::run(void) // Testoutput for long living threads if(++test_counter >= MAX_TIMEOUTS_TO_TEST) { - for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) + for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) if(SocketList[j] != NULL) // here is a socket log_level_printf(2,"FD-TEST sock:%d handle:%d open:%d\n",SocketList[j]->get_socket(), SocketList[j]->handling,SocketList[j]->isOpened); @@ -179,10 +179,10 @@ bool CWebserver::run(void) CloseConnectionSocketsByTimeout(); timeout_counter=0; } - continue; // main loop again + continue; // main loop again } //---------------------------------------------------------------------------------------- - // Check all observed descriptors & check new or re-use Connections + // Check all observed descriptors & check new or re-use Connections //---------------------------------------------------------------------------------------- for(int i = listener; i <= fdmax; i++) { @@ -209,7 +209,7 @@ bool CWebserver::run(void) char httpstr[]=HTTP_PROTOCOL " 503 Service Unavailable\r\n\r\n"; SocketList[slot]->Send(httpstr, strlen(httpstr)); SL_CloseSocketBySlot(slot); - } + } } } }// for @@ -245,8 +245,8 @@ int CWebserver::AcceptNewConnectionSocket() { int slot = -1; CySocket *connectionSock = NULL; - int newfd; - + int newfd; + if(!(connectionSock = listenSocket.accept() )) // Blocking wait { dperror("Socket accept error. Continue.\n"); @@ -256,7 +256,7 @@ int CWebserver::AcceptNewConnectionSocket() #ifdef Y_CONFIG_USE_OPEN_SSL if(Cyhttpd::ConfigList["SSL"]=="true") connectionSock->initAsSSL(); // make it a SSL-socket -#endif +#endif log_level_printf(2,"FD: new con fd:%d on port:%d\n",connectionSock->get_socket(), connectionSock->get_accept_port()); // Add Socket to List @@ -284,7 +284,7 @@ int CWebserver::AcceptNewConnectionSocket() int CWebserver::SL_GetExistingSocket(SOCKET sock) { int slot = -1; - for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) + for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) if(SocketList[j] != NULL // here is a socket && SocketList[j]->get_socket() == sock) // we know that socket { @@ -299,7 +299,7 @@ int CWebserver::SL_GetExistingSocket(SOCKET sock) int CWebserver::SL_GetFreeSlot() { int slot = -1; - for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) + for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) if(SocketList[j] == NULL) // here is a free slot { slot = j; @@ -314,7 +314,7 @@ int CWebserver::SL_GetFreeSlot() void CWebserver::CloseConnectionSocketsByTimeout() { CySocket *connectionSock = NULL; - for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) + for(int j=0;j < HTTPD_MAX_CONNECTIONS;j++) if(SocketList[j] != NULL // here is a socket && !SocketList[j]->handling) // it is not handled { @@ -329,7 +329,7 @@ void CWebserver::CloseConnectionSocketsByTimeout() struct timeval tv_now; struct timezone tz_now; gettimeofday(&tv_now, &tz_now); - long long tdiff = ((tv_now.tv_sec - connectionSock->tv_start_waiting.tv_sec) * 1000000 + int64_t tdiff = ((tv_now.tv_sec - connectionSock->tv_start_waiting.tv_sec) * 1000000 + (tv_now.tv_usec - connectionSock->tv_start_waiting.tv_usec)); if(tdiff < HTTPD_KEEPALIVE_TIMEOUT || tdiff <0) shouldClose = false; @@ -343,7 +343,7 @@ void CWebserver::CloseConnectionSocketsByTimeout() } //----------------------------------------------------------------------------- // Add Socket fd to FD_SET again (for select-handling) -// Add start-time for waiting for connection re-use / keep-alive +// Add start-time for waiting for connection re-use / keep-alive //----------------------------------------------------------------------------- void CWebserver::addSocketToMasterSet(SOCKET fd) { @@ -356,11 +356,11 @@ void CWebserver::addSocketToMasterSet(SOCKET fd) gettimeofday(&tv_now, &tz_now); SocketList[slot]->tv_start_waiting = tv_now; // add keep-alive wait time FD_SET(fd, &master); // add fd to select-master-set -} - +} + //----------------------------------------------------------------------------- // Close (FD_SET handled) Socket -// Clear it from SocketList +// Clear it from SocketList //----------------------------------------------------------------------------- void CWebserver::SL_CloseSocketBySlot(int slot) { @@ -397,7 +397,7 @@ bool CWebserver::CheckKeepAliveAllowedByIP(std::string client_ip) //----------------------------------------------------------------------------- // Set Entry(number)to NULL in Threadlist //----------------------------------------------------------------------------- -void CWebserver::clear_Thread_List_Number(int number) +void CWebserver::clear_Thread_List_Number(int number) { pthread_mutex_lock( &mutex ); if(number event_name_length-1)); #endif - } else + } else #endif // 0 { #ifdef ENABLE_FREESATEPG @@ -413,7 +413,7 @@ void SIsectionEIT::parseShortEventDescriptor(const char *buf, SIevent &e, unsign #else e.setText(language, std::string((++buf)+1, textlength-1)); #endif - } else + } else #endif // 0 { #ifdef ENABLE_FREESATEPG @@ -615,7 +615,7 @@ void SIsectionPPT::parsePrivateContentOrderDescriptor(const char *buf, SIevent & return; // defekt #if 0 -// to be done +// to be done unsigned char Order_number_length; char Order_number[Order_number_length]; unsigned char Order_price_length; @@ -750,7 +750,7 @@ void SIsectionPPT::parse(void) } actPos = &buffer[sizeof(SI_section_PPT_header)]; - + /*while (actPos < &buffer[bufferLength])*/ { SIevent e; descriptors_loop_length = (((SI_section_PPT_header*)buffer)->descriptor_section_length_hi << 8) | ((SI_section_PPT_header*)buffer)->descriptor_section_length_lo; @@ -905,7 +905,7 @@ void SIsectionBAT::parseBouquetNameDescriptor(const char *buf, SIbouquet &s) struct descr_generic_header *sv=(struct descr_generic_header *)buf; buf+=sizeof(struct descr_generic_header); if(sv->descriptor_length) { - + // if(*buf < 0x06) // other code table // s.bouquetName=std::string(buf+1, sv->descriptor_length-1); //else @@ -1008,21 +1008,21 @@ void SIsectionBAT::parse(void) buf+=sizeof(struct descr_generic_header); struct private_data_specifier *pds=(struct private_data_specifier *)buf; buf+=sizeof(struct private_data_specifier); - current_private_data_specifier=(((pds->byte1 << 24) | (pds->byte2 << 16)) | (pds->byte3 << 8)) | pds->byte4; + current_private_data_specifier=(((pds->byte1 << 24) | (pds->byte2 << 16)) | (pds->byte3 << 8)) | pds->byte4; //printf("Private Data Specifier: %08x\n", current_private_data_specifier); } len-=desc->descriptor_length+2; des+=desc->descriptor_length+2; } //s.bouquetName = bouquetName; - + actPos += sizeof(SI_section_BAT_header) + descriptors_loop_length; - + ll = (struct loop_len *)actPos; descriptors_loop_length = (ll->descriptors_loop_length_hi << 8) | ll->descriptors_loop_length_lo; //len is not used at the moment // printf("desclen: %hu\n", descriptors_loop_length); actPos += sizeof(loop_len); - + if (bouquet_id != 0x0001) { while (actPos <= &buffer[bufferLength - sizeof(struct bat_service)]) { sv = (struct bat_service *)actPos; @@ -1032,15 +1032,15 @@ void SIsectionBAT::parse(void) // printf("Section Number: %d Count: %d position: %04x\n", bh->section_number, count, s.position); descriptors_length = (sv->descriptors_loop_length_hi << 8) | sv->descriptors_loop_length_lo; // Transport Stream Loop - //count = parseDescriptors(((const char *)sv) + sizeof(struct bat_service), descriptors_length, s, bh->section_number, count, + //count = parseDescriptors(((const char *)sv) + sizeof(struct bat_service), descriptors_length, s, bh->section_number, count, //(const char *) bouquetName[0]); bool found = false; int loop_count = 1; while (loop_count >= 0) { - + const char *des_ = ((const char *)sv) + sizeof(struct bat_service); len = descriptors_length; - + while(len>=sizeof(struct descr_generic_header)) { desc=(struct descr_generic_header *)des_; // printf("Type: %s\n", decode_descr(desc->descriptor_tag)); @@ -1052,7 +1052,7 @@ void SIsectionBAT::parse(void) // printf("Found service list descriptor\n"); //count = parseServiceListDescriptor((const char *)desc, s, section_no, count); //struct descr_generic_header *sv=(struct descr_generic_header *)buf; - + while(dlen >= sizeof(struct service_list_entry)) { struct service_list_entry *sl=(struct service_list_entry *)buf; buf+=sizeof(struct service_list_entry); @@ -1074,16 +1074,16 @@ void SIsectionBAT::parse(void) struct digplus_order_entry *oe = (struct digplus_order_entry *)privbuf; privbuf+=order_entry_size; /* - printf("Search: %04x Service_id: %04x Posi:%04x\n", + printf("Search: %04x Service_id: %04x Posi:%04x\n", (sl->service_id_hi << 8) | sl->service_id_lo, (oe->service_id_hi << 8) | oe->service_id_lo, (oe->channel_number_hi << 8) | oe->channel_number_lo); */ - if ( ((sl->service_id_hi << 8) | sl->service_id_lo) == + if ( ((sl->service_id_hi << 8) | sl->service_id_lo) == ((oe->service_id_hi << 8) | oe->service_id_lo)) { bs.position = (oe->channel_number_hi << 8) | oe->channel_number_lo; /* - printf("Found Search: %04x Service_id: %04x Posi:%04x\n", + printf("Found Search: %04x Service_id: %04x Posi:%04x\n", (sl->service_id_hi << 8) | sl->service_id_lo, current_service_id, current_channel_number); @@ -1106,8 +1106,8 @@ void SIsectionBAT::parse(void) struct private_data_specifier *pds=(struct private_data_specifier *)buf; buf+=sizeof(struct private_data_specifier); if ((pds->byte1 != 0) || (pds->byte2 != 0) || (pds->byte3 != 0) || (pds->byte4 != 0)) - current_private_data_specifier=(((pds->byte1 << 24) | (pds->byte2 << 16)) | - (pds->byte3 << 8)) | pds->byte4; + current_private_data_specifier=(((pds->byte1 << 24) | (pds->byte2 << 16)) | + (pds->byte3 << 8)) | pds->byte4; //printf("Private Data Specifier: %08x\n", current_private_data_specifier); } if (desc->descriptor_tag == 0x81) { @@ -1116,7 +1116,7 @@ void SIsectionBAT::parse(void) privdesc = (struct descr_generic_header *)desc; found = true; } - } + } if (desc->descriptor_tag == 0x82) { if ((current_private_data_specifier == 0x00000010) || (bouquet_id == 0x0021)) { //printf("TPS Bouquet ordering descriptor found!\n"); @@ -1148,17 +1148,17 @@ void SIsectionBAT::parse(void) //check if resulting bouquets on 28.2E look more sensible... struct bskyb_bid *bid = (struct bskyb_bid *)privbuf; if ((bid->unknown1 == 0xff) && (bid->unknown2 == 0xff)) { - + privbuf+=2; //first 2 bytes of each 0xb1 desc unknown - + while (privdlen >= sizeof(struct bskyb_order_entry)) { struct bskyb_order_entry *oe = (struct bskyb_order_entry *)privbuf; privbuf+=sizeof(struct bskyb_order_entry); SIbouquet bs(bouquet_id); bs.bouquetName = bouquetName; - bs.transport_stream_id = (sv->transport_stream_id_hi << 8) | + bs.transport_stream_id = (sv->transport_stream_id_hi << 8) | sv->transport_stream_id_lo; - bs.original_network_id = (sv->original_network_id_hi << 8) | + bs.original_network_id = (sv->original_network_id_hi << 8) | sv->original_network_id_lo; bs.service_id = (oe->service_id_hi << 8) | oe->service_id_lo; bs.serviceTyp = oe->service_type; @@ -1173,9 +1173,9 @@ void SIsectionBAT::parse(void) len-=desc->descriptor_length+2; des_+=desc->descriptor_length+2; } - loop_count--; + loop_count--; } - + actPos += sizeof(struct bat_service) + descriptors_length; // count++; } @@ -1244,7 +1244,7 @@ void SIsectionNIT::parse(void) bufferLength=0; return; } - + actPos = buffer; // We need Bouquet ID and bouquet descriptor length from header bufEnd = buffer + bufferLength; nh = (struct SI_section_NIT_header *)actPos; // Header @@ -1254,12 +1254,12 @@ void SIsectionNIT::parse(void) // printf("ident: %hu actpos: %p buf+bl: %p desclen: %hu\n", bi.bouquet_id, actPos, buffer+bufferLength, descriptors_loop_length); // parseDescriptors(((const char *)bh) + sizeof(SI_section_BAT_header), descriptors_loop_length, s); //Fill out Bouquet Name actPos += sizeof(SI_section_NIT_header) + descriptors_loop_length; - + ll = (struct loop_len *)actPos; descriptors_loop_length = (ll->descriptors_loop_length_hi << 8) | ll->descriptors_loop_length_lo; //len is not used at the moment // printf("desclen: %hu\n", descriptors_loop_length); actPos += sizeof(loop_len); - + while (actPos <= bufEnd - sizeof(struct nit_transponder)) { tp = (struct nit_transponder *)actPos; SInetwork s(tp); @@ -1313,7 +1313,7 @@ int SIsections :: readSections(const unsigned short pid, const unsigned char fil { int fd; struct SI_section_header header; - unsigned long long firstKey=(unsigned long long)-1; + uint64_t firstKey=(uint64_t)-1; SIsections missingSections; char *buf; unsigned short section_length; @@ -1396,7 +1396,7 @@ int SIsections :: readSections(const unsigned short pid, const unsigned char fil delete[] buf; } - } while (firstKey == (unsigned long long) -1); + } while (firstKey == (uint64_t) -1); // Die restlichen Segmente lesen szeit = time(NULL); @@ -1540,7 +1540,7 @@ int SIsections :: readSections(const unsigned short pid, const unsigned char fil } section_length = (header.section_length_hi << 8) | header.section_length_lo; - + buf = new char[sizeof(header) + section_length - 5]; if (!buf) { diff --git a/src/sectionsd/SIsections.hpp b/src/sectionsd/SIsections.hpp index df0bc794f..73b99c47d 100644 --- a/src/sectionsd/SIsections.hpp +++ b/src/sectionsd/SIsections.hpp @@ -231,7 +231,7 @@ struct SI_section_PPT_header { // Premiere Private Table #endif unsigned section_number : 8; unsigned last_section_number : 8; - + unsigned content_id_32_25 : 8; unsigned content_id_24_17 : 8; unsigned content_id_16_9 : 8; @@ -313,7 +313,7 @@ public: } unsigned short tableIDextension(void) const { - return buffer ? ((((struct SI_section_header *)buffer)->table_id_extension_hi << 8) | + return buffer ? ((((struct SI_section_header *)buffer)->table_id_extension_hi << 8) | ((struct SI_section_header *)buffer)->table_id_extension_lo) : (unsigned short) -1; } @@ -337,22 +337,22 @@ public: return (struct SI_section_header *)buffer; } - static unsigned long long key(const struct SI_section_header *header) { + static uint64_t key(const struct SI_section_header *header) { // Der eindeutige Key einer SIsection besteht aus 1 Byte Table-ID, // 2 Byte Table-ID-extension, 1 Byte Section number // 1 Byte Version number und 1 Byte current_next_indicator if (!header) - return (unsigned long long) -1; - return (((unsigned long long)header->table_id) << 40) + - (((unsigned long long)header->table_id_extension_hi) << 32) + - (((unsigned long long)header->table_id_extension_lo) << 24) + - (((unsigned long long)header->section_number) << 16) + - (((unsigned long long)header->version_number) << 8) + - (((unsigned long long)header->current_next_indicator)); + return (uint64_t) -1; + return (((uint64_t)header->table_id) << 40) + + (((uint64_t)header->table_id_extension_hi) << 32) + + (((uint64_t)header->table_id_extension_lo) << 24) + + (((uint64_t)header->section_number) << 16) + + (((uint64_t)header->version_number) << 8) + + (((uint64_t)header->current_next_indicator)); } - unsigned long long key(void) const { - return buffer ? key(header()) : (unsigned long long) -1; + uint64_t key(void) const { + return buffer ? key(header()) : (uint64_t) -1; } // Der Operator zum sortieren @@ -580,9 +580,9 @@ public: long duration(void) const { if (!buffer) return(0); - - if (!((((struct SI_section_PPT_header *)buffer)->duration_hi == 0xff) && - (((struct SI_section_PPT_header *)buffer)->duration_mid == 0xff) && + + if (!((((struct SI_section_PPT_header *)buffer)->duration_hi == 0xff) && + (((struct SI_section_PPT_header *)buffer)->duration_mid == 0xff) && (((struct SI_section_PPT_header *)buffer)->duration_lo == 0xff))) return ((((struct SI_section_PPT_header *)buffer)->duration_hi)>>4)*10*3600L + ((((struct SI_section_PPT_header *)buffer)->duration_hi)&0x0f)*3600L + ((((struct SI_section_PPT_header *)buffer)->duration_mid)>>4)*10*60L + ((((struct SI_section_PPT_header *)buffer)->duration_mid)&0x0f)*60L + @@ -642,7 +642,7 @@ protected: void parseComponentDescriptor(const char *buf, SIevent &e, unsigned maxlen); void parseParentalRatingDescriptor(const char *buf, SIevent &e, unsigned maxlen); void parseLinkageDescriptor(const char *buf, SIevent &e, unsigned maxlen); - + void parsePrivateContentOrderDescriptor(const char *buf, SIevent &e, unsigned maxlen); void parsePrivateParentalInformationDescriptor(const char *buf, SIevent &e, unsigned maxlen); void parsePrivateContentTransmissionDescriptor(const char *buf, SIevent &e, unsigned maxlen); @@ -741,7 +741,7 @@ public: parsed = 0; parse(); } - + t_transport_stream_id transport_stream_id(void) const { return buffer ? ((((struct SI_section_SDT_header *)buffer)->transport_stream_id_hi << 8) | ((struct SI_section_SDT_header *)buffer)->transport_stream_id_lo) : 0; @@ -797,15 +797,15 @@ class SIsectionBAT : public SIsection public: SIsectionBAT(const SIsection &s) : SIsection(s) { parsed = 0; - parse(); + parse(); } - + // Std-Copy SIsectionBAT(const SIsectionBAT &s) : SIsection(s) { bsv = s.bsv; parsed = s.parsed; } - + // Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein) SIsectionBAT(unsigned bufLength, char *buf) : SIsection(bufLength, buf) { parsed = 0; @@ -838,13 +838,13 @@ public: void dump(void) const { dump((struct SI_section_BAT_header *)buffer); } - + const SIbouquets &bouquets(void) const { //if(!parsed) // parse(); -> nicht const return bsv; } - + protected: SIbouquets bsv; int parsed; @@ -859,15 +859,15 @@ class SIsectionNIT : public SIsection public: SIsectionNIT(const SIsection &s) : SIsection(s) { parsed = 0; - parse(); + parse(); } - + // Std-Copy SIsectionNIT(const SIsectionNIT &s) : SIsection(s) { ntw = s.ntw; parsed = s.parsed; } - + // Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein) SIsectionNIT(unsigned bufLength, char *buf) : SIsection(bufLength, buf) { parsed = 0; @@ -900,13 +900,13 @@ public: void dump(void) const { dump((struct SI_section_NIT_header *)buffer); } - + const SInetworks &networks(void) const { //if(!parsed) // parse(); -> nicht const return ntw; } - + protected: SInetworks ntw; int parsed; diff --git a/src/sectionsd/dmxapi.cpp b/src/sectionsd/dmxapi.cpp index b9ec62213..933ae2881 100644 --- a/src/sectionsd/dmxapi.cpp +++ b/src/sectionsd/dmxapi.cpp @@ -59,7 +59,7 @@ struct SI_section_TOT_header unsigned char reserved_future_use : 1; unsigned char reserved1 : 2; unsigned short section_length : 12; - unsigned long long UTC_time : 40; + uint64_t UTC_time : 40; unsigned char reserved2 : 4; unsigned short descriptors_loop_length : 12; } @@ -72,7 +72,7 @@ struct SI_section_TDT_header unsigned char reserved_future_use : 1; unsigned char reserved1 : 2; unsigned short section_length : 12; -/* unsigned long long UTC_time : 40;*/ +/* uint64_t UTC_time : 40;*/ UTC_t UTC_time; } __attribute__ ((packed)); /* 8 bytes */ @@ -107,7 +107,7 @@ bool getUTC(UTC_t * const UTC, const bool TDT) memcpy(cUTC, &tdt_tot_header.UTC_time, 5); if ((cUTC[2] > 0x23) || (cUTC[3] > 0x59) || (cUTC[4] > 0x59)) // no valid time { - printf("[sectionsd] getUTC: invalid %s section received: %02x %02x %02x %02x %02x\n", + printf("[sectionsd] getUTC: invalid %s section received: %02x %02x %02x %02x %02x\n", TDT ? "TDT" : "TOT", cUTC[0], cUTC[1], cUTC[2], cUTC[3], cUTC[4]); ret = false; } diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index 324910bd1..ee5964e33 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -376,16 +376,16 @@ inline bool waitForTimeset(void) return true; } -static long long last_profile_call; +static int64_t last_profile_call; void showProfiling( std::string text ) { struct timeval tv; gettimeofday( &tv, NULL ); - long long now = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000); + int64_t now = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); - long long tmp = now - last_profile_call; + int64_t tmp = now - last_profile_call; dprintf("--> '%s' %lld.%03lld\n", text.c_str(), tmp / 1000LL, tmp % 1000LL); last_profile_call = now; } @@ -2875,8 +2875,8 @@ static void commandLinkageDescriptorsUniqueKey(int connfd, char *data, const uns return ; } /* -std::vector messaging_skipped_sections_ID [0x22]; // 0x4e .. 0x6f -static long long messaging_sections_max_ID [0x22]; // 0x4e .. 0x6f +std::vector messaging_skipped_sections_ID [0x22]; // 0x4e .. 0x6f +static int64_t messaging_sections_max_ID [0x22]; // 0x4e .. 0x6f static int messaging_sections_got_all [0x22]; // 0x4e .. 0x6f */ //static unsigned char messaging_current_version_number = 0xff; @@ -2885,8 +2885,8 @@ static int messaging_sections_got_all [0x22]; // 0x4e .. 0x6f static bool messaging_eit_is_busy = false; static bool messaging_need_eit_version = false; -//std::vector messaging_sdt_skipped_sections_ID [2]; // 0x42, 0x46 -//static long long messaging_sdt_sections_max_ID [2]; // 0x42, 0x46 +//std::vector messaging_sdt_skipped_sections_ID [2]; // 0x42, 0x46 +//static int64_t messaging_sdt_sections_max_ID [2]; // 0x42, 0x46 //static int messaging_sdt_sections_got_all [2]; // 0x42, 0x46 /* static bool messaging_sdt_actual_sections_got_all; // 0x42 @@ -6643,7 +6643,7 @@ struct local_time_offset { unsigned char reserved : 1; unsigned char local_time_offset_polarity : 1; unsigned short local_time_offs : 16; - unsigned long long time_of_chng : 40; + uint64_t time_of_chng : 40; unsigned short next_time_offset : 8; } __attribute__ ((packed)) ;