diff mbox series

[v2,08/29] edid-decode: Output block type before fail

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

Commit Message

joevt Sept. 26, 2021, 8:33 a.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 f1ad041..fb2e9ea 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2078,6 +2078,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:
@@ -2097,9 +2100,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:
@@ -2294,17 +2294,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)";