OSDN Git Service

Properly terminate parsed environment values with '\0'.
[android-x86/hardware-intel-common-libva.git] / va / va_trace.c
index 4e1b8e8..13fc6d2 100644 (file)
@@ -546,6 +546,7 @@ static int open_tracing_specil_file(
     FILE *fp = NULL;
 
     strncpy(env_value, fn_env, 1024);
+    env_value[1023] = '\0';
     FILE_NAME_SUFFIX(env_value, 1024,
         "ctx-", (unsigned int)ptra_ctx->trace_context);
 
@@ -594,6 +595,7 @@ static int open_tracing_log_file(
         char env_value[1024];
 
         strncpy(env_value, pva_trace->fn_log_env, 1024);
+        env_value[1023] = '\0';
         FILE_NAME_SUFFIX(env_value, 1024,
             "thd-", (unsigned int)thd_id);
 
@@ -733,7 +735,6 @@ void va_TraceInit(VADisplay dpy)
 {
     char env_value[1024];
     unsigned short suffix = 0xffff & ((unsigned int)time(NULL));
-    int trace_index = 0;
     FILE *tmp;
     struct va_trace *pva_trace = calloc(sizeof(struct va_trace), 1);
     struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1);
@@ -939,7 +940,7 @@ static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
 
 static void va_TraceSurface(VADisplay dpy, VAContextID context)
 {
-    unsigned int i, j;
+    unsigned int i;
     unsigned int fourcc; /* following are output argument */
     unsigned int luma_stride;
     unsigned int chroma_u_stride;
@@ -951,7 +952,6 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context)
     void *buffer = NULL;
     unsigned char *Y_data, *UV_data, *tmp;
     VAStatus va_status;
-    unsigned char check_sum = 0;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
 
     if (!trace_ctx->trace_fp_surface)
@@ -1510,9 +1510,6 @@ void va_TraceDestroyBuffer (
     VABufferType type;
     unsigned int size;
     unsigned int num_elements;
-    
-    VACodedBufferSegment *buf_list;
-    int i = 0;
 
     if (buf_id == VA_INVALID_ID)
         return;
@@ -1882,7 +1879,7 @@ static void va_TraceVAHuffmanTableBufferJPEG(
     va_TraceMsg(trace_ctx,"*VAHuffmanTableBufferJPEG\n");
 
     for (i = 0; i < 2; ++i) {
-        va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[0]);
+        va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[i]);
         va_TraceMsg(trace_ctx,"\thuffman_table[%d] =\n", i);
         memset(tmp, 0, sizeof tmp);
         for (j = 0; j < 16; ++j) {
@@ -3123,7 +3120,6 @@ static void va_TraceVAEncPackedHeaderParameterBufferType(
 {
     VAEncPackedHeaderParameterBuffer* p = (VAEncPackedHeaderParameterBuffer*)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    int i;
 
     if (!p)
         return;
@@ -3557,7 +3553,7 @@ static void va_TraceVAPictureParameterBufferVP9(
 {
     VADecPictureParameterBufferVP9 *p = (VADecPictureParameterBufferVP9 *)data;
     DPY2TRACECTX(dpy, context, VA_INVALID_ID);
-    int i,j;
+    int i;
 
     va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVP9\n");