]> git.vomp.tv Git - vompserver.git/commitdiff
Fix all compiler warnings
authorChris Tallon <chris@telescope.org>
Sat, 2 Jun 2012 16:23:07 +0000 (17:23 +0100)
committerChris Tallon <chris@telescope.org>
Sat, 2 Jun 2012 16:23:07 +0000 (17:23 +0100)
Makefile
mvpreceiver.c
mvprelay.c
recplayer.c
tftpclient.c
vompclient.c
vompclientrrproc.c

index aa810645a37cda4746bbcca0e206c877bbb956cf..31b3bcad33f7681f0812750c79e4e26ce57356eb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,9 +17,9 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
 
 CXX      ?= g++
 ifdef DEBUG
-CXXFLAGS ?= -g -Wall -Woverloaded-virtual -Wno-parentheses #-Werror
+CXXFLAGS ?= -g -Wall -Woverloaded-virtual -Wno-parentheses -Werror
 else
-CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -Wno-parentheses #-Werror
+CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -Wno-parentheses -Werror
 endif
 
 ### The directory environment:
index 49028b5b76c39b59dc5db76b412366f90838064a..b27d8c9e24e9e435fe908b257dae72c0b758ea87 100644 (file)
@@ -116,6 +116,7 @@ void MVPReceiver::Receive(UCHAR* data, int length)
 
 void MVPReceiver::threadMethod()
 {
+  ULONG *p;
   ULONG headerLength = sizeof(ULONG) * 4;
   UCHAR buffer[streamChunkSize + headerLength];
   int amountReceived;
@@ -135,10 +136,10 @@ void MVPReceiver::threadMethod()
       amountReceived = processed.get(buffer+headerLength, streamChunkSize);
       pthread_mutex_unlock(&processedRingLock);
     
-      *(ULONG*)&buffer[0] = htonl(2); // stream channel
-      *(ULONG*)&buffer[4] = htonl(streamID);
-      *(ULONG*)&buffer[8] = htonl(0); // here insert flag: 0 = ok, data follows
-      *(ULONG*)&buffer[12] = htonl(amountReceived);
+      p = (ULONG*)&buffer[0]; *p = htonl(2); // stream channel
+      p = (ULONG*)&buffer[4]; *p = htonl(streamID);
+      p = (ULONG*)&buffer[8]; *p = htonl(0); // here insert flag: 0 = ok, data follows
+      p = (ULONG*)&buffer[12]; *p = htonl(amountReceived);
 
       tcp->sendPacket(buffer, amountReceived + headerLength);
     } while(processed.getContent() >= streamChunkSize);
@@ -147,12 +148,13 @@ void MVPReceiver::threadMethod()
 
 void MVPReceiver::sendStreamEnd()
 {
+  ULONG *p;
   ULONG bufferLength = sizeof(ULONG) * 4;
   UCHAR buffer[bufferLength];
-  *(ULONG*)&buffer[0] = htonl(2); // stream channel
-  *(ULONG*)&buffer[4] = htonl(streamID);
-  *(ULONG*)&buffer[8] = htonl(1); // stream end
-  *(ULONG*)&buffer[12] = htonl(0); // zero length, no more data
+  p = (ULONG*)&buffer[0]; *p = htonl(2); // stream channel
+  p = (ULONG*)&buffer[4]; *p = htonl(streamID);
+  p = (ULONG*)&buffer[8]; *p = htonl(1); // stream end
+  p = (ULONG*)&buffer[12]; *p = htonl(0); // zero length, no more data
   tcp->sendPacket(buffer, bufferLength);
 }
 
index d266674f0ac8906207b5c96798d21a320494f847..3dd45f1e4377d1f913a267043e2616a23664608f 100644 (file)
@@ -95,6 +95,7 @@ void MVPRelay::threadMethod()
 
     // Construct reply packet
 
+    ULONG* p;
     UCHAR out[52];
     memset(out, 0, 52);
 
@@ -102,13 +103,15 @@ void MVPRelay::threadMethod()
     memcpy(out, in, 4);
 
     // Return magic number is 0xfafebabe
-    *(ULONG*)&out[4] = htonl(0xfafebabe);
+    p = (ULONG*)&out[4];
+    *p = htonl(0xfafebabe);
 
     // Copy client IP and port to reply
     memcpy(&out[16], &in[16], 6);
 
     // Insert server address
-    *(ULONG*)&out[24] = myIP;
+    p = (ULONG*)&out[24];
+    *p = myIP;
 
     // Send it
     ds.send(ds.getFromIPA(), peerPort, (char*)out, 52);
index 82c056dc99ed907f5b7d00bee6c3803d387d5db4..9fac7592376ac281d5c3ac661617be2eac88791a 100644 (file)
 
 #include "recplayer.h"
 
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 600
+#endif
+
 #include <fcntl.h>
 
 RecPlayer::RecPlayer(cRecording* rec)
index 8dec41a8a2effb1073762a10546ddf86599a747d..58d305f5b3e96cd12671600bf75b31ea096ebab5 100644 (file)
@@ -290,8 +290,9 @@ int TftpClient::openFile(char* requestedFile)
 
 int TftpClient::sendBlock()
 {
-  *(USHORT*)&buffer[0] = htons(3);
-  *(USHORT*)&buffer[2] = htons(blockNumber++);
+  USHORT* p;
+  p = (USHORT*)&buffer[0]; *p = htons(3);
+  p = (USHORT*)&buffer[2]; *p = htons(blockNumber++);
   bufferLength = 4 + fread(&buffer[4], 1, 512, file);
 
   if (bufferLength < 516) // 512 + 4 header
index 64fd20b903bb2df3092e48a4cc8b3f9f5f966569..25dc541ed6729d371d9267257a4f77f64c791f2a 100644 (file)
@@ -318,9 +318,10 @@ void VompClient::run2()
 
       log->log("Client", Log::DEBUG, "Received chan=%lu kats=%lu", channelID, kaTimeStamp);    
 
+      ULONG* p;
       UCHAR buffer[8];
-      *(ULONG*)&buffer[0] = htonl(3); // KA CHANNEL
-      *(ULONG*)&buffer[4] = htonl(kaTimeStamp);
+      p = (ULONG*)&buffer[0]; *p = htonl(3); // KA CHANNEL
+      p = (ULONG*)&buffer[4]; *p = htonl(kaTimeStamp);
       if (!tcp.sendPacket(buffer, 8))
       {
         log->log("Client", Log::ERR, "Could not send back KA reply");
index 44e7bd432c24d9e513614e6edc7026599ff928f9..3d1bf088d97ea46d0a69e9f3e561c9cdef9d20bf 100644 (file)
@@ -262,15 +262,14 @@ bool VompClientRRProc::processPacket()
       result = processGetLanguageContent();
       break;
     case VDR_GETMEDIAINFO:
-            result= processGetMediaInfo();
-            break;
+           result = processGetMediaInfo();
+           break;
     case VDR_CLOSECHANNEL:
-            result= processCloseMediaChannel();
-            break;
+           result = processCloseMediaChannel();
+           break;
     case 37:
       result = processSetCharset();
       break;
-
   }
 
   delete resp;
@@ -314,23 +313,23 @@ int VompClientRRProc::processLogin()
 
 int VompClientRRProc::processSetCharset()
 {
-   int charset = ntohl(*(ULONG*)req->data);
-   if (charset>0 && charset<3) {
-        log->log("RRProc", Log::DEBUG, "Set charset to %d", charset);
-        x.setCharset(charset);
-        resp->addULONG(1);
-    } else {
-       log->log("RRProc", Log::DEBUG, "Invalid charset %d", charset);
-       resp->addULONG(0);
-    }
+  int charset = ntohl(*(ULONG*)req->data);
+  if (charset>0 && charset<3)
+  {
+    log->log("RRProc", Log::DEBUG, "Set charset to %d", charset);
+    x.setCharset(charset);
+    resp->addULONG(1);
+  }
+  else
+  {
+    log->log("RRProc", Log::DEBUG, "Invalid charset %d", charset);
+    resp->addULONG(0);
+  }
   resp->finalise();
   x.tcp.sendPacket(resp->getPtr(), resp->getLen());
-
+  return 1;
 }
 
-    
-
-
 int VompClientRRProc::processConfigSave()
 {
   char* section = (char*)req->data;