[Mesa-dev] [PATCH 1/2] intel/aubinator_error_decode: Avoid printing long ascii85 lines

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Apr 7 06:54:50 UTC 2017


Series is:

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Thu, 2017-04-06 at 13:37 -0700, Jordan Justen wrote:
> Since '---' can exist within an ascii85 encoded string, we should
> avoid these strings when looking for header lines in the error state
> file.
> 
> One of the things we do inside the 'if (dashes) {' block is to print
> the entire line. Since these the ascii85 lines are extremely long it
> makes it difficult to then view the aubinator_error_decode output.
> 
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/intel/tools/aubinator_error_decode.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/tools/aubinator_error_decode.c
> b/src/intel/tools/aubinator_error_decode.c
> index 2e623698ed1..21386fef8a9 100644
> --- a/src/intel/tools/aubinator_error_decode.c
> +++ b/src/intel/tools/aubinator_error_decode.c
> @@ -349,6 +349,7 @@ read_data_file(FILE *file)
>     while (getline(&line, &line_size, file) > 0) {
>        char *new_ring_name = NULL;
>        char *dashes;
> +      bool ascii85_start = line[0] == ':' || line[0] == '~';
>        line_number++;
>  
>        if (sscanf(line, "%m[^ ] command stream\n", &new_ring_name) >
> 0) {
> @@ -356,7 +357,7 @@ read_data_file(FILE *file)
>           ring_name = new_ring_name;
>        }
>  
> -      dashes = strstr(line, "---");
> +      dashes = !ascii85_start || line_size < 256 ? strstr(line, "---
> ") : NULL;
>        if (dashes) {
>           uint32_t lo, hi;
>           char *new_ring_name = malloc(dashes - line);
> @@ -423,7 +424,7 @@ read_data_file(FILE *file)
>           }
>        }
>  
> -      if (line[0] == ':' || line[0] == '~') {
> +      if (ascii85_start) {
>           count = ascii85_decode(line+1, &data, line[0] == ':');
>           if (count == 0) {
>              fprintf(stderr, "ASCII85 decode failed.\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170407/4a38ef65/attachment.sig>


More information about the mesa-dev mailing list