]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/img2.c
Null pointer check / CID26.
[ffmpeg] / libavformat / img2.c
index 6e846df66f09486e10e07ebead4af826158f3cbf..4b3545412311c9880a10bfb7ad625460bc2554b7 100644 (file)
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "libavutil/avstring.h"
 #include "avformat.h"
-#include "avstring.h"
+#include <strings.h>
 
 typedef struct {
     int img_first;
@@ -66,7 +68,7 @@ static const IdStrMap img_tags[] = {
     { CODEC_ID_SUNRAST   , "im8"},
     { CODEC_ID_SUNRAST   , "im24"},
     { CODEC_ID_SUNRAST   , "sunras"},
-    {0, NULL}
+    { CODEC_ID_NONE      , NULL}
 };
 
 static int sizes[][2] = {
@@ -101,11 +103,8 @@ static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
     str++;
 
     while (tags->id) {
-        int i;
-        for(i=0; toupper(tags->str[i]) == toupper(str[i]); i++){
-            if(tags->str[i]==0 && str[i]==0)
-                return tags->id;
-        }
+        if (!strcasecmp(str, tags->str))
+            return tags->id;
 
         tags++;
     }
@@ -373,11 +372,6 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-static int img_write_trailer(AVFormatContext *s)
-{
-    return 0;
-}
-
 #endif /* CONFIG_MUXERS */
 
 /* input */
@@ -420,7 +414,7 @@ AVOutputFormat image2_muxer = {
     CODEC_ID_MJPEG,
     img_write_header,
     img_write_packet,
-    img_write_trailer,
+    NULL,
     AVFMT_NOFILE,
 };
 #endif
@@ -435,6 +429,5 @@ AVOutputFormat image2pipe_muxer = {
     CODEC_ID_MJPEG,
     img_write_header,
     img_write_packet,
-    img_write_trailer,
 };
 #endif