mirror of
				https://github.com/rofafor/vdr-plugin-iptv.git
				synced 2023-10-10 11:37:03 +00:00 
			
		
		
		
	Re-name error macros and eliminate need for specifying empty parameters.
This commit is contained in:
		
							
								
								
									
										4
									
								
								common.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								common.c
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: common.c,v 1.6 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: common.c,v 1.7 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <vdr/i18n.h> | ||||
| @@ -55,7 +55,7 @@ int select_single_desc(int descriptor, const int usecs, const bool selectWrite) | ||||
|   else | ||||
|     retval = select(descriptor + 1, &fds, NULL, NULL, &tv); | ||||
|   // Check if error | ||||
|   ERROR_IF(retval < 0, "select()", return retval); | ||||
|   ERROR_IF_RET(retval < 0, "select()", return retval); | ||||
|   return retval; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										7
									
								
								common.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								common.h
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: common.h,v 1.12 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: common.h,v 1.13 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __IPTV_COMMON_H | ||||
| @@ -39,7 +39,10 @@ | ||||
|         }                                                                  \ | ||||
|   } while (0) | ||||
|  | ||||
| #define ERROR_IF(exp, errstr, ret) ERROR_IF_FUNC(exp, errstr, ,ret); | ||||
|  | ||||
| #define ERROR_IF_RET(exp, errstr, ret) ERROR_IF_FUNC(exp, errstr, ,ret); | ||||
|  | ||||
| #define ERROR_IF(exp, errstr) ERROR_IF_FUNC(exp, errstr, , ); | ||||
|  | ||||
| uint16_t ts_pid(const uint8_t *buf); | ||||
| uint8_t payload(const uint8_t *tsp); | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: protocolext.c,v 1.15 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: protocolext.c,v 1.16 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <sys/wait.h> | ||||
| @@ -55,7 +55,7 @@ bool cIptvProtocolExt::OpenSocket(void) | ||||
|      int yes = 1;      | ||||
|      // Create socket | ||||
|      socketDesc = socket(PF_INET, SOCK_DGRAM, 0); | ||||
|      ERROR_IF(socketDesc < 0, "socket()", return false); | ||||
|      ERROR_IF_RET(socketDesc < 0, "socket()", return false); | ||||
|      // Make it use non-blocking I/O to avoid stuck read calls | ||||
|      ERROR_IF_FUNC(fcntl(socketDesc, F_SETFL, O_NONBLOCK), "fcntl()", CloseSocket(), return false); | ||||
|      // Allow multiple sockets to use the same PORT number | ||||
| @@ -91,7 +91,7 @@ void cIptvProtocolExt::ExecuteCommand(void) | ||||
|      return; | ||||
|      } | ||||
|   // Let's fork | ||||
|   ERROR_IF((pid = fork()) == -1, "fork()", return); | ||||
|   ERROR_IF_RET((pid = fork()) == -1, "fork()", return); | ||||
|   // Check if child process | ||||
|   if (pid == 0) { | ||||
|      // Close all dup'ed filedescriptors | ||||
| @@ -125,7 +125,7 @@ void cIptvProtocolExt::TerminateCommand(void) | ||||
|      bool waitOver = false; | ||||
|      // signal and wait for termination | ||||
|      int retval = kill(pid, SIGINT); | ||||
|      ERROR_IF(retval < 0, "kill()", waitOver = true); | ||||
|      ERROR_IF_RET(retval < 0, "kill()", waitOver = true); | ||||
|      while (!waitOver) { | ||||
|        retval = 0; | ||||
|        waitms += timeoutms; | ||||
| @@ -137,7 +137,7 @@ void cIptvProtocolExt::TerminateCommand(void) | ||||
|        memset(&waitStatus, '\0', sizeof(waitStatus)); | ||||
|        // Wait for child termination | ||||
|        retval = waitid(P_PID, pid, &waitStatus, (WNOHANG | WEXITED)); | ||||
|        ERROR_IF(retval < 0, "waitid()", waitOver = true); | ||||
|        ERROR_IF_RET(retval < 0, "waitid()", waitOver = true); | ||||
|        // These are the acceptable conditions under which child exit is | ||||
|        // regarded as successful | ||||
|        if (!retval && waitStatus.si_pid && (waitStatus.si_pid == pid) && | ||||
| @@ -176,7 +176,7 @@ int cIptvProtocolExt::Read(unsigned char* *BufferAddr) | ||||
|      if (isActive) | ||||
|         len = recvfrom(socketDesc, readBuffer, readBufferLen, MSG_DONTWAIT, | ||||
|                        (struct sockaddr *)&sockAddr, &addrlen); | ||||
|      ERROR_IF(len < 0, "recvfrom()", return len); | ||||
|      ERROR_IF_RET(len < 0, "recvfrom()", return len); | ||||
|      if ((len > 0) && (readBuffer[0] == 0x47)) { | ||||
|         // Set argument point to read buffer | ||||
|         *BufferAddr = &readBuffer[0]; | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: protocolfile.c,v 1.13 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: protocolfile.c,v 1.14 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <fcntl.h> | ||||
| @@ -44,7 +44,7 @@ bool cIptvProtocolFile::OpenFile(void) | ||||
|   // Check that stream address is valid | ||||
|   if (!isActive && !isempty(fileLocation)) { | ||||
|      fileStream = fopen(fileLocation, "rb"); | ||||
|      ERROR_IF(!fileStream || ferror(fileStream), "fopen()", return false); | ||||
|      ERROR_IF_RET(!fileStream || ferror(fileStream), "fopen()", return false); | ||||
|      // Update active flag | ||||
|      isActive = true; | ||||
|      } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: protocolhttp.c,v 1.16 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: protocolhttp.c,v 1.17 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| @@ -59,7 +59,7 @@ bool cIptvProtocolHttp::OpenSocket(const int Port) | ||||
|      int yes = 1;      | ||||
|      // Create socket | ||||
|      socketDesc = socket(PF_INET, SOCK_STREAM, 0); | ||||
|      ERROR_IF(socketDesc < 0, "socket()", return false); | ||||
|      ERROR_IF_RET(socketDesc < 0, "socket()", return false); | ||||
|      // Make it use non-blocking I/O to avoid stuck read calls | ||||
|      ERROR_IF_FUNC(fcntl(socketDesc, F_SETFL, O_NONBLOCK), "fcntl()", CloseSocket(), return false); | ||||
|      // Allow multiple sockets to use the same PORT number | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: protocoludp.c,v 1.17 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: protocoludp.c,v 1.18 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include <sys/types.h> | ||||
| @@ -56,7 +56,7 @@ bool cIptvProtocolUdp::OpenSocket(const int Port) | ||||
|      int yes = 1;      | ||||
|      // Create socket | ||||
|      socketDesc = socket(PF_INET, SOCK_DGRAM, 0); | ||||
|      ERROR_IF(socketDesc < 0, "socket()", return false); | ||||
|      ERROR_IF_RET(socketDesc < 0, "socket()", return false); | ||||
|      // Make it use non-blocking I/O to avoid stuck read calls | ||||
|      ERROR_IF_FUNC(fcntl(socketDesc, F_SETFL, O_NONBLOCK), "fcntl()", CloseSocket(), return false); | ||||
|      // Allow multiple sockets to use the same PORT number | ||||
| @@ -98,7 +98,7 @@ bool cIptvProtocolUdp::JoinMulticast(void) | ||||
|      mreq.imr_interface.s_addr = htonl(INADDR_ANY); | ||||
|      int err = setsockopt(socketDesc, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, | ||||
|                           sizeof(mreq)); | ||||
|      ERROR_IF(err < 0, "setsockopt()", return false); | ||||
|      ERROR_IF_RET(err < 0, "setsockopt()", return false); | ||||
|      // Update multicasting flag | ||||
|      isActive = true; | ||||
|      } | ||||
| @@ -118,7 +118,7 @@ bool cIptvProtocolUdp::DropMulticast(void) | ||||
|       mreq.imr_interface.s_addr = htonl(INADDR_ANY); | ||||
|       int err = setsockopt(socketDesc, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, | ||||
|                            sizeof(mreq)); | ||||
|       ERROR_IF(err < 0, "setsockopt()", return false); | ||||
|       ERROR_IF_RET(err < 0, "setsockopt()", return false); | ||||
|       // Update multicasting flag | ||||
|       isActive = false; | ||||
|      } | ||||
| @@ -148,7 +148,7 @@ int cIptvProtocolUdp::Read(unsigned char* *BufferAddr) | ||||
|      if (isActive) | ||||
|         len = recvfrom(socketDesc, readBuffer, readBufferLen, MSG_DONTWAIT, | ||||
|                        (struct sockaddr *)&sockAddr, &addrlen); | ||||
|      ERROR_IF(len < 0, "recvfrom()", return len); | ||||
|      ERROR_IF_RET(len < 0, "recvfrom()", return len); | ||||
|      if ((len > 0) && (readBuffer[0] == 0x47)) { | ||||
|         // Set argument point to read buffer | ||||
|         *BufferAddr = &readBuffer[0]; | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  * | ||||
|  * See the README file for copyright information and how to reach the author. | ||||
|  * | ||||
|  * $Id: sectionfilter.c,v 1.14 2007/10/20 23:16:28 ajhseppa Exp $ | ||||
|  * $Id: sectionfilter.c,v 1.15 2007/10/20 23:25:14 ajhseppa Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "sectionfilter.h" | ||||
| @@ -56,7 +56,7 @@ cIptvSectionFilter::cIptvSectionFilter(int Index, int devInd, | ||||
|   if (S_ISFIFO(sb.st_mode)) | ||||
|      unlink(pipeName); | ||||
|   int err = mknod(pipeName, 0644 | S_IFIFO, 0); | ||||
|   ERROR_IF(err < 0, "mknod()", return); | ||||
|   ERROR_IF_RET(err < 0, "mknod()", return); | ||||
|  | ||||
|   // Create descriptors | ||||
|   fifoDescriptor = open(pipeName, O_RDWR | O_NONBLOCK); | ||||
| @@ -104,7 +104,7 @@ int cIptvSectionFilter::dmxdev_section_callback(const uint8_t *buffer1, size_t b | ||||
|      printf("\n"); | ||||
| #endif | ||||
|      retval = write(fifoDescriptor, buffer1, buffer1_len); | ||||
|      ERROR_IF(retval < 0, "write()", ); | ||||
|      ERROR_IF(retval < 0, "write()"); | ||||
|      // Update statistics | ||||
|      AddStatistic(retval, 1); | ||||
|      } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user