[vte/vte-next: 117/223] Rename VteBuffer to VteByteArray



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

    Rename VteBuffer to VteByteArray
    
    ... because I want to use "VteBuffer" for something else.

 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 752a10c..3896628 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -28,15 +28,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 95c25d4..d69f51b 100644
--- a/src/iso2022.c
+++ b/src/iso2022.c
@@ -76,7 +76,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
@@ -767,7 +767,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);
@@ -788,7 +788,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);
 	}
@@ -1162,7 +1162,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;
@@ -1750,7 +1750,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;
@@ -1778,7 +1778,7 @@ main(int argc, char **argv)
 	guchar b;
 
 	state = _vte_iso2022_state_new(NULL, 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);
@@ -1795,20 +1795,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 00bbc42..a9309c4 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -202,11 +202,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 d31733b..f5fd246 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -1967,11 +1967,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,
@@ -1987,8 +1987,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);
 			}
@@ -3627,7 +3627,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;
@@ -3640,10 +3640,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;
@@ -3680,7 +3680,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) {
@@ -3742,7 +3742,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++) {
@@ -3816,7 +3816,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. */
@@ -7579,9 +7579,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);
 
@@ -8076,9 +8076,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) {
@@ -12137,7 +12137,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';
@@ -12317,7 +12317,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,
@@ -12601,7 +12601,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 cd5e9d7..6f3dc72 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 :( */
@@ -192,8 +192,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;
 }
@@ -211,8 +211,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);
@@ -248,7 +248,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;
@@ -267,7 +267,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 fa72221..ba2aae6 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -115,13 +115,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]