#include "collect-table.h"
#include <cstddef>
+#include <utility>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
gint col1;
gint row2;
gint col2;
- gint t;
gint i;
gint j;
if (row2 < row1)
{
- t = row1;
- row1 = row2;
- row2 = t;
+ std::swap(row1, row2);
}
if (col2 < col1)
{
- t = col1;
- col1 = col2;
- col2 = t;
+ std::swap(col1, col2);
}
DEBUG_1("table: %d x %d to %d x %d", row1, col1, row2, col2);
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include <utility>
#include <glib-object.h>
guint random;
guint length;
guint i;
- gpointer tmp;
GList *nlist;
GList *olist;
random = static_cast<guint>(1.0 * length * rand()/(RAND_MAX + 1.0));
olist = g_list_nth(list, i);
nlist = g_list_nth(list, random);
- tmp = olist->data;
- olist->data = nlist->data;
- nlist->data = tmp;
+ std::swap(olist->data, nlist->data);
}
return list;
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include <utility>
#include <glib-object.h>
#include <grp.h>
gint ret;
if (!filelist_sort_ascend)
{
- FileData *tmp = fa;
- fa = fb;
- fb = tmp;
+ std::swap(fa, fb);
}
switch (filelist_sort_method)
#include <unistd.h>
#include <cstring>
+#include <utility>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
if (!layout_location_vertical(static_cast<LayoutLocation>(priority_location)))
{
- GtkWidget *tmp;
-
- tmp = v;
- v = h;
- h = tmp;
+ std::swap(v, h);
}
gq_gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0);
#include <cmath>
#include <cstdlib>
#include <cstring>
+#include <utility>
#include <cairo.h>
#include <gio/gio.h>
gint slope1_x;
gint slope1_y;
gint y;
- gint t;
gboolean middle = FALSE;
if (!pb) return;
if (y1 > y2)
{
- t = x1; x1 = x2; x2 = t;
- t = y1; y1 = y2; y2 = t;
+ std::swap(x1, x2);
+ std::swap(y1, y2);
}
if (y2 > y3)
{
- t = x2; x2 = x3; x3 = t;
- t = y2; y2 = y3; y3 = t;
+ std::swap(x2, x3);
+ std::swap(y2, y3);
}
if (y1 > y2)
{
- t = x1; x1 = x2; x2 = t;
- t = y1; y1 = y2; y2 = t;
+ std::swap(x1, x2);
+ std::swap(y1, y2);
}
slope1 = static_cast<gdouble>(y2 - y1);
if (xa > xb)
{
- t = xa; xa = xb; xb = t;
+ std::swap(xa, xb);
}
xa = CLAMP(xa, fx1, fx2);
if (x1 > x2)
{
- gdouble t;
-
- t = x1; x1 = x2; x2 = t;
- t = y1; y1 = y2; y2 = t;
+ std::swap(x1, x2);
+ std::swap(y1, y2);
flip = TRUE;
}
}
else
{
- gdouble t;
-
if (y1 < clip_y || y2 > clip_y + clip_h) return FALSE;
- t = x1; x1 = x2; x2 = t;
- t = y1; y1 = y2; y2 = t;
+ std::swap(x1, x2);
+ std::swap(y1, y2);
flip = !flip;
}
{
if (rx1 > rx2)
{
- gdouble t;
- t = rx1; rx1 = rx2; rx2 = t;
- t = ry1; ry1 = ry2; ry2 = t;
+ std::swap(rx1, rx2);
+ std::swap(ry1, ry2);
}
slope = rx2 - rx1;
{
if (ry1 > ry2)
{
- gdouble t;
- t = rx1; rx1 = rx2; rx2 = t;
- t = ry1; ry1 = ry2; ry2 = t;
+ std::swap(rx1, rx2);
+ std::swap(ry1, ry2);
}
slope = ry2 - ry1;
#include <cmath>
#include <cstdlib>
#include <cstring>
+#include <utility>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
switch (orientation)
{
- gdouble tmp;
case EXIF_ORIENTATION_LEFT_TOP:
case EXIF_ORIENTATION_RIGHT_TOP:
case EXIF_ORIENTATION_RIGHT_BOTTOM:
case EXIF_ORIENTATION_LEFT_BOTTOM:
- tmp = scale_x;
- scale_x = scale_y;
- scale_y = tmp;
+ std::swap(scale_x, scale_y);
break;
default:
/* nothing to do */
#include "slideshow.h"
#include <cstdlib>
+#include <utility>
#include "collect.h"
#include "filedata.h"
return arr;
}
-static void swap(GPtrArray *array, guint index1, guint index2)
-{
- gpointer temp = g_ptr_array_index(array, index1);
-
- g_ptr_array_index(array, index1) = g_ptr_array_index(array, index2);
- g_ptr_array_index(array, index2) = temp;
-}
-
static void ptr_array_random_shuffle(GPtrArray *array)
{
guint i;
for (i = 0; i < array->len; ++i)
{
guint p = static_cast<double>(rand()) / (static_cast<double>(RAND_MAX) + 1.0) * array->len;
- swap(array, i, p);
+ std::swap(g_ptr_array_index(array, i), g_ptr_array_index(array, p));
}
}
#include "view-file-icon.h"
#include <cstring>
+#include <utility>
#include <glib-object.h>
gint col1;
gint row2;
gint col2;
- gint t;
gint i;
gint j;
if (g_list_index(vf->list, start) > g_list_index(vf->list, end))
{
- FileData *tmp = start;
- start = end;
- end = tmp;
+ std::swap(start, end);
}
work = g_list_find(vf->list, start);
// rectangular_selection==true.
if (row2 < row1)
{
- t = row1;
- row1 = row2;
- row2 = t;
+ std::swap(row1, row2);
}
if (col2 < col1)
{
- t = col1;
- col1 = col2;
- col2 = t;
+ std::swap(col1, col2);
}
DEBUG_1("table: %d x %d to %d x %d", row1, col1, row2, col2);