Mercurial > mplayer.hg
comparison gui/skin/skin.c @ 32944:27a98940e3aa
Use FF_ARRAY_ELEMS() rather than a separate constant.
author | ib |
---|---|
date | Sun, 06 Mar 2011 11:55:52 +0000 |
parents | 3c57056637cc |
children | 394f32247319 |
comparison
equal
deleted
inserted
replaced
32943:d1c2c8899ec1 | 32944:27a98940e3aa |
---|---|
26 #include "gui/mplayer/widgets.h" | 26 #include "gui/mplayer/widgets.h" |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "help_mp.h" | 29 #include "help_mp.h" |
30 #include "libavutil/avstring.h" | 30 #include "libavutil/avstring.h" |
31 #include "libavutil/common.h" | |
31 #include "mp_msg.h" | 32 #include "mp_msg.h" |
32 | 33 |
33 typedef struct { | 34 typedef struct { |
34 const char *name; | 35 const char *name; |
35 int (*func)(char *in); | 36 int (*func)(char *in); |
807 { "dlabel", cmd_dlabel }, | 808 { "dlabel", cmd_dlabel }, |
808 { "decoration", cmd_decoration }, | 809 { "decoration", cmd_decoration }, |
809 { "menu", cmd_menu } | 810 { "menu", cmd_menu } |
810 }; | 811 }; |
811 | 812 |
812 static const int ITEMS = sizeof(skinItem) / sizeof(_item); | |
813 | |
814 char *strswap(char *in, char what, char whereof) | 813 char *strswap(char *in, char what, char whereof) |
815 { | 814 { |
816 int i; | 815 int i; |
817 | 816 |
818 if (strlen(in) == 0) | 817 if (strlen(in) == 0) |
868 FILE *skinFile; | 867 FILE *skinFile; |
869 unsigned char tmp[256]; | 868 unsigned char tmp[256]; |
870 unsigned char *ptmp; | 869 unsigned char *ptmp; |
871 unsigned char command[32]; | 870 unsigned char command[32]; |
872 unsigned char param[256]; | 871 unsigned char param[256]; |
873 int i; | 872 unsigned int i; |
874 | 873 |
875 fn = setname(skinDirInHome, dname); | 874 fn = setname(skinDirInHome, dname); |
876 | 875 |
877 if ((skinFile = fopen(fn, "rt")) == NULL) { | 876 if ((skinFile = fopen(fn, "rt")) == NULL) { |
878 fn = setname(skinMPlayerDir, dname); | 877 fn = setname(skinMPlayerDir, dname); |
905 | 904 |
906 cutItem(tmp, command, '=', 0); | 905 cutItem(tmp, command, '=', 0); |
907 cutItem(tmp, param, '=', 1); | 906 cutItem(tmp, param, '=', 1); |
908 strlower(command); | 907 strlower(command); |
909 | 908 |
910 for (i = 0; i < ITEMS; i++) | 909 for (i = 0; i < FF_ARRAY_ELEMS(skinItem); i++) |
911 if (!strcmp(command, skinItem[i].name)) | 910 if (!strcmp(command, skinItem[i].name)) |
912 if (skinItem[i].func(param) != 0) | 911 if (skinItem[i].func(param) != 0) |
913 return -2; | 912 return -2; |
914 } | 913 } |
915 | 914 |