static GList *generate_list(SlideShowData *ss)
{
- GList *list = NULL;
+ GList *list = nullptr;
if (ss->from_selection)
{
{
GPtrArray *arr = g_ptr_array_sized_new(g_list_length(src_list));
- g_list_foreach(src_list, (GFunc) ptr_array_add, arr);
+ g_list_foreach(src_list, reinterpret_cast<GFunc>(ptr_array_add), arr);
return arr;
}
guint i;
for (i = 0; i < array->len; ++i)
{
- guint p = (double)rand() / ((double)RAND_MAX + 1.0) * array->len;
+ guint p = static_cast<double>(rand()) / (static_cast<double>(RAND_MAX) + 1.0) * array->len;
swap(array, i, p);
}
}
{
GList *src_list;
GPtrArray *src_array;
- GList *list = NULL;
+ GList *list = nullptr;
src_list = generate_list(ss);
src_array = generate_ptr_array_from_list(src_list);
g_list_free(src_list);
ptr_array_random_shuffle(src_array);
- g_ptr_array_foreach(src_array, (GFunc) list_prepend, &list);
+ g_ptr_array_foreach(src_array, reinterpret_cast<GFunc>(list_prepend), &list);
g_ptr_array_free(src_array, TRUE);
return list;
if (ss->list_done)
{
g_list_free(ss->list_done);
- ss->list_done = NULL;
+ ss->list_done = nullptr;
}
if (ss->list) g_list_free(ss->list);
else
imd_fd = image_get_fd(ss->imd);
- if ( ((imd_fd == NULL) != (ss->slide_fd == NULL)) ||
+ if ( ((imd_fd == nullptr) != (ss->slide_fd == nullptr)) ||
(imd_fd && ss->slide_fd && imd_fd != ss->slide_fd) ) return FALSE;
if (ss->filelist) return TRUE;
{
if (g_list_length(ss->cd->list) == ss->slide_count)
return TRUE;
- else
- return FALSE;
+
+ return FALSE;
}
dir_fd = ss->lw->dir_fd;
if (dir_fd && ss->dir_fd && dir_fd == ss->dir_fd)
{
- if (ss->from_selection && ss->slide_count == layout_selection_count(ss->lw, NULL)) return TRUE;
- if (!ss->from_selection && ss->slide_count == layout_list_count(ss->lw, NULL)) return TRUE;
+ if (ss->from_selection && ss->slide_count == layout_selection_count(ss->lw, nullptr)) return TRUE;
+ if (!ss->from_selection && ss->slide_count == layout_list_count(ss->lw, nullptr)) return TRUE;
}
return FALSE;
}
file_data_unref(ss->slide_fd);
- ss->slide_fd = NULL;
+ ss->slide_fd = nullptr;
if (ss->filelist)
{
if (ss->from_selection)
{
layout_set_fd(ss->lw, ss->slide_fd);
- layout_status_update_info(ss->lw, NULL);
+ layout_status_update_info(ss->lw, nullptr);
}
else
{
if (ss->filelist)
{
- image_prebuffer_set(ss->imd, g_list_nth_data(ss->filelist, r));
+ image_prebuffer_set(ss->imd, static_cast<FileData *>(g_list_nth_data(ss->filelist, r)));
}
else if (ss->cd)
{
static gboolean slideshow_loop_cb(gpointer data)
{
- SlideShowData *ss = static_cast<SlideShowData *>(data);
+ auto ss = static_cast<SlideShowData *>(data);
if (ss->paused) return TRUE;
SlideShowData *ss;
gint start_index = -1;
- if (!filelist && !cd && layout_list_count(target_lw, NULL) < 1) return NULL;
+ if (!filelist && !cd && layout_list_count(target_lw, nullptr) < 1) return nullptr;
ss = g_new0(SlideShowData, 1);
{
/* layout method */
- ss->slide_count = layout_selection_count(ss->lw, NULL);
+ ss->slide_count = layout_selection_count(ss->lw, nullptr);
ss->dir_fd = file_data_ref(ss->lw->dir_fd);
if (ss->slide_count < 2)
{
- ss->slide_count = layout_list_count(ss->lw, NULL);
- if (!options->slideshow.random && start_point >= 0 && (guint) start_point < ss->slide_count)
+ ss->slide_count = layout_list_count(ss->lw, nullptr);
+ if (!options->slideshow.random && start_point >= 0 && static_cast<guint>(start_point) < ss->slide_count)
{
start_index = start_point;
}
else
{
slideshow_free(ss);
- ss = NULL;
+ ss = nullptr;
}
return ss;
SlideShowData *slideshow_start_from_filelist(LayoutWindow *target_lw, ImageWindow *imd, GList *list,
void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data)
{
- return real_slideshow_start(target_lw, imd, list, -1, NULL, NULL, stop_func, stop_data);
+ return real_slideshow_start(target_lw, imd, list, -1, nullptr, nullptr, stop_func, stop_data);
}
SlideShowData *slideshow_start_from_collection(LayoutWindow *target_lw, ImageWindow *imd, CollectionData *cd,
void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data,
CollectInfo *start_info)
{
- return real_slideshow_start(target_lw, imd, NULL, -1, cd, start_info, stop_func, stop_data);
+ return real_slideshow_start(target_lw, imd, nullptr, -1, cd, start_info, stop_func, stop_data);
}
SlideShowData *slideshow_start(LayoutWindow *lw, gint start_point,
void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data)
{
- return real_slideshow_start(lw, NULL, NULL, start_point, NULL, NULL, stop_func, stop_data);
+ return real_slideshow_start(lw, nullptr, nullptr, start_point, nullptr, nullptr, stop_func, stop_data);
}
gboolean slideshow_paused(SlideShowData *ss)