Also, enable -Wall for libconcord so we notice them sooner.

Signed-off-by: Scott Talbert <s...@techie.net>
---
 libconcord/Makefile.am    |  1 +
 libconcord/libconcord.cpp |  6 +++---
 libconcord/remote.cpp     |  2 +-
 libconcord/remote.h       |  8 ++++----
 libconcord/remote_mh.cpp  | 15 ++++++++-------
 libconcord/remote_z.cpp   | 37 +++++++++++++++++++------------------
 libconcord/xml_headers.h  |  2 --
 7 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/libconcord/Makefile.am b/libconcord/Makefile.am
index de6ae23..50a6fd3 100644
--- a/libconcord/Makefile.am
+++ b/libconcord/Makefile.am
@@ -6,6 +6,7 @@ libconcord_la_SOURCES = remote.cpp remote_z.cpp libconcord.cpp 
binaryfile.cpp \
        remote_info.h web.h protocol.h remote.h usblan.h xml_headers.h \
        operationfile.cpp remote_mh.cpp libusbhid.cpp libhidapi.cpp
 include_HEADERS = libconcord.h
+libconcord_la_CPPFLAGS = -Wall
 libconcord_la_LDFLAGS = -version-info 3:0:0 $(LIBCONCORD_LDFLAGS) -lzip
 UDEVROOT ?= /
 UDEVLIBDIR ?= $(UDEVROOT)/lib
diff --git a/libconcord/libconcord.cpp b/libconcord/libconcord.cpp
index c9b97eb..fc1ca7d 100644
--- a/libconcord/libconcord.cpp
+++ b/libconcord/libconcord.cpp
@@ -1825,7 +1825,7 @@ int mh_get_cfg_properties(struct mh_cfg_properties 
*properties)
     int err;
     int buflen = 5000;
     char buffer[buflen];
-    int data_read;
+    uint32_t data_read;
     if ((err = rmt->ReadFile("/cfg/properties", (uint8_t*)buffer, buflen,
                              &data_read, 0x00, NULL, NULL, 0)))
         return err;
@@ -1867,7 +1867,7 @@ int mh_get_wifi_networks(struct mh_wifi_networks 
*networks)
     int err;
     int buflen = 5000;
     char buffer[buflen];
-    int data_read;
+    uint32_t data_read;
     if ((err = rmt->ReadFile("/sys/wifi/networks", (uint8_t*)buffer, buflen,
                              &data_read, 0x00, NULL, NULL, 0)))
         return err;
@@ -1897,7 +1897,7 @@ int mh_get_wifi_config(struct mh_wifi_config *config)
     int err;
     int buflen = 5000;
     char buffer[buflen];
-    int data_read;
+    uint32_t data_read;
     if ((err = rmt->ReadFile("/sys/wifi/connect", (uint8_t*)buffer, buflen,
                              &data_read, 0x00, NULL, NULL, 0)))
         return err;
diff --git a/libconcord/remote.cpp b/libconcord/remote.cpp
index cd972c6..f531805 100644
--- a/libconcord/remote.cpp
+++ b/libconcord/remote.cpp
@@ -1056,7 +1056,7 @@ int CRemote::LearnIR(uint32_t *freq, uint32_t **ir_signal,
 }
 
 int CRemote::ReadFile(const char *filename, uint8_t *rd, const uint32_t rdlen,
-                      int *data_read, uint8_t start_seq, lc_callback cb,
+                      uint32_t *data_read, uint8_t start_seq, lc_callback cb,
                       void *cb_arg, uint32_t cb_stage)
 {
     return LC_ERROR_UNSUPP;
diff --git a/libconcord/remote.h b/libconcord/remote.h
index 549ac88..6f63f62 100644
--- a/libconcord/remote.h
+++ b/libconcord/remote.h
@@ -201,7 +201,7 @@ public:
     virtual int IsMHRemote()=0;
 
     virtual int ReadFile(const char *filename, uint8_t *rd,
-        const uint32_t rdlen, int *data_read, uint8_t start_seq,
+        const uint32_t rdlen, uint32_t *data_read, uint8_t start_seq,
         lc_callback cb, void *cb_arg, uint32_t cb_stage)=0;
     virtual int WriteFile(const char *filename, uint8_t *wr,
         const uint32_t wrlen)=0;
@@ -263,7 +263,7 @@ public:
     int IsMHRemote() {return false;}
 
     int ReadFile(const char *filename, uint8_t *rd, const uint32_t rdlen,
-        int *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
+        uint32_t *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
         uint32_t cb_stage);
     int WriteFile(const char *filename, uint8_t *wr, const uint32_t wrlen);
 };
@@ -321,7 +321,7 @@ public:
     int IsMHRemote() {return false;}
 
     int ReadFile(const char *filename, uint8_t *rd, const uint32_t rdlen,
-        int *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
+        uint32_t *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
         uint32_t cb_stage);
     int WriteFile(const char *filename, uint8_t *wr, const uint32_t wrlen);
 };
@@ -449,7 +449,7 @@ public:
     int IsMHRemote() {return true;}
 
     int ReadFile(const char *filename, uint8_t *rd, const uint32_t rdlen,
-        int *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
+        uint32_t *data_read, uint8_t start_seq, lc_callback cb, void *cb_arg,
         uint32_t cb_stage);
     int WriteFile(const char *filename, uint8_t *wr, const uint32_t wrlen);
 };
diff --git a/libconcord/remote_mh.cpp b/libconcord/remote_mh.cpp
index 2670419..6a4162c 100644
--- a/libconcord/remote_mh.cpp
+++ b/libconcord/remote_mh.cpp
@@ -182,7 +182,7 @@ int reset_sequence(uint8_t seq, uint8_t param)
 }
 
 int CRemoteMH::ReadFile(const char *filename, uint8_t *rd, const uint32_t 
rdlen,
-                        int *data_read, uint8_t start_seq, lc_callback cb,
+                        uint32_t *data_read, uint8_t start_seq, lc_callback cb,
                         void *cb_arg, uint32_t cb_stage)
 {
     int err = 0;
@@ -260,7 +260,7 @@ int CRemoteMH::ReadFile(const char *filename, uint8_t *rd, 
const uint32_t rdlen,
     while(!(err = HID_ReadReport(rsp, MH_TIMEOUT))) {
         debug_print_packet(rsp);
         // Ignore 1st two bits on 2nd byte for length.
-        int len = rsp[1] & 0x3F;
+        uint8_t len = rsp[1] & 0x3F;
         // Skip 1st two bytes, read up to packet length.  "len"
         // represents the payload length (not including the two size
         // bytes), so we read a full "len" bytes from 2 to len+2.
@@ -471,7 +471,7 @@ int CRemoteMH::GetIdentity(TRemoteInfo &ri, THIDINFO &hid, 
lc_callback cb,
 
     int buflen = 1000;
     char buffer[buflen];
-    int data_read;
+    uint32_t data_read;
     if ((err = ReadFile("/sys/sysinfo", (uint8_t*)buffer, buflen, &data_read,
                         0x03, NULL, NULL, 0)))
         return err;
@@ -555,7 +555,7 @@ uint16_t mh_get_checksum(uint8_t* rd, const uint32_t len)
     // less than the length of the config.  Since we are checksumming two
     // bytes at a time, we stop when i == len - 7, which is the same as
     // i + 1 == len - 6.  In the case of odd lengths, we skip the last byte.
-    for (int i = 0; i < (len - 7); i += 2) {
+    for (uint32_t i = 0; i < (len - 7); i += 2) {
         uint16_t j = (rd[i+1] << 8) + rd[i];
         cksum ^= j;
     }
@@ -568,7 +568,7 @@ int CRemoteMH::ReadFlash(uint32_t addr, const uint32_t len, 
uint8_t *rd,
                          void *cb_arg, uint32_t cb_stage)
 {
     int err = 0;
-    int data_read;
+    uint32_t data_read;
 
     if ((err = ReadFile("/cfg/usercfg", rd, len, &data_read, 0x00, cb, cb_arg,
                         cb_stage)))
@@ -759,8 +759,9 @@ int CRemoteMH::UpdateConfig(const uint32_t len, const 
uint8_t *wr,
     const uint8_t msg_two[MH_MAX_PACKET_SIZE] =
         { 0xFF, 0x01, 0x01, 0x03, 0x80, '/', 'c', 'f', 'g', '/',
           'u', 's', 'e', 'r', 'c', 'f', 'g', 0x00, 0x80, 'W', 0x00,
-          0x04, (len & 0xFF000000) >> 24, (len & 0x00FF0000) >> 16,
-          (len & 0x0000FF00) >> 8, len & 0x000000FF };
+          0x04, static_cast<uint8_t>(len >> 24),
+          static_cast<uint8_t>(len >> 16), static_cast<uint8_t>(len >> 8),
+          static_cast<uint8_t>(len) };
     const uint8_t msg_three[MH_MAX_PACKET_SIZE] =
         { 0xFF, 0x03, 0x03, 0x02, 0x01, 0x05, 0x01, 0x33 };
     uint8_t rsp[MH_MAX_PACKET_SIZE];
diff --git a/libconcord/remote_z.cpp b/libconcord/remote_z.cpp
index 2c4ddc2..69fff1b 100644
--- a/libconcord/remote_z.cpp
+++ b/libconcord/remote_z.cpp
@@ -285,7 +285,7 @@ int CRemoteZ_USBNET::Write(uint8_t typ, uint8_t cmd, 
uint32_t len,
     const uint8_t status = STATUS_OK;
 
     uint8_t pkt[USBNET_MAX_PACKET_SIZE+3]; /* add standard 3-byte header */
-    pkt[0] = service_type << 4 | (cmd >> 8) & 0x0F;
+    pkt[0] = (service_type << 4) | ((cmd >> 8) & 0x0F);
     pkt[1] = cmd & 0xFF;
     pkt[2] = request ? 0x80 : (status & 0x7F);
 
@@ -422,7 +422,7 @@ int CRemoteZ_USBNET::UpdateConfig(const uint32_t len, const 
uint8_t *wr,
     /* write data */
     debug("UPDATE_DATA");
     uint32_t pkt_len;
-    int tlen = len;
+    uint32_t tlen = len;
     uint8_t *wr_ptr = const_cast<uint8_t*>(wr);
     uint8_t tmp_pkt[1033];
     tmp_pkt[0] = 0x03; // 3 parameters
@@ -554,13 +554,14 @@ int CRemoteZ_USBNET::SetTime(const TRemoteInfo &ri, const 
THarmonyTime &ht,
 
     uint8_t tsv[32] = {
         0x0C, // 12 parameters
-        0x02, ht.year >> 8, ht.year, // 2 bytes
-        0x01, ht.month,
-        0x01, ht.day,
-        0x01, ht.hour,
-        0x01, ht.minute,
-        0x01, ht.second,
-        0x01, ht.dow,
+        0x02, static_cast<uint8_t>(ht.year >> 8),
+        static_cast<uint8_t>(ht.year), // 2 bytes
+        0x01, static_cast<uint8_t>(ht.month),
+        0x01, static_cast<uint8_t>(ht.day),
+        0x01, static_cast<uint8_t>(ht.hour),
+        0x01, static_cast<uint8_t>(ht.minute),
+        0x01, static_cast<uint8_t>(ht.second),
+        0x01, static_cast<uint8_t>(ht.dow),
         // utcOffset
         0x02, 0, 0, // 2 bytes - 900 doesn't seem to accept this
         // 0s
@@ -1174,15 +1175,15 @@ int CRemoteZ_Base::SetTime(const TRemoteInfo &ri, const 
THarmonyTime &ht,
 {
     int err = 0;
 
-    uint8_t tsv[16] = { ht.year, 0, // 2 bytes
-        ht.month,
-        ht.day,
-        ht.hour,
-        ht.minute,
-        ht.second,
-        ht.dow,
+    uint8_t tsv[16] = { static_cast<uint8_t>(ht.year), 0, // 2 bytes
+        static_cast<uint8_t>(ht.month),
+        static_cast<uint8_t>(ht.day),
+        static_cast<uint8_t>(ht.hour),
+        static_cast<uint8_t>(ht.minute),
+        static_cast<uint8_t>(ht.second),
+        static_cast<uint8_t>(ht.dow),
         // utcOffset
-        ht.utc_offset, 0, // 2 bytes
+        static_cast<uint8_t>(ht.utc_offset), 0, // 2 bytes
         // 0s
         0, 0, // 2 bytes
         0, 0, // 2 bytes
@@ -1496,7 +1497,7 @@ int CRemoteZ_HID::LearnIR(uint32_t *freq, uint32_t 
**ir_signal,
 }
 
 int CRemoteZ_Base::ReadFile(const char *filename, uint8_t *rd,
-                            const uint32_t rdlen, int *data_read,
+                            const uint32_t rdlen, uint32_t *data_read,
                             uint8_t start_seq, lc_callback cb, void *cb_arg,
                             uint32_t cb_stage)
 {
diff --git a/libconcord/xml_headers.h b/libconcord/xml_headers.h
index 6f79253..7e259a8 100644
--- a/libconcord/xml_headers.h
+++ b/libconcord/xml_headers.h
@@ -131,8 +131,6 @@ const char *config_header="\
 
 const char *mh_config_header = "<DATA><FILES><FILE NAME=\"Result.EzHex\" 
SIZE=\"%i\" PATH=\"/cfg/usercfg\" VERSION=\"1\" FW_VERSION=\"9.5\" 
OPERATIONTYPE=\"userconfiguration\"><CHECKSUM SEED=\"0x4321\" OFFSET=\"0x0\" 
LENGTH=\"0x%04x\" EXPECTEDVALUE=\"0x%04x\" 
TYPE=\"XOR\"/></FILE></FILES><INTENDED><SKIN>%i</SKIN></INTENDED><ORDER><ORDER_ELEMENT
 NAME=\"Result.EzHex\" RESET=\"true\"/></ORDER></DATA>";
 
-//User-Agent: HarmonyBrowser/7.7.0 (Build 0; UpdatedFrom 7.3.0.15; Skin 
logitech; Windows Vista 6.1; x86; en; rv: 1.8.0.2) Gecko/20060125\r\n\
-
 const char *post_header="\
 POST /%s HTTP/1.1\r\n\
 User-Agent: HarmonyBrowser/7.3.0 (Build 15; UpdatedFrom 7.3.0.15; Skin 
logitech; Windows XP 5.1; x86; en; rv: 1.8.0.2) Gecko/20060125\r\n\
-- 
1.8.5.3


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to