changeset 11506:88d504770c60

[gaim-migrate @ 13751] Fix some C99isms in the whiteboard code. Hopefully I didn't break anything. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 11 Sep 2005 05:37:31 +0000
parents 6e40226a3321
children 18c18cbc0967
files src/gtkwhiteboard.c src/protocols/yahoo/yahoo.c src/whiteboard.c
diffstat 3 files changed, 36 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkwhiteboard.c	Sun Sep 11 05:19:46 2005 +0000
+++ b/src/gtkwhiteboard.c	Sun Sep 11 05:37:31 2005 +0000
@@ -92,6 +92,9 @@
 	/* GdkPixbuf *palette_color_area[PALETTE_NUM_COLORS]; */
 	
 	GaimGtkWhiteboard *gtkwb = g_new0( GaimGtkWhiteboard, 1 );
+
+	const char *window_title;
+
 	gtkwb->wb = wb;
 	wb->ui_data = gtkwb;
 	
@@ -104,7 +107,7 @@
 	gtk_widget_set_name( window, wb->who );
 	
 	// Try and set window title as the name of the buddy, else just use their username
-	const char *window_title = gaim_contact_get_alias( gaim_buddy_get_contact( gaim_find_buddy( wb->account, wb->who ) ) );
+	window_title = gaim_contact_get_alias( gaim_buddy_get_contact( gaim_find_buddy( wb->account, wb->who ) ) );
 	if( window_title )
 		gtk_window_set_title( ( GtkWindow* )( window ), window_title );
 	else
@@ -454,6 +457,9 @@
 		// NOTE 100 is a temporary constant for how many deltas/motions in a stroke (needs UI Ops?)
 		if( MotionCount == 100 )
 		{
+			int *x0			= g_new0( int, 1 );
+			int *y0			= g_new0( int, 1 );
+
 			draw_list = g_list_append( draw_list, ( gpointer )( dx ) );
 			draw_list = g_list_append( draw_list, ( gpointer )( dy ) );
 			
@@ -465,9 +471,6 @@
 			if( draw_list )
 				draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
 			
-			int *x0			= g_new0( int, 1 );
-			int *y0			= g_new0( int, 1 );
-			
 			*x0			= LastX;
 			*y0			= LastY;
 		
@@ -577,15 +580,15 @@
 			
 	GdkRectangle		update_rect;
 
+	GdkGC			*gfx_con = gdk_gc_new( pixmap );
+	GdkColor		col;
+
 	update_rect.x		= x - size / 2;
 	update_rect.y		= y - size / 2;
 	update_rect.width	= size;
 	update_rect.height	= size;
 	
 	// Interpret and convert color
-	GdkGC			*gfx_con = gdk_gc_new( pixmap );
-	GdkColor		col;
-	
 	gaim_gtk_whiteboard_rgb24_to_rgb48( color, &col );
 	
 	gdk_gc_set_rgb_fg_color( gfx_con, &col );
@@ -630,6 +633,15 @@
 	int xstep;
 	int ystep;
 	
+	int dx;
+	int dy;
+
+	int error;
+	int derror;
+
+	int x;
+	int y;
+
 	gboolean steep = abs( y1 - y0 ) > abs( x1 - x0 );
 	
 	if( steep )
@@ -638,14 +650,14 @@
 		temp = x1; x1 = y1; y1 = temp;	
 	}
 	
-	int dx		= abs( x1 - x0 );
-	int dy		= abs( y1 - y0 );
+	dx		= abs( x1 - x0 );
+	dy		= abs( y1 - y0 );
 	
-	int error	= 0;
-	int derror	= dy;
+	error	= 0;
+	derror	= dy;
 	
-	int x		= x0;
-	int y		= y0;
+	x		= x0;
+	y		= y0;
 	
 	if( x0 < x1 )
 		xstep = 1;
@@ -733,6 +745,8 @@
 	
 	GtkWidget *dialog;
 
+	int result;
+
 	dialog = gtk_file_chooser_dialog_new ("Save File",
 					      GTK_WINDOW(gtkwb->window),
 					      GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -750,7 +764,7 @@
 //	else
 //		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document);
 
-	int result = gtk_dialog_run( GTK_DIALOG( dialog ) );
+	result = gtk_dialog_run( GTK_DIALOG( dialog ) );
 
 	if( result == GTK_RESPONSE_ACCEPT )
 	{
--- a/src/protocols/yahoo/yahoo.c	Sun Sep 11 05:19:46 2005 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sun Sep 11 05:37:31 2005 +0000
@@ -705,9 +705,11 @@
 	// Check for the Doodle IMV
 	if( !strcmp( imv, "doodle;11" ) )
 	{
+		GaimWhiteboard *wb;
+
 		g_print( "'doodle;11' found in chat packet\n" );
 		
-		GaimWhiteboard *wb = gaim_whiteboard_get_session( gc->account, im->from );
+		wb = gaim_whiteboard_get_session( gc->account, im->from );
 		
 		// If a Doodle session doesn't exist between this user
 		if( wb == NULL )
@@ -2982,6 +2984,7 @@
 	char *msg = yahoo_html_to_codes(what);
 	char *msg2;
 	gboolean utf8 = TRUE;
+	GaimWhiteboard *wb;
 	int ret = 1;
 
 	msg2 = yahoo_string_encode(gc, msg, &utf8);
@@ -2993,7 +2996,7 @@
 
 	// If this message is to a user who is also Doodling with the local user,
 	// format the chat packet with the correct IMV information (thanks Yahoo!)
-	GaimWhiteboard *wb = gaim_whiteboard_get_session(gc->account, (char*)who);
+	wb = gaim_whiteboard_get_session(gc->account, (char*)who);
 	if (wb)
 		yahoo_packet_hash_str(pkt,   63, "doodle;11");
 	else
--- a/src/whiteboard.c	Sun Sep 11 05:19:46 2005 +0000
+++ b/src/whiteboard.c	Sun Sep 11 05:37:31 2005 +0000
@@ -59,13 +59,14 @@
 {
 	//g_print( "gaim_whiteboard_create()\n" );
 	
+	GaimPluginProtocolInfo *prpl_info;
 	GaimWhiteboard *wb	= g_new0( GaimWhiteboard, 1 );
-	
+
 	wb->account		= account;
 	wb->state		= state;
 	wb->who			= g_strdup( who );
 	
-	GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO( account->gc->prpl );
+	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO( account->gc->prpl );
 	gaim_whiteboard_set_prpl_ops( wb, prpl_info->whiteboard_prpl_ops );
 	
 	// Start up protocol specifics