[libdvbpsi-devel] examples/dvbinfo/dvbinfo.c: Unsigned compare against 0 (CID 17261)

Jean-Paul Saman git at videolan.org
Wed Apr 16 15:53:32 CEST 2014


libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Apr 11 16:00:06 2014 +0200| [b31554e843980a706cd7b30c7f30ffcd08ce0efa] | committer: Jean-Paul Saman

examples/dvbinfo/dvbinfo.c: Unsigned compare against 0 (CID 17261)

pf_write() returns a ssize_t which was stored inside a size_t (an unsigned).
Later on this value was used in a check against 0.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=b31554e843980a706cd7b30c7f30ffcd08ce0efa
---

 examples/dvbinfo/dvbinfo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c
index 92cd075..390f38e 100644
--- a/examples/dvbinfo/dvbinfo.c
+++ b/examples/dvbinfo/dvbinfo.c
@@ -368,14 +368,14 @@ static int dvbinfo_process(dvbinfo_capture_t *capture)
 
         if (param->output)
         {
-            size_t size = param->pf_write(param->fd_out, buffer->p_data, buffer->i_size);
+            ssize_t size = param->pf_write(param->fd_out, buffer->p_data, buffer->i_size);
             if (size < 0) /* error writing */
             {
                 libdvbpsi_log(param, DVBINFO_LOG_ERROR,
                               "error (%d) writting to %s", errno, param->output);
                 break;
             }
-            else if (size < buffer->i_size) /* short writting disk full? */
+            else if ((size_t)size < buffer->i_size) /* short writting disk full? */
             {
                 libdvbpsi_log(param, DVBINFO_LOG_ERROR,
                               "error writting to %s (disk full?)", param->output);



More information about the libdvbpsi-devel mailing list