[vte] all: Rename VteBuffer to VteByteArray



commit 339c939671b7b6c1bbe68a4279048a28f2356292
Author: Christian Persch <chpe gnome org>
Date:   Tue Jun 7 19:03:13 2011 +0200

    all: Rename VteBuffer to VteByteArray
    
    ... because I want to use "VteBuffer" for something else.
    
    Conflicts:
        src/iso2022.c

 src/buffer.h      |   18 +++++++++---------
 src/iso2022.c     |   22 +++++++++++-----------
 src/vte-private.h |    4 ++--
 src/vte.c         |   34 +++++++++++++++++-----------------
 src/vteconv.c     |   14 +++++++-------
 src/vteseq.c      |    4 ++--
 6 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/src/buffer.h b/src/buffer.h
index 3b642c0..4f4cf31 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -26,15 +26,15 @@
 
 G_BEGIN_DECLS
 
-typedef GByteArray VteBuffer;
-
-#define _vte_buffer_new                                g_byte_array_new
-#define _vte_buffer_free(B)                    g_byte_array_free (B, TRUE)
-#define _vte_buffer_append(B, data, length)    g_byte_array_append (B, (const guint8 *) (data), length)
-#define _vte_buffer_length(B)                  ((B)->len)
-#define _vte_buffer_consume(B, length)         g_byte_array_remove_range (B, 0, length)
-#define _vte_buffer_clear(B)                   g_byte_array_set_size (B, 0)
-#define _vte_buffer_set_minimum_size(B, length)        g_byte_array_set_size (B, (guint) MAX ((gint) 
(length), (gint) (B)->len))
+typedef GByteArray VteByteArray;
+
+#define _vte_byte_array_new                            g_byte_array_new
+#define _vte_byte_array_free(B)                        g_byte_array_free (B, TRUE)
+#define _vte_byte_array_append(B, data, length)        g_byte_array_append (B, (const guint8 *) (data), 
length)
+#define _vte_byte_array_length(B)                      ((B)->len)
+#define _vte_byte_array_consume(B, length)             g_byte_array_remove_range (B, 0, length)
+#define _vte_byte_array_clear(B)                       g_byte_array_set_size (B, 0)
+#define _vte_byte_array_set_minimum_size(B, length)    g_byte_array_set_size (B, (guint) MAX ((gint) 
(length), (gint) (B)->len))
 
 G_END_DECLS
 
diff --git a/src/iso2022.c b/src/iso2022.c
index 30a9548..f493496 100644
--- a/src/iso2022.c
+++ b/src/iso2022.c
@@ -77,7 +77,7 @@ struct _vte_iso2022_state {
        VteConv conv;
        _vte_iso2022_codeset_changed_cb_fn codeset_changed;
        gpointer codeset_changed_data;
-       VteBuffer *buffer;
+       VteByteArray *buffer;
 };
 
 /* DEC Special Character and Line Drawing Set.  VT100 and higher (per XTerm
@@ -786,7 +786,7 @@ _vte_iso2022_state_new(const char *native_codeset,
        state->conv = _vte_conv_open(state->target_codeset, state->codeset);
        state->codeset_changed = fn;
        state->codeset_changed_data = data;
-       state->buffer = _vte_buffer_new();
+       state->buffer = _vte_byte_array_new();
        if (state->conv == VTE_INVALID_CONV) {
                g_warning(_("Unable to convert characters from %s to %s."),
                          state->codeset, state->target_codeset);
@@ -807,7 +807,7 @@ _vte_iso2022_state_new(const char *native_codeset,
 void
 _vte_iso2022_state_free(struct _vte_iso2022_state *state)
 {
-       _vte_buffer_free(state->buffer);
+       _vte_byte_array_free(state->buffer);
        if (state->conv != VTE_INVALID_CONV) {
                _vte_conv_close(state->conv);
        }
@@ -1190,7 +1190,7 @@ process_cdata(struct _vte_iso2022_state *state, const guchar *cdata, gsize lengt
        if (!state->nrc_enabled || (state->g[current] == 'B')) {
                inbuf = cdata;
                inbytes = length;
-               _vte_buffer_set_minimum_size(state->buffer,
+               _vte_byte_array_set_minimum_size(state->buffer,
                                             sizeof(gunichar) * length * 2);
                buf = (gunichar *)state->buffer->data;
                outbuf = buf;
@@ -1785,7 +1785,7 @@ _vte_iso2022_process(struct _vte_iso2022_state *state,
 int
 main(int argc, char **argv)
 {
-       VteBuffer *buffer;
+       VteByteArray *buffer;
        struct _vte_iso2022_state *state;
        GString *string;
        GArray *gunichars;
@@ -1813,7 +1813,7 @@ main(int argc, char **argv)
        guchar b;
 
        state = _vte_iso2022_state_new(NULL, VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH, NULL, NULL);
-       buffer = _vte_buffer_new();
+       buffer = _vte_byte_array_new();
        gunichars = g_array_new(FALSE, FALSE, sizeof(gunichar));
        if (argc > 1) {
                string = g_string_new(NULL);
@@ -1830,20 +1830,20 @@ main(int argc, char **argv)
                                fclose(fp);
                        }
                }
-               _vte_buffer_append(buffer, string->str, string->len);
-               _vte_iso2022_process(state, buffer->data, _vte_buffer_length (buffer), gunichars);
+               _vte_byte_array_append(buffer, string->str, string->len);
+               _vte_iso2022_process(state, buffer->data, _vte_byte_array_length (buffer), gunichars);
                g_string_free(string, TRUE);
        } else {
                for (i = 0; i < G_N_ELEMENTS(strings); i++) {
                        string = g_string_new(strings[i].s);
-                       _vte_buffer_append(buffer, string->str, string->len);
+                       _vte_byte_array_append(buffer, string->str, string->len);
                        g_string_free(string, TRUE);
                        if (strings[i].process) {
-                               _vte_iso2022_process(state, buffer->data, _vte_buffer_length (buffer), 
gunichars);
+                               _vte_iso2022_process(state, buffer->data, _vte_byte_array_length (buffer), 
gunichars);
                        }
                }
        }
-       _vte_buffer_free(buffer);
+       _vte_byte_array_free(buffer);
        _vte_iso2022_state_free(state);
 
        string = g_string_new(NULL);
diff --git a/src/vte-private.h b/src/vte-private.h
index 831c53a..3a67155 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -225,11 +225,11 @@ struct _VteTerminalPrivate {
        glong max_input_bytes;
 
        /* Output data queue. */
-       VteBuffer *outgoing;    /* pending input characters */
+       VteByteArray *outgoing; /* pending input characters */
        VteConv outgoing_conv;
 
        /* IConv buffer. */
-       VteBuffer *conv_buffer;
+       VteByteArray *conv_buffer;
 
        /* Screen data.  We support the normal screen, and an alternate
         * screen, which seems to be a DEC-specific feature. */
diff --git a/src/vte.c b/src/vte.c
index c7200c6..787e31f 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -1987,11 +1987,11 @@ vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset)
        terminal->pvt->encoding = g_intern_string(codeset);
 
        /* Convert any buffered output bytes. */
-       if ((_vte_buffer_length(terminal->pvt->outgoing) > 0) &&
+       if ((_vte_byte_array_length(terminal->pvt->outgoing) > 0) &&
            (old_codeset != NULL)) {
                /* Convert back to UTF-8. */
                obuf1 = g_convert((gchar *)terminal->pvt->outgoing->data,
-                                 _vte_buffer_length(terminal->pvt->outgoing),
+                                 _vte_byte_array_length(terminal->pvt->outgoing),
                                  "UTF-8",
                                  old_codeset,
                                  NULL,
@@ -2007,8 +2007,8 @@ vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset)
                                          &bytes_written,
                                          NULL);
                        if (obuf2 != NULL) {
-                               _vte_buffer_clear(terminal->pvt->outgoing);
-                               _vte_buffer_append(terminal->pvt->outgoing,
+                               _vte_byte_array_clear(terminal->pvt->outgoing);
+                               _vte_byte_array_append(terminal->pvt->outgoing,
                                                   obuf2, bytes_written);
                                g_free(obuf2);
                        }
@@ -4289,7 +4289,7 @@ vte_terminal_io_write(GIOChannel *channel,
        fd = g_io_channel_unix_get_fd(channel);
 
        count = write(fd, terminal->pvt->outgoing->data,
-                     _vte_buffer_length(terminal->pvt->outgoing));
+                     _vte_byte_array_length(terminal->pvt->outgoing));
        if (count != -1) {
                _VTE_DEBUG_IF (VTE_DEBUG_IO) {
                        gssize i;
@@ -4302,10 +4302,10 @@ vte_terminal_io_write(GIOChannel *channel,
                                        ((guint8)terminal->pvt->outgoing->data[i])  + 64);
                        }
                }
-               _vte_buffer_consume(terminal->pvt->outgoing, count);
+               _vte_byte_array_consume(terminal->pvt->outgoing, count);
        }
 
-       if (_vte_buffer_length(terminal->pvt->outgoing) == 0) {
+       if (_vte_byte_array_length(terminal->pvt->outgoing) == 0) {
                leave_open = FALSE;
        } else {
                leave_open = TRUE;
@@ -4342,7 +4342,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
        icount = length;
        ibuf =  data;
        ocount = ((length + 1) * VTE_UTF8_BPC) + 1;
-       _vte_buffer_set_minimum_size(terminal->pvt->conv_buffer, ocount);
+       _vte_byte_array_set_minimum_size(terminal->pvt->conv_buffer, ocount);
        obuf = obufptr = terminal->pvt->conv_buffer->data;
 
        if (_vte_conv(conv, &ibuf, &icount, &obuf, &ocount) == (gsize)-1) {
@@ -4404,7 +4404,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
                /* If there's a place for it to go, add the data to the
                 * outgoing buffer. */
                if ((cooked_length > 0) && (terminal->pvt->pty != NULL)) {
-                       _vte_buffer_append(terminal->pvt->outgoing,
+                       _vte_byte_array_append(terminal->pvt->outgoing,
                                           cooked, cooked_length);
                        _VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) {
                                for (i = 0; i < cooked_length; i++) {
@@ -4478,7 +4478,7 @@ vte_terminal_feed_child_binary(VteTerminal *terminal, const char *data, glong le
                /* If there's a place for it to go, add the data to the
                 * outgoing buffer. */
                if (terminal->pvt->pty != NULL) {
-                       _vte_buffer_append(terminal->pvt->outgoing,
+                       _vte_byte_array_append(terminal->pvt->outgoing,
                                           data, length);
                        /* If we need to start waiting for the child pty to
                         * become available for writing, set that up here. */
@@ -8194,9 +8194,9 @@ vte_terminal_init(VteTerminal *terminal)
        pvt->pending = g_array_new(FALSE, TRUE, sizeof(gunichar));
        pvt->max_input_bytes = VTE_MAX_INPUT_READ;
        pvt->cursor_blink_tag = 0;
-       pvt->outgoing = _vte_buffer_new();
+       pvt->outgoing = _vte_byte_array_new();
        pvt->outgoing_conv = VTE_INVALID_CONV;
-       pvt->conv_buffer = _vte_buffer_new();
+       pvt->conv_buffer = _vte_byte_array_new();
        vte_terminal_set_encoding(terminal, NULL);
        g_assert(terminal->pvt->encoding != NULL);
 
@@ -8679,9 +8679,9 @@ vte_terminal_finalize(GObject *object)
 
        /* Discard any pending data. */
        _vte_incoming_chunks_release (terminal->pvt->incoming);
-       _vte_buffer_free(terminal->pvt->outgoing);
+       _vte_byte_array_free(terminal->pvt->outgoing);
        g_array_free(terminal->pvt->pending, TRUE);
-       _vte_buffer_free(terminal->pvt->conv_buffer);
+       _vte_byte_array_free(terminal->pvt->conv_buffer);
 
        /* Stop the child and stop watching for input from the child. */
        if (terminal->pvt->pty_pid != -1) {
@@ -12545,7 +12545,7 @@ vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
        ilen = strlen(spec);
        ibuf = ibufptr = (guchar *)g_strdup(spec);
        olen = (ilen + 1) * sizeof(gunichar);
-       _vte_buffer_set_minimum_size(terminal->pvt->conv_buffer, olen);
+       _vte_byte_array_set_minimum_size(terminal->pvt->conv_buffer, olen);
        obuf = obufptr = terminal->pvt->conv_buffer->data;
        wbuf = (gunichar*) obuf;
        wbuf[ilen] = '\0';
@@ -12726,7 +12726,7 @@ vte_terminal_reset(VteTerminal *terminal,
        _vte_incoming_chunks_release (pvt->incoming);
        pvt->incoming = NULL;
        g_array_set_size(pvt->pending, 0);
-       _vte_buffer_clear(pvt->outgoing);
+       _vte_byte_array_clear(pvt->outgoing);
        /* Reset charset substitution state. */
        _vte_iso2022_state_free(pvt->iso2022);
        pvt->iso2022 = _vte_iso2022_state_new(NULL,
@@ -13049,7 +13049,7 @@ vte_terminal_set_pty(VteTerminal *terminal,
                vte_terminal_stop_processing (terminal);
 
                /* Clear the outgoing buffer as well. */
-               _vte_buffer_clear(terminal->pvt->outgoing);
+               _vte_byte_array_clear(terminal->pvt->outgoing);
 
                 vte_pty_close(pvt->pty);
                 g_object_unref(pvt->pty);
diff --git a/src/vteconv.c b/src/vteconv.c
index 265d6f7..ef94880 100644
--- a/src/vteconv.c
+++ b/src/vteconv.c
@@ -38,7 +38,7 @@ struct _VteConv {
        convert_func convert;
        gint (*close)(GIConv converter);
        gboolean in_unichar, out_unichar;
-       VteBuffer *in_scratch, *out_scratch;
+       VteByteArray *in_scratch, *out_scratch;
 };
 
 /* We can't use g_utf8_strlen as that's not nul-safe :( */
@@ -171,8 +171,8 @@ _vte_conv_open(const char *target, const char *source)
        ret->out_unichar = out_unichar;
 
        /* Create scratch buffers. */
-       ret->in_scratch = _vte_buffer_new();
-       ret->out_scratch = _vte_buffer_new();
+       ret->in_scratch = _vte_byte_array_new();
+       ret->out_scratch = _vte_byte_array_new();
 
        return ret;
 }
@@ -190,8 +190,8 @@ _vte_conv_close(VteConv converter)
        }
 
        /* Free the scratch buffers. */
-       _vte_buffer_free(converter->in_scratch);
-       _vte_buffer_free(converter->out_scratch);
+       _vte_byte_array_free(converter->in_scratch);
+       _vte_byte_array_free(converter->out_scratch);
 
        /* Free the structure itself. */
        g_slice_free(struct _VteConv, converter);
@@ -224,7 +224,7 @@ _vte_conv(VteConv converter,
                gunichar *g;
                /* Make sure the scratch buffer has enough space. */
                char_count = *inbytes_left / sizeof(gunichar);
-               _vte_buffer_set_minimum_size(converter->in_scratch,
+               _vte_byte_array_set_minimum_size(converter->in_scratch,
                                             (char_count + 1) * VTE_UTF8_BPC);
                /* Convert the incoming text. */
                g = (gunichar*) *inbuf;
@@ -243,7 +243,7 @@ _vte_conv(VteConv converter,
        /* Possibly set the output pointers to point at our scratch buffer. */
        if (converter->out_unichar) {
                work_outbytes = *outbytes_left * VTE_UTF8_BPC;
-               _vte_buffer_set_minimum_size(converter->out_scratch,
+               _vte_byte_array_set_minimum_size(converter->out_scratch,
                                             work_outbytes);
                work_outbuf_start = converter->out_scratch->data;
                work_outbuf_working = work_outbuf_start;
diff --git a/src/vteseq.c b/src/vteseq.c
index 1754a62..c0f676e 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -116,13 +116,13 @@ vte_ucs4_to_utf8 (VteTerminal *terminal, const guchar *in)
                inlen = vte_unichar_strlen ((gunichar *) in) * sizeof (gunichar);
                outlen = (inlen * VTE_UTF8_BPC) + 1;
 
-               _vte_buffer_set_minimum_size (terminal->pvt->conv_buffer, outlen);
+               _vte_byte_array_set_minimum_size (terminal->pvt->conv_buffer, outlen);
                buf = bufptr = terminal->pvt->conv_buffer->data;
 
                if (_vte_conv (conv, &in, &inlen, &buf, &outlen) == (size_t) -1) {
                        _vte_debug_print (VTE_DEBUG_IO,
                                          "Error converting %ld string bytes (%s), skipping.\n",
-                                         (long) _vte_buffer_length (terminal->pvt->outgoing),
+                                         (long) _vte_byte_array_length (terminal->pvt->outgoing),
                                          g_strerror (errno));
                        bufptr = NULL;
                } else {


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