Commit dc6e4b78 authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod

Fix warnings.

2008-12-25  Behdad Esfahbod  <behdad@gnome.org>

        * src/interpret.c (main):
        * src/slowcat.c (catfile):
        * src/table.c (_vte_table_addi), (_vte_table_add):
        * src/trie.c (_vte_trie_matchx):
        * src/vte.c (_vte_invalidate_cell), (_vte_terminal_insert_char):
        * src/vteaccess.c (offset_from_xy),
        (vte_terminal_accessible_finalize),
        (vte_terminal_accessible_get_text),
        (vte_terminal_accessible_get_text_somewhere):
        * src/vteapp.c (main):
        * src/vtebg.c (vte_bg_cache_item_free), (vte_bg_cache_add):
        Fix warnings.


svn path=/trunk/; revision=2354
parent 0cdef517
2008-12-25 Behdad Esfahbod <behdad@gnome.org>
* src/interpret.c (main):
* src/slowcat.c (catfile):
* src/table.c (_vte_table_addi), (_vte_table_add):
* src/trie.c (_vte_trie_matchx):
* src/vte.c (_vte_invalidate_cell), (_vte_terminal_insert_char):
* src/vteaccess.c (offset_from_xy),
(vte_terminal_accessible_finalize),
(vte_terminal_accessible_get_text),
(vte_terminal_accessible_get_text_somewhere):
* src/vteapp.c (main):
* src/vtebg.c (vte_bg_cache_item_free), (vte_bg_cache_add):
Fix warnings.
2008-12-25 Behdad Esfahbod <behdad@gnome.org> 2008-12-25 Behdad Esfahbod <behdad@gnome.org>
Bug 565663 compile failure because use static function in another .h Bug 565663 compile failure because use static function in another .h
......
...@@ -42,8 +42,9 @@ main(int argc, char **argv) ...@@ -42,8 +42,9 @@ main(int argc, char **argv)
struct _vte_termcap *termcap = NULL; struct _vte_termcap *termcap = NULL;
struct _vte_buffer *buffer = NULL; struct _vte_buffer *buffer = NULL;
GArray *array; GArray *array;
int i, j, l; unsigned int i, j;
char c; int l;
char b;
GValue *value; GValue *value;
FILE *infile = NULL; FILE *infile = NULL;
struct _vte_iso2022_state *subst; struct _vte_iso2022_state *subst;
...@@ -83,8 +84,8 @@ main(int argc, char **argv) ...@@ -83,8 +84,8 @@ main(int argc, char **argv)
subst = _vte_iso2022_state_new(NULL, NULL, NULL); subst = _vte_iso2022_state_new(NULL, NULL, NULL);
while (fread(&c, 1, 1, infile) == 1) { while (fread(&b, 1, 1, infile) == 1) {
_vte_buffer_append(buffer, &c, 1); _vte_buffer_append(buffer, &b, 1);
} }
_vte_iso2022_process(subst, buffer->bytes, _vte_iso2022_process(subst, buffer->bytes,
_vte_buffer_length(buffer), array); _vte_buffer_length(buffer), array);
......
...@@ -62,7 +62,8 @@ catfile(const char *pathname, long delay, long chunksize) ...@@ -62,7 +62,8 @@ catfile(const char *pathname, long delay, long chunksize)
} }
} }
if (i > 0) { if (i > 0) {
write(STDOUT_FILENO, buf, i); int bytes;
bytes = write(STDOUT_FILENO, buf, i);
fsync(STDOUT_FILENO); fsync(STDOUT_FILENO);
} }
} }
......
...@@ -201,7 +201,7 @@ _vte_table_addi(struct _vte_table *table, ...@@ -201,7 +201,7 @@ _vte_table_addi(struct _vte_table *table,
struct _vte_table *subtable; struct _vte_table *subtable;
if (original_length == -1) { if (original_length == -1) {
original_length = strlen(original); original_length = strlen((char *) original);
} }
if (length == -1) { if (length == -1) {
length = strlen(pattern); length = strlen(pattern);
...@@ -269,9 +269,9 @@ _vte_table_addi(struct _vte_table *table, ...@@ -269,9 +269,9 @@ _vte_table_addi(struct _vte_table *table,
b = g_byte_array_new(); b = g_byte_array_new();
g_byte_array_set_size(b, 0); g_byte_array_set_size(b, 0);
g_byte_array_append(b, original, initial); g_byte_array_append(b, original, initial);
g_byte_array_append(b, pattern + 2, length - 2); g_byte_array_append(b, (const guint8*)pattern + 2, length - 2);
_vte_table_addi(table, b->data, b->len, _vte_table_addi(table, b->data, b->len,
b->data + initial, (const char *)b->data + initial,
b->len - initial, b->len - initial,
result, quark, inc); result, quark, inc);
g_byte_array_free(b, TRUE); g_byte_array_free(b, TRUE);
...@@ -401,7 +401,8 @@ _vte_table_add(struct _vte_table *table, ...@@ -401,7 +401,8 @@ _vte_table_add(struct _vte_table *table,
const char *pattern, gssize length, const char *pattern, gssize length,
const char *result, GQuark quark) const char *result, GQuark quark)
{ {
_vte_table_addi(table, pattern, length, _vte_table_addi(table,
(const unsigned char *) pattern, length,
pattern, length, pattern, length,
result, quark, 0); result, quark, 0);
} }
......
...@@ -573,7 +573,7 @@ _vte_trie_matchx(struct _vte_trie *trie, const gunichar *pattern, gsize length, ...@@ -573,7 +573,7 @@ _vte_trie_matchx(struct _vte_trie *trie, const gunichar *pattern, gsize length,
/* Move past characters which might match this /* Move past characters which might match this
* part of the string... */ * part of the string... */
while (cclass->multiple && while (cclass->multiple &&
((prospect - pattern) < length) && ((gsize)(prospect - pattern) < length) &&
cclass->check(prospect[0], data)) { cclass->check(prospect[0], data)) {
prospect++; prospect++;
} }
......
...@@ -706,7 +706,7 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row) ...@@ -706,7 +706,7 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row)
VteRowData *row_data; VteRowData *row_data;
int columns; int columns;
if (!GTK_WIDGET_DRAWABLE(terminal) || terminal->pvt->invalidated_all) { if (G_UNLIKELY (!GTK_WIDGET_DRAWABLE(terminal) || terminal->pvt->invalidated_all)) {
return; return;
} }
...@@ -3131,11 +3131,11 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c, ...@@ -3131,11 +3131,11 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
row_num = screen->cursor_current.row; row_num = screen->cursor_current.row;
row = NULL; row = NULL;
if (col == 0) { if (G_UNLIKELY (col == 0)) {
/* We are at first column. See if the previous line softwrapped. /* We are at first column. See if the previous line softwrapped.
* If it did, move there. Otherwise skip inserting. */ * If it did, move there. Otherwise skip inserting. */
if (row_num > 0) { if (G_LIKELY (row_num > 0)) {
row_num--; row_num--;
row = _vte_terminal_find_row_data (terminal, row_num); row = _vte_terminal_find_row_data (terminal, row_num);
......
...@@ -125,11 +125,11 @@ offset_from_xy (VteTerminalAccessiblePrivate *priv, ...@@ -125,11 +125,11 @@ offset_from_xy (VteTerminalAccessiblePrivate *priv,
gint linebreak; gint linebreak;
gint next_linebreak; gint next_linebreak;
if (y >= priv->snapshot_linebreaks->len) if (y >= (gint) priv->snapshot_linebreaks->len)
y = priv->snapshot_linebreaks->len -1; y = priv->snapshot_linebreaks->len -1;
linebreak = g_array_index (priv->snapshot_linebreaks, int, y); linebreak = g_array_index (priv->snapshot_linebreaks, int, y);
if (y +1 == priv->snapshot_linebreaks->len) if (y + 1 == (gint) priv->snapshot_linebreaks->len)
next_linebreak = priv->snapshot_characters->len; next_linebreak = priv->snapshot_characters->len;
else else
next_linebreak = g_array_index (priv->snapshot_linebreaks, int, y + 1); next_linebreak = g_array_index (priv->snapshot_linebreaks, int, y + 1);
...@@ -871,7 +871,7 @@ vte_terminal_accessible_finalize(GObject *object) ...@@ -871,7 +871,7 @@ vte_terminal_accessible_finalize(GObject *object)
if (accessible->widget != NULL) { if (accessible->widget != NULL) {
g_object_remove_weak_pointer(G_OBJECT(accessible->widget), g_object_remove_weak_pointer(G_OBJECT(accessible->widget),
(gpointer*) &accessible->widget); (gpointer*)(gpointer)&accessible->widget);
g_signal_handlers_disconnect_matched(accessible->widget, g_signal_handlers_disconnect_matched(accessible->widget,
G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_FUNC |
G_SIGNAL_MATCH_DATA, G_SIGNAL_MATCH_DATA,
...@@ -958,13 +958,13 @@ vte_terminal_accessible_get_text(AtkText *text, ...@@ -958,13 +958,13 @@ vte_terminal_accessible_get_text(AtkText *text,
/* If the requested area is after all of the text, just return an /* If the requested area is after all of the text, just return an
* empty string. */ * empty string. */
if (start_offset >= priv->snapshot_characters->len) { if (start_offset >= (int) priv->snapshot_characters->len) {
return g_strdup(""); return g_strdup("");
} }
/* Map the offsets to, er, offsets. */ /* Map the offsets to, er, offsets. */
start = g_array_index(priv->snapshot_characters, int, start_offset); start = g_array_index(priv->snapshot_characters, int, start_offset);
if ((end_offset == -1) || (end_offset >= priv->snapshot_characters->len) ) { if ((end_offset == -1) || (end_offset >= (int) priv->snapshot_characters->len) ) {
/* Get everything up to the end of the buffer. */ /* Get everything up to the end of the buffer. */
end = priv->snapshot_text->len; end = priv->snapshot_text->len;
} else { } else {
...@@ -1019,7 +1019,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1019,7 +1019,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
offset, priv->snapshot_attributes->len); offset, priv->snapshot_attributes->len);
g_assert(priv->snapshot_text != NULL); g_assert(priv->snapshot_text != NULL);
g_assert(priv->snapshot_characters != NULL); g_assert(priv->snapshot_characters != NULL);
if (offset == priv->snapshot_characters->len) { if (offset == (int) priv->snapshot_characters->len) {
return g_strdup(""); return g_strdup("");
} }
g_assert(offset < priv->snapshot_characters->len); g_assert(offset < priv->snapshot_characters->len);
...@@ -1031,7 +1031,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1031,7 +1031,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
* position, the one before it, or the one after it. */ * position, the one before it, or the one after it. */
offset += direction; offset += direction;
start = MAX(offset, 0); start = MAX(offset, 0);
end = MIN(offset + 1, priv->snapshot_attributes->len); end = MIN(offset + 1, (int) priv->snapshot_attributes->len);
break; break;
case ATK_TEXT_BOUNDARY_WORD_START: case ATK_TEXT_BOUNDARY_WORD_START:
/* Back up to the previous non-word-word transition. */ /* Back up to the previous non-word-word transition. */
...@@ -1072,7 +1072,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1072,7 +1072,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
* non-word character, then the next word character * non-word character, then the next word character
* after that. */ * after that. */
if (direction == direction_next) { if (direction == direction_next) {
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset); next = vte_terminal_accessible_get_character_at_offset(text, offset);
if (vte_terminal_is_word_char(terminal, next)) { if (vte_terminal_is_word_char(terminal, next)) {
offset++; offset++;
...@@ -1080,7 +1080,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1080,7 +1080,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
break; break;
} }
} }
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset); next = vte_terminal_accessible_get_character_at_offset(text, offset);
if (!vte_terminal_is_word_char(terminal, next)) { if (!vte_terminal_is_word_char(terminal, next)) {
offset++; offset++;
...@@ -1091,7 +1091,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1091,7 +1091,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
start = offset; start = offset;
} }
/* Now find the end of this word. */ /* Now find the end of this word. */
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset); current = vte_terminal_accessible_get_character_at_offset(text, offset);
if (vte_terminal_is_word_char(terminal, current)) { if (vte_terminal_is_word_char(terminal, current)) {
offset++; offset++;
...@@ -1101,7 +1101,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1101,7 +1101,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
} }
/* Now find the next non-word-word transition */ /* Now find the next non-word-word transition */
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset); next = vte_terminal_accessible_get_character_at_offset(text, offset);
if (!vte_terminal_is_word_char(terminal, next)) { if (!vte_terminal_is_word_char(terminal, next)) {
offset++; offset++;
...@@ -1156,7 +1156,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1156,7 +1156,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
* word character, then the next non-word character * word character, then the next non-word character
* after that. */ * after that. */
if (direction == direction_next) { if (direction == direction_next) {
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset); current = vte_terminal_accessible_get_character_at_offset(text, offset);
if (!vte_terminal_is_word_char(terminal, current)) { if (!vte_terminal_is_word_char(terminal, current)) {
offset++; offset++;
...@@ -1164,7 +1164,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1164,7 +1164,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
break; break;
} }
} }
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset); current = vte_terminal_accessible_get_character_at_offset(text, offset);
if (vte_terminal_is_word_char(terminal, current)) { if (vte_terminal_is_word_char(terminal, current)) {
offset++; offset++;
...@@ -1175,7 +1175,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1175,7 +1175,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
start = offset; start = offset;
} }
/* Now find the next word end. */ /* Now find the next word end. */
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset); current = vte_terminal_accessible_get_character_at_offset(text, offset);
if (!vte_terminal_is_word_char(terminal, current)) { if (!vte_terminal_is_word_char(terminal, current)) {
offset++; offset++;
...@@ -1183,7 +1183,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text, ...@@ -1183,7 +1183,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
break; break;
} }
} }
while (offset < priv->snapshot_characters->len) { while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset); current = vte_terminal_accessible_get_character_at_offset(text, offset);
if (vte_terminal_is_word_char(terminal, current)) { if (vte_terminal_is_word_char(terminal, current)) {
offset++; offset++;
......
...@@ -446,7 +446,7 @@ main(int argc, char **argv) ...@@ -446,7 +446,7 @@ main(int argc, char **argv)
{ {
GdkScreen *screen; GdkScreen *screen;
GdkColormap *colormap; GdkColormap *colormap;
GtkWidget *window, *widget,*hbox, *scrollbar, *scrolled_window; GtkWidget *window, *widget,*hbox = NULL, *scrollbar, *scrolled_window = NULL;
VteTerminal *terminal; VteTerminal *terminal;
char *env_add[] = { char *env_add[] = {
#ifdef VTE_DEBUG #ifdef VTE_DEBUG
...@@ -789,13 +789,17 @@ main(int argc, char **argv) ...@@ -789,13 +789,17 @@ main(int argc, char **argv)
antialias ? VTE_ANTI_ALIAS_USE_DEFAULT : VTE_ANTI_ALIAS_FORCE_DISABLE); antialias ? VTE_ANTI_ALIAS_USE_DEFAULT : VTE_ANTI_ALIAS_FORCE_DISABLE);
/* Match "abcdefg". */ /* Match "abcdefg". */
vte_terminal_match_add(terminal, "abcdefg");
if (dingus) { if (dingus) {
int id; int id;
id = vte_terminal_match_add(terminal, DINGUS1); GRegex *regex;
regex = g_regex_new (DINGUS1, 0, 0, NULL);
id = vte_terminal_match_add_gregex(terminal, regex, 0);
g_regex_unref (regex);
vte_terminal_match_set_cursor_type(terminal, vte_terminal_match_set_cursor_type(terminal,
id, GDK_GUMBY); id, GDK_GUMBY);
id = vte_terminal_match_add(terminal, DINGUS2); regex = g_regex_new (DINGUS2, 0, 0, NULL);
id = vte_terminal_match_add_gregex(terminal, regex, 0);
g_regex_unref (regex);
vte_terminal_match_set_cursor_type(terminal, vte_terminal_match_set_cursor_type(terminal,
id, GDK_HAND1); id, GDK_HAND1);
} }
......
...@@ -343,16 +343,16 @@ vte_bg_cache_item_free(struct VteBgCacheItem *item) ...@@ -343,16 +343,16 @@ vte_bg_cache_item_free(struct VteBgCacheItem *item)
/* Clean up whatever is left in the structure. */ /* Clean up whatever is left in the structure. */
if (item->source_pixbuf != NULL) { if (item->source_pixbuf != NULL) {
g_object_remove_weak_pointer(G_OBJECT(item->source_pixbuf), g_object_remove_weak_pointer(G_OBJECT(item->source_pixbuf),
(gpointer*)&item->source_pixbuf); (gpointer*)(void*)&item->source_pixbuf);
} }
g_free(item->source_file); g_free(item->source_file);
if (item->pixmap != NULL) { if (item->pixmap != NULL) {
g_object_remove_weak_pointer(G_OBJECT(item->pixmap), g_object_remove_weak_pointer(G_OBJECT(item->pixmap),
(gpointer*)&item->pixmap); (gpointer*)(void*)&item->pixmap);
} }
if (item->pixbuf != NULL) { if (item->pixbuf != NULL) {
g_object_remove_weak_pointer(G_OBJECT(item->pixbuf), g_object_remove_weak_pointer(G_OBJECT(item->pixbuf),
(gpointer*)&item->pixbuf); (gpointer*)(void*)&item->pixbuf);
} }
g_slice_free(struct VteBgCacheItem, item); g_slice_free(struct VteBgCacheItem, item);
...@@ -441,15 +441,15 @@ vte_bg_cache_add(VteBg *bg, struct VteBgCacheItem *item) ...@@ -441,15 +441,15 @@ vte_bg_cache_add(VteBg *bg, struct VteBgCacheItem *item)
bg->pvt->cache = g_list_prepend(bg->pvt->cache, item); bg->pvt->cache = g_list_prepend(bg->pvt->cache, item);
if (item->source_pixbuf != NULL) { if (item->source_pixbuf != NULL) {
g_object_add_weak_pointer(G_OBJECT(item->source_pixbuf), g_object_add_weak_pointer(G_OBJECT(item->source_pixbuf),
(gpointer*)&item->source_pixbuf); (gpointer*)(void*)&item->source_pixbuf);
} }
if (item->pixbuf != NULL) { if (item->pixbuf != NULL) {
g_object_add_weak_pointer(G_OBJECT(item->pixbuf), g_object_add_weak_pointer(G_OBJECT(item->pixbuf),
(gpointer*)&item->pixbuf); (gpointer*)(void*)&item->pixbuf);
} }
if (item->pixmap != NULL) { if (item->pixmap != NULL) {
g_object_add_weak_pointer(G_OBJECT(item->pixmap), g_object_add_weak_pointer(G_OBJECT(item->pixmap),
(gpointer*)&item->pixmap); (gpointer*)(void*)&item->pixmap);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment