This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: build edid-decode.js without warnings
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Tue Apr 5 08:55:11 2022 +0200

Fix various build warnings when running 'make edid-decode.js'.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 edid-decode.cpp      | 239 ++++++++++++++++++++++++++-------------------------
 parse-base-block.cpp |   1 +
 parse-cta-block.cpp  |   1 +
 3 files changed, 124 insertions(+), 117 deletions(-)

---

diff --git a/edid-decode.cpp b/edid-decode.cpp
index 47460089b62d..b7fe57ad8474 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -77,6 +77,7 @@ enum Option {
 
 static char options[OptLast];
 
+#ifndef __EMSCRIPTEN__
 static struct option long_options[] = {
        { "help", no_argument, 0, OptHelp },
        { "output-format", required_argument, 0, OptOutputFormat },
@@ -192,6 +193,7 @@ static void usage(void)
               "  --list-rid-timings <rid> List all timings for RID <rid> or 
all known RIDs if <rid> is 0.\n"
               "  -h, --help            Display this help message.\n");
 }
+#endif
 
 static std::string s_msgs[EDID_MAX_BLOCKS + 1][2];
 
@@ -1026,122 +1028,6 @@ static bool extract_edid(int fd, FILE *error)
        return true;
 }
 
-static unsigned char crc_calc(const unsigned char *b)
-{
-       unsigned char sum = 0;
-       unsigned i;
-
-       for (i = 0; i < 127; i++)
-               sum += b[i];
-       return 256 - sum;
-}
-
-static int crc_ok(const unsigned char *b)
-{
-       return crc_calc(b) == b[127];
-}
-
-static void hexdumpedid(FILE *f, const unsigned char *edid, unsigned size)
-{
-       unsigned b, i, j;
-
-       for (b = 0; b < size / 128; b++) {
-               const unsigned char *buf = edid + 128 * b;
-
-               if (b)
-                       fprintf(f, "\n");
-               for (i = 0; i < 128; i += 0x10) {
-                       fprintf(f, "%02x", buf[i]);
-                       for (j = 1; j < 0x10; j++) {
-                               fprintf(f, " %02x", buf[i + j]);
-                       }
-                       fprintf(f, "\n");
-               }
-               if (!crc_ok(buf))
-                       fprintf(f, "Block %u has a checksum error (should be 
0x%02x).\n",
-                               b, crc_calc(buf));
-       }
-}
-
-static void carraydumpedid(FILE *f, const unsigned char *edid, unsigned size)
-{
-       unsigned b, i, j;
-
-       fprintf(f, "const unsigned char edid[] = {\n");
-       for (b = 0; b < size / 128; b++) {
-               const unsigned char *buf = edid + 128 * b;
-
-               if (b)
-                       fprintf(f, "\n");
-               for (i = 0; i < 128; i += 8) {
-                       fprintf(f, "\t0x%02x,", buf[i]);
-                       for (j = 1; j < 8; j++) {
-                               fprintf(f, " 0x%02x,", buf[i + j]);
-                       }
-                       fprintf(f, "\n");
-               }
-               if (!crc_ok(buf))
-                       fprintf(f, "\t/* Block %u has a checksum error (should 
be 0x%02x). */\n",
-                               b, crc_calc(buf));
-       }
-       fprintf(f, "};\n");
-}
-
-// This format can be read by the QuantumData EDID editor
-static void xmldumpedid(FILE *f, const unsigned char *edid, unsigned size)
-{
-       fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\" 
standalone=\"no\"?>\n");
-       fprintf(f, "<DATAOBJ>\n");
-       fprintf(f, "    <HEADER TYPE=\"DID\" VERSION=\"1.0\"/>\n");
-       fprintf(f, "    <DATA>\n");
-       for (unsigned b = 0; b < size / 128; b++) {
-               const unsigned char *buf = edid + 128 * b;
-
-               fprintf(f, "        <BLOCK%u>", b);
-               for (unsigned i = 0; i < 128; i++)
-                       fprintf(f, "%02X", buf[i]);
-               fprintf(f, "</BLOCK%u>\n", b);
-       }
-       fprintf(f, "    </DATA>\n");
-       fprintf(f, "</DATAOBJ>\n");
-}
-
-
-static int edid_to_file(const char *to_file, enum output_format out_fmt)
-{
-       FILE *out;
-
-       if (!strcmp(to_file, "-")) {
-               to_file = "stdout";
-               out = stdout;
-       } else if ((out = fopen(to_file, "w")) == NULL) {
-               perror(to_file);
-               return -1;
-       }
-       if (out_fmt == OUT_FMT_DEFAULT)
-               out_fmt = out == stdout ? OUT_FMT_HEX : OUT_FMT_RAW;
-
-       switch (out_fmt) {
-       default:
-       case OUT_FMT_HEX:
-               hexdumpedid(out, edid, state.edid_size);
-               break;
-       case OUT_FMT_RAW:
-               fwrite(edid, state.edid_size, 1, out);
-               break;
-       case OUT_FMT_CARRAY:
-               carraydumpedid(out, edid, state.edid_size);
-               break;
-       case OUT_FMT_XML:
-               xmldumpedid(out, edid, state.edid_size);
-               break;
-       }
-
-       if (out != stdout)
-               fclose(out);
-       return 0;
-}
-
 static int edid_from_file(const char *from_file, FILE *error)
 {
 #ifdef O_BINARY
@@ -1553,6 +1439,123 @@ int edid_state::parse_edid()
        return failures ? -2 : 0;
 }
 
+#ifndef __EMSCRIPTEN__
+
+static unsigned char crc_calc(const unsigned char *b)
+{
+       unsigned char sum = 0;
+       unsigned i;
+
+       for (i = 0; i < 127; i++)
+               sum += b[i];
+       return 256 - sum;
+}
+
+static int crc_ok(const unsigned char *b)
+{
+       return crc_calc(b) == b[127];
+}
+
+static void hexdumpedid(FILE *f, const unsigned char *edid, unsigned size)
+{
+       unsigned b, i, j;
+
+       for (b = 0; b < size / 128; b++) {
+               const unsigned char *buf = edid + 128 * b;
+
+               if (b)
+                       fprintf(f, "\n");
+               for (i = 0; i < 128; i += 0x10) {
+                       fprintf(f, "%02x", buf[i]);
+                       for (j = 1; j < 0x10; j++) {
+                               fprintf(f, " %02x", buf[i + j]);
+                       }
+                       fprintf(f, "\n");
+               }
+               if (!crc_ok(buf))
+                       fprintf(f, "Block %u has a checksum error (should be 
0x%02x).\n",
+                               b, crc_calc(buf));
+       }
+}
+
+static void carraydumpedid(FILE *f, const unsigned char *edid, unsigned size)
+{
+       unsigned b, i, j;
+
+       fprintf(f, "const unsigned char edid[] = {\n");
+       for (b = 0; b < size / 128; b++) {
+               const unsigned char *buf = edid + 128 * b;
+
+               if (b)
+                       fprintf(f, "\n");
+               for (i = 0; i < 128; i += 8) {
+                       fprintf(f, "\t0x%02x,", buf[i]);
+                       for (j = 1; j < 8; j++) {
+                               fprintf(f, " 0x%02x,", buf[i + j]);
+                       }
+                       fprintf(f, "\n");
+               }
+               if (!crc_ok(buf))
+                       fprintf(f, "\t/* Block %u has a checksum error (should 
be 0x%02x). */\n",
+                               b, crc_calc(buf));
+       }
+       fprintf(f, "};\n");
+}
+
+// This format can be read by the QuantumData EDID editor
+static void xmldumpedid(FILE *f, const unsigned char *edid, unsigned size)
+{
+       fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\" 
standalone=\"no\"?>\n");
+       fprintf(f, "<DATAOBJ>\n");
+       fprintf(f, "    <HEADER TYPE=\"DID\" VERSION=\"1.0\"/>\n");
+       fprintf(f, "    <DATA>\n");
+       for (unsigned b = 0; b < size / 128; b++) {
+               const unsigned char *buf = edid + 128 * b;
+
+               fprintf(f, "        <BLOCK%u>", b);
+               for (unsigned i = 0; i < 128; i++)
+                       fprintf(f, "%02X", buf[i]);
+               fprintf(f, "</BLOCK%u>\n", b);
+       }
+       fprintf(f, "    </DATA>\n");
+       fprintf(f, "</DATAOBJ>\n");
+}
+
+static int edid_to_file(const char *to_file, enum output_format out_fmt)
+{
+       FILE *out;
+
+       if (!strcmp(to_file, "-")) {
+               to_file = "stdout";
+               out = stdout;
+       } else if ((out = fopen(to_file, "w")) == NULL) {
+               perror(to_file);
+               return -1;
+       }
+       if (out_fmt == OUT_FMT_DEFAULT)
+               out_fmt = out == stdout ? OUT_FMT_HEX : OUT_FMT_RAW;
+
+       switch (out_fmt) {
+       default:
+       case OUT_FMT_HEX:
+               hexdumpedid(out, edid, state.edid_size);
+               break;
+       case OUT_FMT_RAW:
+               fwrite(edid, state.edid_size, 1, out);
+               break;
+       case OUT_FMT_CARRAY:
+               carraydumpedid(out, edid, state.edid_size);
+               break;
+       case OUT_FMT_XML:
+               xmldumpedid(out, edid, state.edid_size);
+               break;
+       }
+
+       if (out != stdout)
+               fclose(out);
+       return 0;
+}
+
 enum cvt_opts {
        CVT_WIDTH = 0,
        CVT_HEIGHT,
@@ -2122,7 +2125,8 @@ int main(int argc, char **argv)
        return ret ? ret : state.parse_edid();
 }
 
-#ifdef __EMSCRIPTEN__
+#else
+
 /*
  * The surrounding JavaScript implementation will call this function
  * each time it wants to decode an EDID. So this should reset all the
@@ -2141,4 +2145,5 @@ extern "C" int parse_edid(const char *input)
        int ret = edid_from_file(input, stderr);
        return ret ? ret : state.parse_edid();
 }
+
 #endif
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index c8fcfeb63126..aec665586a5b 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -979,6 +979,7 @@ void edid_state::detailed_timings(const char *prefix, const 
unsigned char *x,
        switch ((flags & 0x18) >> 3) {
        case 0x00:
                s_flags = "analog composite";
+               [[clang::fallthrough]];
                /* fall-through */
        case 0x01:
                if (s_flags.empty())
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index d525e2aceb41..eff316f594a0 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2577,6 +2577,7 @@ void edid_state::preparse_cta_block(const unsigned char 
*x)
                        if (x[i + 1] != 0x0e)
                                continue;
                        for_ycbcr420 = true;
+                       [[clang::fallthrough]];
                        /* fall-through */
                case 0x02:
                        for (unsigned j = 1 + for_ycbcr420; j <= (x[i] & 0x1f); 
j++) {

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to