removed tmppath usage, we just strcmp path here anyway,

no need to truncate.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11889 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2009-03-23 07:53:09 +00:00
parent bf734919c5
commit bce4c3aa74

View File

@@ -138,7 +138,6 @@ static int folder_list_func(CameraFilesystem *fs, const char *folder,
/* Walk through all of the pictures building a list of folders */
for (i = 0; i < camera->pl->num_pictures; i++) {
int found;
char tmppath[PATH_MAX + 1];
char *path;
/* Check to make sure the path matches the folder we're */
@@ -159,22 +158,19 @@ static int folder_list_func(CameraFilesystem *fs, const char *folder,
if (strchr(path, '/') != path + strlen(path) - 1)
continue;
strncpy(tmppath, path, MIN(strlen(path) - 1, PATH_MAX));
tmppath[strlen(path) - 1] = 0;
found = 0;
for (i1 = 0; i1 < gp_list_count(list); i1++) {
const char *name;
gp_list_get_name(list, i1, &name);
if (!strcmp(name, tmppath)) {
if (!strcmp(name, path)) {
found = 1;
break;
}
}
if (!found)
gp_list_append(list, tmppath, NULL);
gp_list_append(list, path, NULL);
}
return GP_OK;