Mercurial > mplayer.hg
diff m_option.c @ 23703:9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
instead of plain strlcat/strlcpy
author | reimar |
---|---|
date | Thu, 05 Jul 2007 22:01:07 +0000 |
parents | 6b18c979dd45 |
children | cc170348a763 |
line wrap: on
line diff
--- a/m_option.c Thu Jul 05 10:18:58 2007 +0000 +++ b/m_option.c Thu Jul 05 22:01:07 2007 +0000 @@ -16,6 +16,7 @@ //#include "m_config.h" #include "mp_msg.h" #include "stream/url.h" +#include "libavutil/avstring.h" // Don't free for 'production' atm #ifndef MP_DEBUG @@ -920,7 +921,7 @@ int optlen = strcspn(p, ":="); /* clear out */ subopt[0] = subparam[0] = 0; - strlcpy(subopt, p, optlen + 1); + av_strlcpy(subopt, p, optlen + 1); p = &p[optlen]; if (p[0] == '=') { sscanf_ret = 2; @@ -928,7 +929,7 @@ if (p[0] == '"') { p = &p[1]; optlen = strcspn(p, "\""); - strlcpy(subparam, p, optlen + 1); + av_strlcpy(subparam, p, optlen + 1); p = &p[optlen]; if (p[0] != '"') { mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Terminating '\"' missing for '%s'\n", subopt); @@ -943,11 +944,11 @@ return M_OPT_INVALID; } p = &p[1]; - strlcpy(subparam, p, optlen + 1); + av_strlcpy(subparam, p, optlen + 1); p = &p[optlen]; } else { optlen = strcspn(p, ":"); - strlcpy(subparam, p, optlen + 1); + av_strlcpy(subparam, p, optlen + 1); p = &p[optlen]; } }