vte r2086 - in trunk: . src



Author: behdad
Date: Thu Aug 14 00:00:38 2008
New Revision: 2086
URL: http://svn.gnome.org/viewvc/vte?rev=2086&view=rev

Log:
2008-08-13  Behdad Esfahbod  <behdad gnome org>

        * src/vte-private.h:
        * src/vte.c (vte_terminal_match_check_internal_vte),
        (vte_terminal_ensure_cursor), (vte_terminal_set_colors),
        (_vte_terminal_insert_char), (vte_terminal_feed),
        (vte_terminal_key_press), (vte_terminal_match_hilite_update),
        (vte_terminal_extend_selection):
        * src/vteseq.c (vte_terminal_find_charcell),
        (vte_sequence_handler_set_title_internal),
        (vte_sequence_handler_decset_internal), (vte_sequence_handler_cb),
        (vte_sequence_handler_cd), (vte_sequence_handler_ce),
        (vte_sequence_handler_ec), (vte_sequence_handler_ta),
        (vte_sequence_handler_set_mode),
        (vte_sequence_handler_window_manipulation):
        Fix all "signed vs unsigned comparison" warnings.



Modified:
   trunk/ChangeLog
   trunk/src/vte-private.h
   trunk/src/vte.c
   trunk/src/vteseq.c

Modified: trunk/src/vte-private.h
==============================================================================
--- trunk/src/vte-private.h	(original)
+++ trunk/src/vte-private.h	Thu Aug 14 00:00:38 2008
@@ -213,9 +213,9 @@
 	struct _vte_iso2022_state *iso2022;
 	struct _vte_incoming_chunk{
 		struct _vte_incoming_chunk *next;
-		gint len;
+		guint len;
 		guchar data[VTE_INPUT_CHUNK_SIZE
-			- sizeof(struct _vte_incoming_chunk *) - sizeof(gint)];
+			- 2 * sizeof(void *)];
 	} *incoming;			/* pending bytestream */
 	GArray *pending;		/* pending characters */
 	GSList *update_regions;

Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c	(original)
+++ trunk/src/vte.c	Thu Aug 14 00:00:38 2008
@@ -1437,7 +1437,8 @@
                                       int *tag, int *start, int *end)
 {
 	struct _vte_regex_match matches[256];
-	gint i, j, k;
+	guint i, j;
+	gint k;
 	gint start_blank, end_blank;
 	int ret, offset;
 	struct vte_match_regex *regex = NULL;
@@ -1583,7 +1584,7 @@
 					_eattr = &g_array_index(terminal->pvt->match_attributes,
 							struct _VteCharAttributes,
 							matches[j].rm_eo + k - 1);
-					g_printerr("Match %d `%s' from %d(%ld,%ld) to %d(%ld,%ld) (%d).\n",
+					g_printerr("Match %u `%s' from %d(%ld,%ld) to %d(%ld,%ld) (%d).\n",
 							j, match,
 							matches[j].rm_so + k,
 							_sattr->column,
@@ -2351,7 +2352,7 @@
 	g_assert(row != NULL);
 
 	v = screen->cursor_current.col;
-	if (G_UNLIKELY (row->cells->len < v)) { /* pad */
+	if (G_UNLIKELY ((glong) row->cells->len < v)) { /* pad */
 		vte_g_array_fill (row->cells, &screen->basic_defaults, v);
 	}
 
@@ -2809,7 +2810,7 @@
 			}
 
 		/* Override from the supplied palette if there is one. */
-		if (i < palette_size) {
+		if ((glong) i < palette_size) {
 			color = palette[i];
 		}
 
@@ -2927,7 +2928,7 @@
 		g_array_insert_val(row->cells, col,
 				screen->color_defaults);
 	} else {
-		if (G_LIKELY (row->cells->len < col + columns)) {
+		if (G_LIKELY ((glong) row->cells->len < col + columns)) {
 			g_array_set_size (row->cells, col + columns);
 		}
 	}
@@ -2963,7 +2964,7 @@
 		g_array_index(row->cells, struct vte_charcell, col).attr = attr;
 		col++;
 	}
-	if (G_UNLIKELY (row->cells->len > terminal->column_count)) {
+	if (G_UNLIKELY ((long) row->cells->len > terminal->column_count)) {
 		g_array_set_size(row->cells, terminal->column_count);
 	}
 
@@ -4088,7 +4089,7 @@
 		}
 		do { /* break the incoming data into chunks */
 			gsize rem = sizeof (chunk->data) - chunk->len;
-			gsize len = length < rem ? length : rem;
+			gsize len = (gsize) length < rem ? (gsize) length : rem;
 			memcpy (chunk->data + chunk->len, data, len);
 			chunk->len += len;
 			length -= len;
@@ -4541,8 +4542,8 @@
 		 * margin, bell. */
 		if (terminal->pvt->margin_bell) {
 			if ((terminal->pvt->screen->cursor_current.col +
-			     terminal->pvt->bell_margin) ==
-			    terminal->column_count) {
+			     (glong) terminal->pvt->bell_margin) ==
+			     terminal->column_count) {
 				_vte_sequence_handler_bl(terminal,
 							 "bl",
 							 0,
@@ -5415,7 +5416,7 @@
 
 	/* Read the new locations. */
 	attr = NULL;
-	if (start < terminal->pvt->match_attributes->len) {
+	if ((guint) start < terminal->pvt->match_attributes->len) {
 		attr = &g_array_index(terminal->pvt->match_attributes,
 				struct _VteCharAttributes,
 				start);
@@ -5423,7 +5424,7 @@
 		terminal->pvt->match_start.column = attr->column;
 
 		attr = NULL;
-		if (end < terminal->pvt->match_attributes->len) {
+		if ((guint) end < terminal->pvt->match_attributes->len) {
 			attr = &g_array_index(terminal->pvt->match_attributes,
 					struct _VteCharAttributes,
 					end);
@@ -6031,8 +6032,7 @@
 {
 	VteScreen *screen;
 	VteRowData *rowdata;
-	long delta, height, width, j;
-	guint i;
+	long delta, height, width, i, j;
 	struct vte_charcell *cell;
 	struct selection_event_coords *origin, *last, *start, *end;
 	struct selection_cell_coords old_start, old_end, *sc, *ec, tc;
@@ -6189,8 +6189,8 @@
 			 * endpoint as far right as we can expect. */
 			if (ec->x >= i) {
 				ec->x = MAX(ec->x,
-						MAX(terminal->column_count - 1,
-							rowdata->cells->len));
+					    MAX(terminal->column_count - 1,
+						(long) rowdata->cells->len));
 			}
 		} else {
 			/* Snap to the rightmost column. */
@@ -6323,7 +6323,7 @@
 			rowdata = _vte_ring_index(screen->row_data,
 						  VteRowData *, ec->y);
 			if (rowdata != NULL) {
-				ec->x = MAX(ec->x, rowdata->cells->len);
+				ec->x = MAX(ec->x, (long) rowdata->cells->len);
 			}
 		}
 		break;

Modified: trunk/src/vteseq.c
==============================================================================
--- trunk/src/vteseq.c	(original)
+++ trunk/src/vteseq.c	Thu Aug 14 00:00:38 2008
@@ -76,7 +76,7 @@
 	screen = terminal->pvt->screen;
 	if (_vte_ring_contains(screen->row_data, row)) {
 		rowdata = _vte_ring_index(screen->row_data, VteRowData *, row);
-		if (rowdata->cells->len > col) {
+		if ((glong) rowdata->cells->len > col) {
 			ret = &g_array_index(rowdata->cells,
 					     struct vte_charcell,
 					     col);
@@ -392,7 +392,7 @@
 			outbuf = outbufptr = terminal->pvt->conv_buffer->bytes;
 			if (conv != VTE_INVALID_CONV) {
 				if (_vte_conv(conv, &inbuf, &inbuf_len,
-					      &outbuf, &outbuf_len) == -1) {
+					      &outbuf, &outbuf_len) == (size_t)-1) {
 					_vte_debug_print(VTE_DEBUG_IO,
 							"Error "
 							"converting %ld title "
@@ -526,7 +526,7 @@
 		 GINT_TO_POINTER(TRUE),
 		 NULL, NULL,},
 		/* 47: Alternate screen. */
-		{47, NULL, NULL, (gpointer*) &terminal->pvt->screen,
+		{47, NULL, NULL, (gpointer) &terminal->pvt->screen,
 		 &terminal->pvt->normal_screen,
 		 &terminal->pvt->alternate_screen,
 		 NULL, NULL,},
@@ -571,7 +571,7 @@
 		/* 1037: disallowed, delete key policy is set by user. */
 		{1037, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
 		/* 1047: Use alternate screen buffer. */
-		{1047, NULL, NULL, (gpointer*) &terminal->pvt->screen,
+		{1047, NULL, NULL, (gpointer) &terminal->pvt->screen,
 		 &terminal->pvt->normal_screen,
 		 &terminal->pvt->alternate_screen,
 		 NULL, NULL,},
@@ -583,28 +583,28 @@
 		 vte_sequence_handler_sc,},
 		/* 1049: Use alternate screen buffer, saving the cursor
 		 * position. */
-		{1049, NULL, NULL, (gpointer*) &terminal->pvt->screen,
+		{1049, NULL, NULL, (gpointer) &terminal->pvt->screen,
 		 &terminal->pvt->normal_screen,
 		 &terminal->pvt->alternate_screen,
 		 vte_sequence_handler_rc,
 		 vte_sequence_handler_sc,},
 		/* 1051: Sun function key mode. */
-		{1051, NULL, NULL, (gpointer*) &terminal->pvt->sun_fkey_mode,
+		{1051, NULL, NULL, (gpointer) &terminal->pvt->sun_fkey_mode,
 		 GINT_TO_POINTER(FALSE),
 		 GINT_TO_POINTER(TRUE),
 		 NULL, NULL},
 		/* 1052: HP function key mode. */
-		{1052, NULL, NULL, (gpointer*) &terminal->pvt->hp_fkey_mode,
+		{1052, NULL, NULL, (gpointer) &terminal->pvt->hp_fkey_mode,
 		 GINT_TO_POINTER(FALSE),
 		 GINT_TO_POINTER(TRUE),
 		 NULL, NULL},
 		/* 1060: Legacy function key mode. */
-		{1060, NULL, NULL, (gpointer*) &terminal->pvt->legacy_fkey_mode,
+		{1060, NULL, NULL, (gpointer) &terminal->pvt->legacy_fkey_mode,
 		 GINT_TO_POINTER(FALSE),
 		 GINT_TO_POINTER(TRUE),
 		 NULL, NULL},
 		/* 1061: VT220 function key mode. */
-		{1061, NULL, NULL, (gpointer*) &terminal->pvt->vt220_fkey_mode,
+		{1061, NULL, NULL, (gpointer) &terminal->pvt->vt220_fkey_mode,
 		 GINT_TO_POINTER(FALSE),
 		 GINT_TO_POINTER(TRUE),
 		 NULL, NULL},
@@ -1028,7 +1028,7 @@
 	 * attributes.  If there is no such character cell, we need
 	 * to add one. */
 	for (i = 0; i <= screen->cursor_current.col; i++) {
-		if (i < rowdata->cells->len) {
+		if (i < (glong) rowdata->cells->len) {
 			/* Muck with the cell in this location. */
 			pcell = &g_array_index(rowdata->cells,
 					       struct vte_charcell,
@@ -1058,7 +1058,7 @@
 			GValueArray *params)
 {
 	VteRowData *rowdata;
-	long i;
+	glong i;
 	VteScreen *screen;
 
 	screen = terminal->pvt->screen;
@@ -1070,7 +1070,7 @@
 		rowdata = _vte_ring_index(screen->row_data, VteRowData *, i);
 		/* Clear everything to the right of the cursor. */
 		if ((rowdata != NULL) &&
-		    (rowdata->cells->len > screen->cursor_current.col)) {
+		    ((glong) rowdata->cells->len > screen->cursor_current.col)) {
 			g_array_set_size(rowdata->cells,
 					 screen->cursor_current.col);
 		}
@@ -1138,7 +1138,7 @@
 	g_assert(rowdata != NULL);
 	/* Remove the data at the end of the array until the current column
 	 * is the end of the array. */
-	if (rowdata->cells->len > screen->cursor_current.col) {
+	if ((glong) rowdata->cells->len > screen->cursor_current.col) {
 		g_array_set_size(rowdata->cells, screen->cursor_current.col);
 		/* We've modified the display.  Make a note of it. */
 		terminal->pvt->text_deleted_flag = TRUE;
@@ -1660,7 +1660,7 @@
 		for (i = 0; i < count; i++) {
 			col = screen->cursor_current.col + i;
 			if (col >= 0) {
-				if (col < rowdata->cells->len) {
+				if (col < (glong) rowdata->cells->len) {
 					/* Replace this cell with the current
 					 * defaults. */
 					cell = &g_array_index(rowdata->cells,
@@ -2419,6 +2419,8 @@
 	screen = terminal->pvt->screen;
 	newcol = col = screen->cursor_current.col;
 
+	g_assert (col >= 0);
+
 	if (terminal->pvt->tabstops != NULL) {
 		/* Find the next tabstop. */
 		for (newcol++; newcol < VTE_TAB_MAX; newcol++) {
@@ -2450,21 +2452,20 @@
 		 */
 
 		/* Get rid of trailing empty cells: bug 545924 */
-		if (rowdata->cells->len > col)
+		if ((glong) rowdata->cells->len > col)
 		{
-			struct vte_charcell *pcell;
-			int i;
-			i = rowdata->cells->len;
-			pcell = &g_array_index(rowdata->cells, struct vte_charcell, i - 1);
-			while ((i > col) && !pcell->attr.fragment && pcell->c == 0)
-			{
-				i--;
-				pcell = &g_array_index(rowdata->cells, struct vte_charcell, i - 1);
+			struct vte_charcell *cell;
+			guint i;
+			for (i = rowdata->cells->len; (glong) i > col; i--) {
+				cell = &g_array_index(rowdata->cells,
+						      struct vte_charcell, i - 1);
+				if (cell->attr.fragment || cell->c != 0)
+					break;
 			}
 			g_array_set_size(rowdata->cells, i);
 		}
 
-		if (rowdata->cells->len <= col)
+		if ((glong) rowdata->cells->len <= col)
 		  {
 		    struct vte_charcell cell;
 
@@ -3183,7 +3184,7 @@
 			      GQuark match_quark,
 			      GValueArray *params)
 {
-	int i, again;
+	guint i, again;
 	long setting;
 	GValue *value;
 	if ((params == NULL) || (params->n_values == 0)) {
@@ -3786,8 +3787,8 @@
 	GtkWidget *widget;
 	char buf[LINE_MAX];
 	long param, arg1, arg2;
-	guint width, height, i;
-	gint len;
+	gint width, height, len;
+	guint i;
 
 	widget = &terminal->widget;
 	screen = terminal->pvt->screen;



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