ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src browser.c,1.2,1.3 chat_window.c,1.6,1.7 e


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src browser.c,1.2,1.3 chat_window.c,1.6,1.7 extgtktext.c,1.3,1.4 globals.h,1.1.1.1,1.2 plugin.c,1.1.1.1,1.2 prefs.c,1.4,1.5 sound.c,1.2,1.3 util.c,1.2,1.3
Date: Wed, 01 Jan 2003 09:22:48 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv9013/src

Modified Files:
        browser.c chat_window.c extgtktext.c globals.h plugin.c 
        prefs.c sound.c util.c 
Log Message:
From: Andy <address@hidden>
Subject: [Yattm PATCH] Various cleanups & pointer comparison buglet fixes


Index: browser.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/browser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- browser.c   31 Dec 2002 16:46:27 -0000      1.2
+++ browser.c   1 Jan 2003 14:22:45 -0000       1.3
@@ -33,13 +33,8 @@
 #ifndef __MINGW32__
 #include <stdlib.h>
 #endif
-#include <unistd.h>
 #include <string.h>
 
-
-
-
-#include <gtk/gtk.h>
 #include <gdk/gdkprivate.h>
 #ifndef __MINGW32__
 #include <gdk/gdkx.h>
@@ -96,7 +91,7 @@
         if (screen != save_screen) {
                 Display *dpy = DisplayOfScreen(screen);
                 Atom __SWM_VROOT = None;
-                int i;
+                unsigned int i;
                 Window rootReturn, parentReturn, *children;
                 unsigned int numChildren;
 

Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- chat_window.c       1 Jan 2003 02:13:40 -0000       1.6
+++ chat_window.c       1 Jan 2003 14:22:45 -0000       1.7
@@ -31,10 +31,7 @@
 #endif
 #include "intl.h"
 #include <string.h>
-#include <time.h>
-#include <stdio.h>
 #include <stdlib.h>
-#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <ctype.h>
 #include <assert.h>
@@ -48,7 +45,6 @@
 #include "status.h"
 #include "away_window.h"
 #include "message_parse.h"
-#include "extgtktext.h"
 #include "gtk_eb_html.h"
 #include "plugin.h"
 #include "contact_actions.h"
@@ -1081,6 +1077,7 @@
 static gboolean chat_key_press(GtkWidget *widget, GdkEventKey *event, gpointer 
data)
 {
   chat_window *cw = (chat_window *)data;
+  GdkModifierType modifiers = event->state & (GDK_SHIFT_MASK | 
GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_MOD4_MASK);
 
   eb_update_window_title(cw, FALSE);
 
@@ -1167,15 +1164,13 @@
        * when next contains every modifier that previous has (with some more)
        * but i really don't think that will be a huge problem =)
        */
-      gint state = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | 
GDK_MOD1_MASK | GDK_MOD4_MASK);
-
-      if ((state == accel_prev_tab[1]) && (event->keyval == accel_prev_tab[0]))
+      if ((modifiers == accel_prev_tab.modifiers) && (event->keyval == 
accel_prev_tab.keyval))
        {
          gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
          gtk_notebook_prev_page( GTK_NOTEBOOK(cw->notebook) );
          return gtk_true();
        }
-      else if ((state == accel_next_tab[1]) && (event->keyval == 
accel_next_tab[0]))
+      else if ((modifiers == accel_next_tab.modifiers) && (event->keyval == 
accel_next_tab.keyval))
        {
          gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
          gtk_notebook_next_page( GTK_NOTEBOOK(cw->notebook) );
@@ -1183,10 +1178,10 @@
        }
     }
 
-  if(cw->perfered==NULL || event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | 
GDK_MOD1_MASK | GDK_MOD4_MASK))
+  if(cw->perfered==NULL || modifiers)
   { return gtk_false(); }
 
-  if(!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | 
GDK_MOD4_MASK)))
+  if(!modifiers)
   {
     send_typing_status(cw);
   }

Index: extgtktext.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/extgtktext.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- extgtktext.c        1 Jan 2003 01:54:05 -0000       1.3
+++ extgtktext.c        1 Jan 2003 14:22:45 -0000       1.4
@@ -1083,7 +1083,7 @@
   gint new_line_count = 1;
   guint old_height = 0;
   guint length;
-  guint i;
+  gint i;
   gint numwcs;
   
   g_return_if_fail (text != NULL);

Index: globals.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/globals.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- globals.h   23 Dec 2002 22:05:35 -0000      1.1.1.1
+++ globals.h   1 Jan 2003 14:22:45 -0000       1.2
@@ -95,8 +95,8 @@
 extern gint do_tabbed_chat_orient;
 
 /* tabbed chat tab switching hotkeys */
-extern gint accel_next_tab[2];
-extern gint accel_prev_tab[2];
+extern GdkDeviceKey accel_next_tab;
+extern GdkDeviceKey accel_prev_tab;
 
 /* alternate web browser */
 extern gint use_alternate_browser;

Index: plugin.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/plugin.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- plugin.c    23 Dec 2002 22:05:36 -0000      1.1.1.1
+++ plugin.c    1 Jan 2003 14:22:45 -0000       1.2
@@ -27,24 +27,16 @@
 #ifdef __MINGW32__
 typedef long __off32_t;
 #endif
-#include <ltdl.h>
-#ifndef __MINGW32__
-#endif
 #include <sys/types.h>
 #include <dirent.h> /* Routines to read directories to find modules */
-#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include "globals.h"
-#include "value_pair.h"
 #include "defaults.h"
 #include "service.h"
 #include "plugin.h"
-#include "plugin_api.h"
-#include "dialog.h"
-#include "service.h"
 #include "nomodule.h"
-
+#include "value_pair.h"
 
 char *PLUGIN_TYPE_TXT[]={"SERVICE", "UTILITY", "SOUND", "LOG", "GUI", 
"UNKNOWN"};
 char *PLUGIN_STATUS_TXT[]={"Not Loaded", 
@@ -52,10 +44,10 @@
                           "Cannot Load"};
 
 PLUGIN_INFO Plugin_Cannot_Load = {PLUGIN_UNKNOWN, 
-                                 "Unkown", 
+                                 "Unknown",
                                  "Unknown", 
                                  "Unknown", 
-                                 "Unknown", NULL, NULL};
+                                 "Unknown", NULL, NULL, NULL, NULL};
 
 gint compare_plugin_loaded_service(gconstpointer a, gconstpointer b) {
        const eb_PLUGIN_INFO *epi=a;
@@ -295,7 +287,7 @@
                n = 0;
                while((dp = readdir(dirp)) != NULL)
                {
-                       if( dp < 0 )
+                       if( dp == NULL )
                        {
                                sprintf(buf, _("Looking for modules in %s"), 
cur_path);
                                perror(buf);

Index: prefs.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/prefs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- prefs.c     1 Jan 2003 01:54:05 -0000       1.4
+++ prefs.c     1 Jan 2003 14:22:45 -0000       1.5
@@ -30,14 +30,10 @@
 #endif
 
 #include "intl.h"
-#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <glib.h>
-#include "dialog.h"
-#include "service.h"
 #include "util.h"
 #include "libproxy/libproxy.h"
 #include "pixmaps/ok.xpm"
@@ -48,7 +44,6 @@
 #else
 #include "defaults_win32.h"
 #endif
-#include "input_list.h"
 #include "value_pair.h"
 #include "gtk_globals.h"
 #include "status.h"
@@ -504,10 +499,11 @@
 gint do_smiley = 1;
 gint do_smiley_old = 1;
 
-gint accel_prev_tab[2] =     { GDK_Left, GDK_CONTROL_MASK };
-gint accel_prev_tab_old[2] = { GDK_Left, GDK_CONTROL_MASK };
-gint accel_next_tab[2] =     { GDK_Right, GDK_CONTROL_MASK };
-gint accel_next_tab_old[2] = { GDK_Right, GDK_CONTROL_MASK };
+
+GdkDeviceKey accel_prev_tab =     { GDK_Left, GDK_CONTROL_MASK };
+GdkDeviceKey accel_prev_tab_old = { GDK_Left, GDK_CONTROL_MASK };
+GdkDeviceKey accel_next_tab =     { GDK_Right, GDK_CONTROL_MASK };
+GdkDeviceKey accel_next_tab_old = { GDK_Right, GDK_CONTROL_MASK };
 guint accel_change_handler_id = 0;
 
 /*
@@ -582,7 +578,7 @@
 }
 
 static void add_key_set(gchar *labelString,
-                                       gint *userdata,
+                                       GdkDeviceKey *keydata,
                                        GtkWidget *vbox)
 {
      GtkWidget *hbox;
@@ -598,13 +594,13 @@
         gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
      gtk_widget_show (label);
 
-     clabel=gtk_accelerator_name(userdata[0], userdata[1]);
+     clabel=gtk_accelerator_name(keydata->keyval, keydata->modifiers);
      button = gtk_button_new_with_label(clabel);
      g_free(clabel);
         
      gtk_signal_connect(GTK_OBJECT(button), "clicked", 
                        GTK_SIGNAL_FUNC(getnewkey), 
-                       (gpointer)userdata);
+                       (gpointer)keydata);
      gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
      gtk_widget_show (button);
 
@@ -702,10 +698,8 @@
         do_ignore_back_old = do_ignore_back;
         do_ignore_font_old = do_ignore_font;
 
-        accel_next_tab_old[0] = accel_next_tab[0];
-        accel_next_tab_old[1] = accel_next_tab[1];
-        accel_prev_tab_old[0] = accel_prev_tab[0];
-        accel_prev_tab_old[1] = accel_prev_tab[1];
+        accel_next_tab_old = accel_next_tab;
+        accel_prev_tab_old = accel_prev_tab;
         accel_change_handler_id = 0;
 
      eb_button(_("Send idle/away status to servers"), &do_send_idle_time, 
vbox);
@@ -743,8 +737,8 @@
     gtk_widget_show(hbox);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-        add_key_set(_("Previous Tab Hotkey (requires a modifier)"), 
accel_prev_tab, vbox);
-        add_key_set(_("Next Tab Hotkey (requires a modifier)"), 
accel_next_tab, vbox);
+        add_key_set(_("Previous Tab Hotkey (requires a modifier)"), 
&accel_prev_tab, vbox);
+        add_key_set(_("Next Tab Hotkey (requires a modifier)"), 
&accel_next_tab, vbox);
 
      gtk_widget_show(vbox);
      gtk_notebook_append_page(GTK_NOTEBOOK(prefs_note), vbox, 
gtk_label_new(_("Chat")));
@@ -768,10 +762,8 @@
         do_ignore_back = do_ignore_back_old;
         do_ignore_font = do_ignore_font_old;    
         
-        accel_next_tab[0] = accel_next_tab_old[0];
-        accel_next_tab[1] = accel_next_tab_old[1];
-        accel_prev_tab[0] = accel_prev_tab_old[0];
-        accel_prev_tab[1] = accel_prev_tab_old[1];
+        accel_next_tab = accel_next_tab_old;
+        accel_prev_tab = accel_prev_tab_old;
 }
 
 void write_chat_prefs(FILE *fp)
@@ -804,10 +796,10 @@
         fprintf(fp,"do_ignore_fore=%d\n", do_ignore_fore);
         fprintf(fp,"do_ignore_back=%d\n", do_ignore_back);
         fprintf(fp,"do_ignore_font=%d\n", do_ignore_font);
-        ptr=gtk_accelerator_name(accel_next_tab[0], accel_next_tab[1]);
+        ptr=gtk_accelerator_name(accel_next_tab.keyval, 
accel_next_tab.modifiers);
         fprintf(fp,"accel_next_tab=%s\n", ptr);
         g_free(ptr);
-        ptr=gtk_accelerator_name(accel_prev_tab[0], accel_prev_tab[1]);
+        ptr=gtk_accelerator_name(accel_prev_tab.keyval, 
accel_prev_tab.modifiers);
         fprintf(fp,"accel_prev_tab=%s\n", ptr);
         g_free(ptr);
 }
@@ -2423,8 +2415,8 @@
        do_yattm_debug_html=iGetLocalPref("do_yattm_debug_html");
        do_plugin_debug       =iGetLocalPref("do_plugin_debug");
        font_size             =iGetLocalPref("FontSize");
-        gtk_accelerator_parse(cGetLocalPref("accel_next_tab"), 
&accel_next_tab[0], (GdkModifierType *)&accel_next_tab[1]);
-        gtk_accelerator_parse(cGetLocalPref("accel_prev_tab"), 
&accel_prev_tab[0], (GdkModifierType *)&accel_prev_tab[1]);
+        gtk_accelerator_parse(cGetLocalPref("accel_next_tab"), 
&(accel_next_tab.keyval), &(accel_next_tab.modifiers));
+        gtk_accelerator_parse(cGetLocalPref("accel_prev_tab"), 
&(accel_prev_tab.keyval), &(accel_prev_tab.modifiers));
      proxy_set_proxy(iGetLocalPref("proxy_type"), cGetLocalPref("proxy_host"), 
iGetLocalPref("proxy_port"));
      proxy_set_auth(iGetLocalPref("do_proxy_auth"), 
cGetLocalPref("proxy_user"), cGetLocalPref("proxy_password"));
      fclose(fp);

Index: sound.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/sound.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sound.c     27 Dec 2002 16:46:52 -0000      1.2
+++ sound.c     1 Jan 2003 14:22:45 -0000       1.3
@@ -33,25 +33,20 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
-#include <unistd.h>
 #include <sys/stat.h>
-#include <gtk/gtk.h>
 #include <fcntl.h>
-#ifndef __MINGW32__
-#include <sys/wait.h>
-#else
+#ifdef __MINGW32__
 #include <windows.h>
-#endif
-#include <sys/types.h>
-#ifndef __MINGW32__
+#else
+#include <sys/wait.h>
 #include <sys/signal.h>
 #endif
 #include <errno.h>
 #include <math.h>
-#include "sound.h"
 #include "globals.h"
 #include "util.h"
 #include "dialog.h"
+#include "sound.h"
 
 #ifdef ESD_SOUND
 #include <esd.h>
@@ -416,7 +411,7 @@
     FILE *fd_in, *fd_out; 
     int bytes_read, x;
     guint32 header_size;
-    ssize_t io_bytes;
+    size_t io_bytes;
   
     typedef struct
     {
@@ -438,7 +433,7 @@
 
     if (scaling == 0.0) return(infile);  /* save time */
 
-    if ((fd_in = fopen(infile, "rb")) < 0)
+    if ((fd_in = fopen(infile, "rb")) == NULL)
     {
        fprintf(stderr,"Failed opening infile %s, errno=%d\n",infile, errno);
        return(infile);
@@ -468,7 +463,7 @@
     /* file is right type, reset to start */
     rewind(fd_in);
 
-    if ((fd_out = fopen(outfile, "w+b")) < 0)
+    if ((fd_out = fopen(outfile, "w+b")) == NULL)
     {
        fprintf(stderr,"Failed opening outfile %s, errno=%d\n",outfile,
                errno);

Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- util.c      27 Dec 2002 16:46:52 -0000      1.2
+++ util.c      1 Jan 2003 14:22:45 -0000       1.3
@@ -26,36 +26,25 @@
  */
 
 #include "intl.h"
-#include <gtk/gtk.h>
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
-#include <sys/types.h>
-#ifndef __MINGW32__
-#include <sys/wait.h>
-#endif
 #ifdef __MINGW32__
 #include <winsock2.h>
 #else
+#include <sys/wait.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
 #endif
-#include <unistd.h>
-#include <stdio.h>
 #include <ctype.h>
 #include <sys/stat.h>
 #include <assert.h>
 #include "util.h"
 #include "status.h"
-#include "account.h"
 #include "globals.h"
-#include "contact.h"
-#include "service.h"
-#include "contact.h"
 #include "chat_window.h"
-#include "dialog.h"
 #include "value_pair.h"
 #include "plugin.h"
 
@@ -91,7 +80,7 @@
                f = popen("netstat -nr", "r");
                if((int)f < 1)
                                goto IP_TEST_2;
-               while( fgets(buff, sizeof(buff), f)  > 0 )
+               while( fgets(buff, sizeof(buff), f)  != NULL )
                {
                                c = strtok( buff, " " );
                                if( (strstr(c, "default") || 
strstr(c,"0.0.0.0") ) &&
@@ -122,7 +111,7 @@
                if((int)f < 1)
                                goto IP_TEST_2;
                
-               while( fgets(buff, sizeof(buff), f)  > 0 )
+               while( fgets(buff, sizeof(buff), f) != NULL )
                {
                                if( strstr(buff, "inet") && 
strstr(buff,gateway) )
                                                break;




reply via email to

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