SDL_mixer: mp3utils.c: Corrected error texts at id3v2*_parse_frame() calls

From 0a1e9844239e5b0951b692d83b9fbe1d4ba689d3 Mon Sep 17 00:00:00 2001
From: Wohlstand <[EMAIL REDACTED]>
Date: Thu, 22 Dec 2022 12:02:38 +0300
Subject: [PATCH] mp3utils.c: Corrected error texts at id3v2*_parse_frame()
 calls

---
 src/codecs/mp3utils.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/codecs/mp3utils.c b/src/codecs/mp3utils.c
index 2edf8da5..b8cd11d5 100644
--- a/src/codecs/mp3utils.c
+++ b/src/codecs/mp3utils.c
@@ -381,7 +381,9 @@ static size_t id3v22_parse_frame(Mix_MusicMetaTags *out_tags, struct mp3file_t *
     read_size = MP3_RWread(src, buffer, 1, ID3v2_2_FRAME_HEADER_SIZE);
 
     if (read_size < ID3v2_2_FRAME_HEADER_SIZE) {
-        SDL_Log("id3v22_parse_frame (1): Buffer size that left is too small (%u < 6)", (unsigned int)read_size);
+        SDL_Log("id3v22_parse_frame (1): Unexpected end of the file while frame header reading (had to read %u bytes, %u bytes wanted)",
+                (unsigned int)read_size,
+                (unsigned int)ID3v2_2_FRAME_HEADER_SIZE);
         MP3_RWseek(src, frame_begin, RW_SEEK_SET);
         return 0; /* Buffer size that left is too small */
     }
@@ -398,14 +400,18 @@ static size_t id3v22_parse_frame(Mix_MusicMetaTags *out_tags, struct mp3file_t *
     if (size < ID3v2_BUFFER_SIZE) {
         read_size = MP3_RWread(src, buffer, 1, size);
         if (read_size < size) {
-            SDL_Log("id3v22_parse_frame (2): Buffer size that left is too small (%u < %u)", (unsigned int)read_size, (unsigned int)size);
+            SDL_Log("id3v22_parse_frame (2): Unexpected end of the file while frame data reading (had to read %u bytes, %u bytes wanted)",
+                    (unsigned int)read_size,
+                    (unsigned int)size);
             MP3_RWseek(src, frame_begin, RW_SEEK_SET);
             return 0; /* Can't read frame data, possibly, a file size was reached */
         }
     } else {
         read_size = MP3_RWread(src, buffer, 1, ID3v2_BUFFER_SIZE);
         if (read_size < ID3v2_BUFFER_SIZE) {
-            SDL_Log("id3v22_parse_frame (3): Buffer size that left is too small (%u < %u)", (unsigned int)read_size, ID3v2_BUFFER_SIZE);
+            SDL_Log("id3v22_parse_frame (3): Unexpected end of the file while frame data reading (had to read %u bytes, %u bytes wanted)",
+                    (unsigned int)read_size,
+                    (unsigned int)ID3v2_BUFFER_SIZE);
             MP3_RWseek(src, frame_begin, RW_SEEK_SET);
             return 0; /* Can't read frame data, possibly, a file size was reached */
         }
@@ -429,7 +435,9 @@ static size_t id3v2x_parse_frame(Mix_MusicMetaTags *out_tags, struct mp3file_t *
     read_size = MP3_RWread(src, buffer, 1, ID3v2_3_FRAME_HEADER_SIZE);
 
     if (read_size < ID3v2_3_FRAME_HEADER_SIZE) {
-        SDL_Log("id3v2x_parse_frame (1): Buffer size that left is too small (%u < %u)", (unsigned int)read_size, ID3v2_3_FRAME_HEADER_SIZE);
+        SDL_Log("id3v2x_parse_frame (1): Unexpected end of the file while frame header reading (had to read %u bytes, %u bytes wanted)",
+                (unsigned int)read_size,
+                (unsigned int)ID3v2_3_FRAME_HEADER_SIZE);
         MP3_RWseek(src, frame_begin, RW_SEEK_SET);
         return 0; /* Can't read frame header, possibly, a file size was reached */
     }
@@ -452,14 +460,18 @@ static size_t id3v2x_parse_frame(Mix_MusicMetaTags *out_tags, struct mp3file_t *
     if (size < ID3v2_BUFFER_SIZE) {
         read_size = MP3_RWread(src, buffer, 1, size);
         if (read_size < size) {
-            SDL_Log("id3v2x_parse_frame (2): Buffer size that left is too small (%u < %u)", (unsigned int)read_size, (unsigned int)size);
+            SDL_Log("id3v2x_parse_frame (2): Unexpected end of the file while frame data reading (had to read %u bytes, %u bytes wanted)",
+                    (unsigned int)read_size,
+                    (unsigned int)size);
             MP3_RWseek(src, frame_begin, RW_SEEK_SET);
             return 0; /* Can't read frame data, possibly, a file size was reached */
         }
     } else {
         read_size = MP3_RWread(src, buffer, 1, ID3v2_BUFFER_SIZE);
         if (read_size < ID3v2_BUFFER_SIZE) {
-            SDL_Log("id3v2x_parse_frame (3): Buffer size that left is too small (%u < %u)", (unsigned int)read_size, ID3v2_BUFFER_SIZE);
+            SDL_Log("id3v2x_parse_frame (3): Unexpected end of the file while frame data reading (had to read %u bytes, %u bytes wanted)",
+                    (unsigned int)read_size,
+                    (unsigned int)ID3v2_BUFFER_SIZE);
             MP3_RWseek(src, frame_begin, RW_SEEK_SET);
             return 0; /* Can't read frame data, possibly, a file size was reached */
         }