necouchman commented on code in PR #407:
URL: https://github.com/apache/guacamole-server/pull/407#discussion_r1059672133


##########
src/guacenc/guacenc.c:
##########
@@ -65,6 +70,25 @@ int main(int argc, char* argv[]) {
         else if (opt == 'f')
             force = true;
 
+        /* -c: Codec */
+        else if (opt == 'c') {
+            codec_name = optarg;
+
+            size = sizeof(codec_names) / sizeof(codec_names[0]);
+            for (i = 0; i < size; i++) {
+                if (strcmp(codec_name, codec_names[i]) == 0) {
+                    codec_valid = true;
+                    codec_suffix = i;
+                    break;
+                }
+            }
+
+            if (codec_valid != true) {
+                guacenc_log(GUAC_LOG_ERROR, "Invalid codec.");
+                goto invalid_codecs;

Review Comment:
   Why the `goto` statement, here? As far as I can tell, this is the only place 
this is referenced, so why not just handle the error entirely in this block of 
code and exit immediately? The `goto invalid_options` makes sense because it is 
used in multiple places and reduces the amount of overall code.
   
   Alternatively, maybe just make this part of the `invalid_options` block and 
update that to include valid codecs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to