Commit 6db37418 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder
Browse files

Drop 24 bogus casts.

2001-03-02  Morten Welinder  <terra@diku.dk>

	* src/ranges.h: Drop 24 bogus casts.

	* src/ranges.c (range_transpose): Drop extraneous &.
	(range_fragment_list_clip): Fix to work with new src/ranges.h
parent b7646c76
2001-03-02 Morten Welinder <terra@diku.dk>
* src/ranges.h: Drop 24 bogus casts.
* src/ranges.c (range_transpose): Drop extraneous &.
(range_fragment_list_clip): Fix to work with new src/ranges.h
2001-03-01 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (cb_sheet_remove) : rename from
......
2001-03-02 Morten Welinder <terra@diku.dk>
* src/ranges.h: Drop 24 bogus casts.
* src/ranges.c (range_transpose): Drop extraneous &.
(range_fragment_list_clip): Fix to work with new src/ranges.h
2001-03-01 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (cb_sheet_remove) : rename from
......
2001-03-02 Morten Welinder <terra@diku.dk>
* src/ranges.h: Drop 24 bogus casts.
* src/ranges.c (range_transpose): Drop extraneous &.
(range_fragment_list_clip): Fix to work with new src/ranges.h
2001-03-01 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (cb_sheet_remove) : rename from
......
2001-03-02 Morten Welinder <terra@diku.dk>
* src/ranges.h: Drop 24 bogus casts.
* src/ranges.c (range_transpose): Drop extraneous &.
(range_fragment_list_clip): Fix to work with new src/ranges.h
2001-03-01 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (cb_sheet_remove) : rename from
......
2001-03-02 Morten Welinder <terra@diku.dk>
* src/ranges.h: Drop 24 bogus casts.
* src/ranges.c (range_transpose): Drop extraneous &.
(range_fragment_list_clip): Fix to work with new src/ranges.h
2001-03-01 Jody Goldberg <jgoldberg@home.com>
* src/workbook-control-gui.c (cb_sheet_remove) : rename from
......
......@@ -814,19 +814,21 @@ range_fragment_list_clip (const GList *ra, const Range *clip)
for (a = ranges; a; a = nexta) {
GList *b, *nextb;
gboolean done_split = FALSE;
Range *ra = a->data;
for (b = a->next; b && !done_split; b = nextb) {
Range *rb = b->data;
nextb = b->next;
if (range_equal (a->data, b->data)) {
g_free (b->data);
if (g_list_remove (ranges, b->data) != ranges)
if (range_equal (ra, rb)) {
g_free (rb);
if (g_list_remove (ranges, rb) != ranges)
g_error ("Impossible overwrite");
} else if (range_overlap (a->data, b->data)) {
} else if (range_overlap (ra, rb)) {
GList *split;
split = range_fragment (a->data, b->data);
split = range_fragment (ra, rb);
g_assert (split);
if (g_list_concat (ranges, split) != ranges)
......@@ -839,8 +841,8 @@ range_fragment_list_clip (const GList *ra, const Range *clip)
nexta = a->next;
if (done_split) {
g_free (a->data);
ranges = g_list_remove (ranges, a->data);
g_free (ra);
ranges = g_list_remove (ranges, ra);
if (b == nexta)
nexta = b->next;
......@@ -1173,7 +1175,7 @@ range_transpose (Range *range, const CellPos *origin)
}
range->end.row = t;
g_assert (range_valid (&range));
g_assert (range_valid (range));
return clipped;
}
......
......@@ -12,10 +12,10 @@
*
* Returns: True if both ranges are equal.
**/
#define range_equal(a,b) (((Range *)(a))->start.row == ((Range *)(b))->start.row && \
((Range *)(a))->end.row == ((Range *)(b))->end.row && \
((Range *)(a))->start.col == ((Range *)(b))->start.col && \
((Range *)(a))->end.col == ((Range *)(b))->end.col)
#define range_equal(a,b) ((a)->start.row == (b)->start.row && \
(a)->end.row == (b)->end.row && \
(a)->start.col == (b)->start.col && \
(a)->end.col == (b)->end.col)
/**
* range_overlap:
......@@ -26,10 +26,10 @@
*
* Returns: True if the ranges overlap at all.
**/
#define range_overlap(a,b) ((((Range *)(a))->end.row >= ((Range *)(b))->start.row) && \
(((Range *)(b))->end.row >= ((Range *)(a))->start.row) && \
(((Range *)(a))->end.col >= ((Range *)(b))->start.col) && \
(((Range *)(b))->end.col >= ((Range *)(a))->start.col))
#define range_overlap(a,b) (((a)->end.row >= (b)->start.row) && \
((b)->end.row >= (a)->start.row) && \
((a)->end.col >= (b)->start.col) && \
((b)->end.col >= (a)->start.col))
/**
* range_contains:
......@@ -41,16 +41,16 @@
*
* Return value: TRUE if co-ordinate contained.
**/
#define range_contains(r,x,y) (((y) <= ((Range *)(r))->end.row) && \
((y) >= ((Range *)(r))->start.row) && \
((x) >= ((Range *)(r))->start.col) && \
((x) <= ((Range *)(r))->end.col))
#define range_contains(r,x,y) (((y) <= ((r))->end.row) && \
((y) >= ((r))->start.row) && \
((x) >= ((r))->start.col) && \
((x) <= ((r))->end.col))
/*
* Quickly Test if a range is valid
*/
#define range_valid(r) (((Range *)(r))->start.col <= ((Range *)(r))->end.col && \
((Range *)(r))->start.row <= ((Range *)(r))->end.row)
#define range_valid(r) (((r))->start.col <= ((r))->end.col && \
((r))->start.row <= ((r))->end.row)
Range *range_init_full_sheet (Range *r);
Range *range_init (Range *r, int start_col, int start_row,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment