]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/magicyuvenc: Use more correct cast in compare function
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 8 Oct 2020 19:14:28 +0000 (21:14 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 8 Oct 2020 23:17:02 +0000 (01:17 +0200)
There is no need to cast const away (even if it was harmless) and to
copy the object at all.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/magicyuvenc.c

index 9b79ac69b6cfb4eab8847b0e79e1c4635c46a7ad..d53fe6f328e1584738101dfc495f87c44e423c35 100644 (file)
@@ -280,9 +280,9 @@ typedef struct PackageMergerList {
 
 static int compare_by_prob(const void *a, const void *b)
 {
-    PTable a_val = *(PTable *)a;
-    PTable b_val = *(PTable *)b;
-    return a_val.prob - b_val.prob;
+    const PTable *a2 = a;
+    const PTable *b2 = b;
+    return a2->prob - b2->prob;
 }
 
 static void magy_huffman_compute_bits(PTable *prob_table, HuffEntry *distincts,