diff mbox series

[08/28] edid-decode: Output block type before fail

Message ID 20210924233149.10028-9-joevt@shaw.ca (mailing list archive)
State New, archived
Headers show
Series bug fixes, additions, changes | expand

Commit Message

joevt Sept. 24, 2021, 11:31 p.m. UTC
For extended tags, block type should be output before fail messages (duplicate failure, or missing audio failure).
For normal tags 0x04 and 0x05, fail message should appear after block type instead of block data to be consistent (and also to indicate that the failure is because of the block type and not the contents of the block).

Signed-off-by: Joe van Tunen <joevt@shaw.ca>
---
 parse-cta-block.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 130fe9e..d6c797d 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2042,6 +2042,9 @@  void edid_state::cta_ext_block(unsigned tag, const unsigned char *x, unsigned le
 		return;
 	}
 
+	if (data_block.length())
+		printf("  %s:\n", data_block.c_str());
+
 	switch (tag) {
 	case 0x700:
 	case 0x702:
@@ -2061,9 +2064,6 @@  void edid_state::cta_ext_block(unsigned tag, const unsigned char *x, unsigned le
 	if (audio_block && !(cta.byte3 & 0x40))
 		fail("Audio information is present, but bit 6 of Byte 3 of the CTA-861 Extension header indicates no Basic Audio support.\n");
 
-	if (data_block.length())
-		printf("  %s:\n", data_block.c_str());
-
 	switch (tag) {
 	case 0x700: cta_vcdb(x, length); break;
 	case 0x701:
@@ -2258,17 +2258,17 @@  void edid_state::cta_block(const unsigned char *x, bool duplicate)
 	case 0x04:
 		data_block = "Speaker Allocation Data Block";
 		printf("  %s:\n", data_block.c_str());
-		cta_sadb(x, length);
-		audio_block = true;
 		if (duplicate)
 			fail("Only one instance of this Data Block is allowed.\n");
+		cta_sadb(x, length);
+		audio_block = true;
 		break;
 	case 0x05:
 		data_block = "VESA Display Transfer Characteristics Data Block";
 		printf("  %s:\n", data_block.c_str());
-		cta_vesa_dtcdb(x, length);
 		if (duplicate)
 			fail("Only one instance of this Data Block is allowed.\n");
+		cta_vesa_dtcdb(x, length);
 		break;
 	case 0x07:
 		data_block = "Unknown CTA-861 Data Block (extended tag truncated)";