0,};
unsigned char *animated_data[1000] = {NULL, };
memset(gif_filename, 0, BUFFER_SIZE);
- {
- snprintf(gif_filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "gif");
- }
+ snprintf(gif_filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "gif");
if ((fd = opendir(argv[2])) == NULL) {
fprintf(stderr, "listdir: can't open %s\n", argv[2]);
}
while ((dp = readdir(fd)) != NULL) {
+ if (dp->d_name == NULL)
+ continue;
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
continue; /* skip self and parent */
if (!number_files) {
char *temp1 = strstr(dp->d_name, "-");
char *temp2 = strstr(dp->d_name, ".");
+ if (temp1 == NULL || temp2 == NULL) {
+ fprintf(stderr, "\t\tCannot find test format\n");
+ closedir(fd);
+ return 0;
+ }
+
strncpy(temp_filename, dp->d_name, strlen(dp->d_name) - strlen(temp1));
strncpy(file_format, temp2, strlen(temp2));
}