[cairo-commit] 2 commits - util/cairo-trace

Chris Wilson ickle at kemper.freedesktop.org
Thu Aug 6 02:31:36 PDT 2009


 util/cairo-trace/trace.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit ee69f8aa5e0697aaeee9c00839fb7b30fe7e3184
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 6 10:30:52 2009 +0100

    [trace] Whitespace
    
    A few gratuitous whitespace and increase the buffer size used whilst
    reading in data files.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 5ab8cc8..fbcb3d7 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1217,17 +1217,13 @@ _write_base85_data (struct _data_stream *stream,
 		    const unsigned char	  *data,
 		    unsigned int	   length)
 {
-    const unsigned char *ptr = data;
     unsigned char five_tuple[5];
-    bool is_zero;
     int ret;
 
     while (length--) {
-	stream->four_tuple[stream->base85_pending++] = *ptr++;
+	stream->four_tuple[stream->base85_pending++] = *data++;
 	if (stream->base85_pending == 4) {
-	    is_zero = _expand_four_tuple_to_five (stream->four_tuple,
-						  five_tuple);
-	    if (is_zero)
+	    if (_expand_four_tuple_to_five (stream->four_tuple, five_tuple))
 		ret = fwrite ("z", 1, 1, logfile);
 	    else
 		ret = fwrite (five_tuple, 5, 1, logfile);
@@ -3645,13 +3641,13 @@ cairo_ft_font_face_create_for_ft_face (FT_Face face, int load_flags)
 static bool
 _ft_read_file (FtFaceData *data, const char *path)
 {
-    char buf[4096];
+    char buf[8192];
     FILE *file;
 
     file = fopen (path, "rb");
     if (file != NULL) {
 	size_t ret;
-	unsigned long int allocated = 8192;
+	unsigned long int allocated = sizeof (buf);
 	data->data = malloc (allocated);
 	do {
 	    ret = fread (buf, 1, sizeof (buf), file);
commit 6d30021d65aa4126cd5eef47b0e6057dfc17d7ac
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug 6 10:29:49 2009 +0100

    [trace] Only write the 4 byte length to the stream
    
    We were attempting to write out the whole length of the block when we were
    just trying to write out the length value.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 2775d46..5ab8cc8 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1268,7 +1268,7 @@ _write_data_start (struct _data_stream *stream, uint32_t len)
     _write_base85_data_start (stream);
 
     _trace_printf ("<|");
-    _write_base85_data (stream, (unsigned char *) &len, len);
+    _write_base85_data (stream, (unsigned char *) &len, sizeof (len));
 }
 
 static void


More information about the cairo-commit mailing list