[FFmpeg-cvslog] r9756 - trunk/libavformat/os_support.c
benoit
subversion
Thu Jul 19 12:48:50 CEST 2007
Author: benoit
Date: Thu Jul 19 12:48:50 2007
New Revision: 9756
Log:
use sscanf to parse address
Modified:
trunk/libavformat/os_support.c
Modified: trunk/libavformat/os_support.c
==============================================================================
--- trunk/libavformat/os_support.c (original)
+++ trunk/libavformat/os_support.c Thu Jul 19 12:48:50 2007
@@ -41,19 +41,10 @@
int inet_aton (const char * str, struct in_addr * add)
{
- const char * pch = str;
unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
- add1 = atoi(pch);
- pch = strpbrk(pch,".");
- if (!pch) return 0;
- add2 = atoi(pch);
- pch = strpbrk(pch,".");
- if (!pch) return 0;
- add3 = atoi(pch);
- pch = strpbrk(pch,".");
- if (!pch) return 0;
- add4 = atoi(pch);
+ if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4)
+ return 0;
if (!add1 || (add1|add2|add3|add4) > 255) return 0;
More information about the ffmpeg-cvslog
mailing list