Browse Source

* Add implementation of strlcpy

* Fix endless loop in find_info_tag if given specific arguments

Originally committed as revision 481 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Philip Gladstone 23 years ago
parent
commit
8d1335ea2b
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      libav/utils.c

+ 13
- 0
libav/utils.c View File

@@ -124,6 +124,18 @@ void nstrcpy(char *buf, int buf_size, const char *str)
*q = '\0'; *q = '\0';
} }


void strlcpy(char *dst, const char *src, int len)
{
int slen = strlen(src) + 1;

if (slen <= len) {
memcpy(dst, src, slen);
} else {
memcpy(dst, src, len - 1);
dst[len - 1] = 0;
}
}

void register_all(void) void register_all(void)
{ {
avcodec_init(); avcodec_init();
@@ -561,6 +573,7 @@ int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
return 1; return 1;
if (*p != '&') if (*p != '&')
break; break;
p++;
} }
return 0; return 0;
} }


Loading…
Cancel
Save