ipchat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ipchat-devel] correcting error readily to mind and signed unsigned erro


From: ml
Subject: [ipchat-devel] correcting error readily to mind and signed unsigned error
Date: Thu, 19 Jul 2012 12:18:01 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.6esrpre) Gecko/20120717 Thunderbird/10.0.6

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hello guys


I just finished correcting errors that come readily to mind and, more
particularly comparison of signed errors unsigned


multiple patch
localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/demux.c demux.c
- --- /home/swilting/ipchat-0.5/src/demux.c     2007-07-06
18:53:18.000000000 +0200
+++ demux.c     2012-07-19 11:54:42.322755806 +0200
@@ -293,9 +293,9 @@
 dmx_add_periodic_alarm (unsigned long int seconds, long int shift,
                         void (*callback) (void *), void *data)
 {
- -     return timer_pq_add (shift < 0 ? get_uptime() + seconds
- -                                    : time_quantize(seconds, shift),
- -                          seconds, shift, callback, data);
+       return timer_pq_add ((signed int)shift < 0 ? get_uptime() + (signed
int)seconds
+                                      : time_quantize((signed int)seconds,
(signed int)shift),
+                                      (signed int)seconds, (signed
int)shift, callback, data);
 }

 /* Call 'callback' with 'data' as parameter in 'seconds' seconds from
now. */
@@ -322,9 +322,9 @@
    POSIX environments, ie. the handler keeps assigned to the signal after
    that signal arrives. */
 void
- -dmx_signal (int signum, void (*callback) (int))
+dmx_signal ( int signum, void (*callback) (int))
 {
- -     if (signum >= 0 && signum < MAX_SIGNALS) {
+       if ((signed int)signum >= 0 && (signed int)signum < (signed
int)MAX_SIGNALS) {
                sig_handlers[signum] = callback;
                signal (signum, dmx_sighandler);
        }
@@ -369,7 +369,7 @@
 void
 dmx_remove_signal (int signum)
 {
- -     if (signum >= 0 && signum < MAX_SIGNALS) {
+       if ((signed int)signum >= 0 && (signed int)signum < (signed
int)MAX_SIGNALS) {
                signal (signum, SIG_DFL);
                recvd_signals &= ~(1 << signum);
        }

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/log.h log.h
- --- /home/swilting/ipchat-0.5/src/log.h       2007-07-06 18:54:26.000000000
+0200
+++ log.h       2012-07-19 06:08:59.180880737 +0200
@@ -21,6 +21,7 @@

 #include "common.h"
 #include "contact_list.h"
+#include "user_iface.h"

 extern void lg_log_text (const char *user, contact_t *contact,
                          const char *text, int len);


localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/misc.c misc.c
- --- /home/swilting/ipchat-0.5/src/misc.c      2011-04-19 20:59:11.000000000
+0200
+++ misc.c      2012-07-19 09:58:07.921755870 +0200
@@ -181,7 +181,7 @@
                while (i < r)  {
                        if (b [i] == '{' && !c) {
                                nk++;
- -                             if (nk > 1 && name_l == k && j < size) {
+                               if ((unsigned int)nk > 1 && (unsigned 
int)name_l == (unsigned
int)k && (unsigned int)j < (unsigned int)size) {
                                        buff [j] = '{';
                                        j++;
                                        ret++;
@@ -192,9 +192,9 @@
                                s=0;
                                if (nk > 0)
                                        nk--;
- -                             if (name_l == k)  {
+                               if ((unsigned int)name_l == (unsigned int)k)  {
                                        if (nk > 0) {
- -                                             if (j < size) {
+                                               if ((unsigned int)j < size) {
                                                        buff [j] = '}';
                                                        j++;
                                                }
@@ -205,7 +205,7 @@
                                                        free (b);
                                                        lseek (fd, t, SEEK_CUR);
                                                }
- -                                             if (j >= size)
+                                               if ((unsigned int)j >= size)
                                                        return ERR_SIZE;
                                                
                                                buff [j] = '\0';        
@@ -222,7 +222,7 @@
                                        k=0;
                        }
                        else if (nk > 0) {
- -                             if (name_l == k && j < size) {
+                               if ((unsigned int)name_l == (unsigned int)k && 
(unsigned int)j <
(unsigned int)size) {
                                        if (isspace (b[i]) && !c) {
                                                s=0;
                                        }
@@ -249,17 +249,17 @@
                        }
                        else if (isspace ((int) b[i])) {
                                t=0;
- -                             if (name_l != k) {      
+                               if ((unsigned int)name_l != (unsigned int)k) {  
                                        k = 0;
                                }
                        }
                        else {
- -                             if (k == name_l)
+                               if ((unsigned int)k == name_l)
                                        k=0;
                        
                                if (name[k] == b[i] && !t) {
                                        k++;
- -                                     if (k == name_l)
+                                       if ((unsigned int)k == name_l)
                                                t=1;
                                }       
                                
@@ -310,7 +310,7 @@
        if (t == NULL)
                return ERR;
        
- -     while (i < tabs) {
+       while ((unsigned int)i < tabs) {
                t [i] = '\t';
                i++;
        }
@@ -403,7 +403,7 @@
        free (t);

        r = write (fd, b, strlen (b));
- -     if (r != strlen (b)) {
+       if ((unsigned int)r != strlen (b)) {
                free (b);
                return ERR;
        }

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/parse.h parse.h
- --- /home/swilting/ipchat-0.5/src/parse.h     2007-07-06
18:54:31.000000000 +0200
+++ parse.h     2012-07-19 05:55:54.499755634 +0200
@@ -20,7 +20,8 @@
 #define PARSE_H 1

 #include "contact_list.h"
+#include "tls.h"

 extern void pa_parse_line (contact_t * win_contact, const char *line);
- -
+extern void tls_session_info (contact_t *contact);
 #endif


localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/pqueue.h pqueue.h
- --- /home/swilting/ipchat-0.5/src/pqueue.h    2007-07-06
18:54:33.000000000 +0200
+++ pqueue.h    2012-07-19 10:01:49.566755984 +0200
@@ -75,8 +75,8 @@
 extern void * pq_del_func(void*,pqueue*);
 extern void * pq_get_func(void*,pqueue*);
 extern void * pq_del_ptr(void*,pqueue*);
- -extern pq_chpri_func(void*,prio_t,pqueue*);
- -extern pq_chpri_ptr(void*,prio_t,pqueue*);
+extern int pq_chpri_func(void*,prio_t,pqueue*);
+extern int pq_chpri_ptr(void*,prio_t,pqueue*);
 extern int pq_delete(pqueue*);

 #endif /* PQUEUE_H */


localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/protocol.c
protocol.c
- --- /home/swilting/ipchat-0.5/src/protocol.c  2011-04-19
20:01:09.000000000 +0200
+++ protocol.c  2012-07-19 11:45:54.472755758 +0200
@@ -132,7 +132,7 @@
        int pl_size;
        int r;

- -     CHECK_J (len >= sizeof(header.type), small_size);
+       CHECK_J ((unsigned int)len >= sizeof(header.type), small_size);
        type = *(uint16_t *)msg;
        NTOH16 (type);
        hdr_size = header_size (type);


localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/protocol.h
protocol.h
- --- /home/swilting/ipchat-0.5/src/protocol.h  2007-07-06
18:54:36.000000000 +0200
+++ protocol.h  2012-07-19 06:26:04.342755847 +0200
@@ -21,7 +21,8 @@

 #include "common.h"
 #include "contact_list.h"
- -
+#include "user_iface.h"
+#include "tls.h"
 /* Protocol version. Changes when the program cannot communicate with
    older ipchat's anymore. It's sent in HELLO messages. */
 #define PROTOCOL_VERSION 2

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/tls.c tls.c
- --- /home/swilting/ipchat-0.5/src/tls.c       2007-07-06 18:53:49.000000000
+0200
+++ tls.c       2012-07-19 06:05:59.893969387 +0200
@@ -263,10 +263,27 @@
        /* check the authentication type used and switch to the appropriate */
        cred = gnutls_auth_get_type (session);
        switch (cred) {
+        case GNUTLS_CRD_IA:
+             ui_output_info ("- TLS/IA session\n");
+             break;
+        #ifdef ENABLE_SRP
        case GNUTLS_CRD_SRP:
                ui_output_info ("\\b\\2-\\0 SRP session with username %s",
                                gnutls_srp_server_get_username (session));
                break;
+        #endif /* ENABLE_SRP */
+        case GNUTLS_CRD_PSK:
+       /* This returns NULL in server side.
+        */
+                if (gnutls_psk_client_get_hint (session) != NULL)
+                 ui_output_info ("- PSK authentication. PSK hint '%s'\n",
+                 gnutls_psk_client_get_hint (session));
+       /* This returns NULL in client side.
+        */
+                if (gnutls_psk_server_get_username (session) != NULL)
+                ui_output_info ("- PSK authentication. Connected as
'%s'\n",
+                 gnutls_psk_server_get_username (session));
+       break;
        case GNUTLS_CRD_ANON:   /* anonymous authentication */
                ui_output_info ("\\b\\2-\\0 Anonymous DH using prime of "
                                "%d bits", gnutls_dh_get_prime_bits (session));

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/tls.
tls.c  tls.h
address@hidden src]$ diff -u  /home/swilting/ipchat-0.5/src/tls.h
tls.h
- --- /home/swilting/ipchat-0.5/src/tls.h       2007-07-06 18:54:42.000000000
+0200
+++ tls.h       2012-07-19 05:44:47.160756089 +0200
@@ -21,6 +21,7 @@

 #include <unistd.h>            /* size_t, ssize_t */
 #include "contact.h"
+#include "user_iface.h"

 /* Initialize TLS stuff. */
 extern void tls_init (void);


localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/uconfig.h uconfig.h
- --- /home/swilting/ipchat-0.5/src/uconfig.h   2007-07-06
18:54:46.000000000 +0200
+++ uconfig.h   2012-07-19 06:31:52.625756368 +0200
@@ -40,5 +40,8 @@

 extern int cf_load ();
 extern int cf_save ();
+extern int wget_wch();
+extern int waddwstr();
+extern int waddnwstr();

 #endif

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/ui_format.c
ui_format.c
- --- /home/swilting/ipchat-0.5/src/ui_format.c 2011-04-19
21:48:34.000000000 +0200
+++ ui_format.c 2012-07-19 06:24:11.088817431 +0200
@@ -27,7 +27,7 @@
 #endif
 #include "ui_common.h"
 #include "uconfig.h"
- -
+#include <curses.h>
 #define DEBUG_PRINT_SEQS FALSE

 #define ALIGN_PAD 1             /* additional spaces between nick and
text */

localhost src]$ diff -u  /home/swilting/ipchat-0.5/src/ui_input.c
ui_input.c
- --- /home/swilting/ipchat-0.5/src/ui_input.c  2011-04-19
20:58:21.000000000 +0200
+++ ui_input.c  2012-07-19 09:40:40.693755687 +0200
@@ -25,7 +25,8 @@
 #include "ui_common.h"
 #include "uconfig.h"
 #include "misc.h"
- -
+#include <wctype.h>
+#include <curses.h>
 /* Prototypes */
 static void input_left ();
 static void input_right ();
@@ -346,7 +347,7 @@
        memcpy (cur->ibuf, cur->hist[cur->hist_pos], len * sizeof(wchar_t));
        cur->ibuf_len = len;
        cur->icursor = len;
- -     if (len < i_input.ncols)
+       if ((signed int)len < i_input.ncols)
                cur->ishow = 0;
        else
                cur->ishow = len - i_input.ncols + 1;
@@ -369,7 +370,7 @@
        prev--;

        len = wcslen (cur->hist[prev]);
- -     return (len == cur->ibuf_len &&
+       return ((signed int)len == cur->ibuf_len &&
                memcmp (cur->ibuf, cur->hist[prev], len * sizeof(wchar_t))
                == 0);
 }




please update the release with this differents patch

This was written for posterity



sincerely

- -- 
  http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
  gpg --keyserver pgp.mit.edu --recv-key C2626742

  http://urlshort.eu fakessh @
  http://gplus.to/sshfake
  http://gplus.to/sshswilting
  http://gplus.to/john.swilting
  https://lists.fakessh.eu/mailman/
  This list is moderated by me, but all applications will be accepted
  provided they receive a note of presentation
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAH3tkACgkQNgqL0sJiZ0LFWACfWOyAn3Eri80EnhMni6jRLd90
hb4An1nfvgdR4v9MC+OE3GMhMGmgnXqn
=Cs8i
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]