History

fftools/cmdutils: Use av_strstart() instead of strncmp()

This also avoids hardcoding lengths.

Andreas Rheinhardt committed 5 years ago

Commit c66bb561 parent 4b3906b1 file · +2 −4Browse files

Unified · Split

fftools/cmdutils.c+2−4
@@ -903,20 +903,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) · 902 unmodified lines
903 if (!i && !cmd) {903 if (!i && !cmd) {
904 flags = 0; /* missing relative prefix, build absolute value */904 flags = 0; /* missing relative prefix, build absolute value */
905 }905 }
906 if (!strncmp(token, "repeat", 6)) {906 if (av_strstart(token, "repeat", &arg)) {
907 if (cmd == '-') {907 if (cmd == '-') {
908 flags |= AV_LOG_SKIP_REPEATED;908 flags |= AV_LOG_SKIP_REPEATED;
909 } else {909 } else {
910 flags &= ~AV_LOG_SKIP_REPEATED;910 flags &= ~AV_LOG_SKIP_REPEATED;
911 }911 }
912 arg = token + 6;912 } else if (av_strstart(token, "level", &arg)) {
913 } else if (!strncmp(token, "level", 5)) {
914 if (cmd == '-') {913 if (cmd == '-') {
915 flags &= ~AV_LOG_PRINT_LEVEL;914 flags &= ~AV_LOG_PRINT_LEVEL;
916 } else {915 } else {
917 flags |= AV_LOG_PRINT_LEVEL;916 flags |= AV_LOG_PRINT_LEVEL;
918 }917 }
919 arg = token + 5;
920 } else {918 } else {
921 break;919 break;
922 }920 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t