Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_list_set_name ( CameraList list,
int  index,
const char *  name 
)

Sets the name of an entry.

Parameters:
list a CameraList
index index of entry
name name to be set
Returns:
a gphoto2 error code

Definition at line 446 of file gphoto2-list.c.

References CHECK_LIST, CHECK_NULL, GP_ERROR_FIXED_LIMIT_EXCEEDED, gp_log(), GP_LOG_ERROR, and GP_OK.

{
      CHECK_LIST (list);
      CHECK_NULL (name);
      CHECK_INDEX_RANGE (list, index);

      do {
            /* check that the value fits */
            const size_t buf_len = sizeof (list->entry[index].name);
            const size_t str_len = strlen (name);
            if (str_len >= buf_len) {
                  gp_log (GP_LOG_ERROR, "gphoto2-list", 
                        "gp_list_append: "
                        "'name' value too long (%d >= %d)",
                        str_len, buf_len);
                  return (GP_ERROR_FIXED_LIMIT_EXCEEDED);
            }
      } while (0);

      /* set the value */
      strcpy (list->entry[index].name, name);

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index