}
DIR *dir;
- struct dirent ent;
struct dirent *dent;
if ((dir = opendir(in_file_name)) != NULL) {
char file_path[1024] = "";
/* Traverses all the files and directories within source directory */
- while (!readdir_r(dir, &ent, &dent) && dent) {
- /* Determine current entry name */
- const char *file_name = ent.d_name;
-
+ while ((dent = readdir(dir))) {
/* If current entry is directory, or hidden object, skip the step: */
- if (file_name[0] == '.')
+ if (strcmp(dent->d_name, ".") != 0)
continue;
- snprintf(file_path, 1024, "%s/%s", in_file_name, file_name);
+ snprintf(file_path, 1024, "%s/%s", in_file_name, dent->d_name);
err = add_single_example(model, file_path, NULL, &face_label);
if (MEDIA_VISION_ERROR_NONE != err) {
for (i = 0; i < dir_n; ++i) {
DIR *dir;
- struct dirent ent;
struct dirent *dent;
printf("Processing %s...\n", directories[i]);
if ((dir = opendir(directories[i])) != NULL) {
char file_path[1024] = "";
/* Traverses all the files and directories within source directory */
- while (!readdir_r(dir, &ent, &dent) && dent) {
- /* Determine current entry name */
- const char *file_name = ent.d_name;
-
+ while ((dent = readdir(dir))) {
/* If current entry is directory, or hidden object, skip the step: */
- if (file_name[0] == '.')
+ if (strcmp(dent->d_name, ".") != 0)
continue;
- snprintf(file_path, 1024, "%s/%s", directories[i], file_name);
+ snprintf(file_path, 1024, "%s/%s", directories[i], dent->d_name);
err = load_mv_source_from_file(file_path, source);
if (MEDIA_VISION_ERROR_NONE != err) {
printf(TEXT_RED "Failed to test on example from %s. "
"Example will not affect the evaluation. "
- "Error code: %i.\n" TEXT_RESET,
+ "Error code: %i\n" TEXT_RESET,
file_path, err);
} else {
err = mv_face_recognize(source, model, NULL, NULL, evaluation_cb, &(labels[i]));
const int err = mv_source_fill_by_buffer(
source,
- buffer,
+ (unsigned char*)buffer,
buffer_size,
image_data.image_width,
image_data.image_height,
err = mv_source_fill_by_buffer(
source,
- buffer,
+ (unsigned char*)buffer,
buffer_size,
image_data.image_width,
image_data.image_height,
int frame_idx;
int err = MEDIA_VISION_ERROR_NONE;
int frames_counter = 0;
- char (*frames)[FILE_PATH_SIZE] = (char **)malloc(0);
+ char (*frames)[FILE_PATH_SIZE] = malloc(0);
- int ret = 0;
- struct dirent ent;
struct dirent *ent_eof;
DIR *dir = opendir(track_target_file_name);
return MEDIA_VISION_ERROR_INVALID_PATH;
}
- while ((ret = readdir_r(dir, &ent, &ent_eof)) == 0 && ent_eof != NULL) {
- if (ent.d_name[0] == '.' || strlen(ent.d_name) < 4)
+ while ((ent_eof = readdir(dir))) {
+ if (ent_eof->d_name[0] == '.' || strlen(ent_eof->d_name) < 4)
continue;
- if (strcmp(".jpg", ent.d_name + strlen(ent.d_name) -4) != 0)
+ if (strcmp(".jpg", ent_eof->d_name + strlen(ent_eof->d_name) -4) != 0)
continue;
frames_counter++;
- frames = (char **) realloc(frames, frames_counter * FILE_PATH_SIZE);
+ frames = realloc(frames, frames_counter * FILE_PATH_SIZE);
snprintf(frames[frames_counter -1], FILE_PATH_SIZE, "%s/%s",
- track_target_file_name, ent.d_name);
+ track_target_file_name, ent_eof->d_name);
}
closedir(dir);