Merge lp:~jameinel/u1db/gcc_warning_int into lp:u1db

Proposed by John A Meinel
Status: Merged
Merged at revision: 279
Proposed branch: lp:~jameinel/u1db/gcc_warning_int
Merge into: lp:u1db
Diff against target: 21 lines (+2/-2)
1 file modified
src/u1db_sync_target.c (+2/-2)
To merge this branch: bzr merge lp:~jameinel/u1db/gcc_warning_int
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Review via email: mp+105778@code.launchpad.net

Description of the change

Small tweak to use intptr_t instead of void * as the integer type used for storing the current generation.

If we ever get >2**31 generations we're going to have other problems, so we don't really need 64-bit safe values, but this keeps gcc from complaining.

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/u1db_sync_target.c'
2--- src/u1db_sync_target.c 2012-04-30 11:37:13 +0000
3+++ src/u1db_sync_target.c 2012-05-15 09:12:19 +0000
4@@ -272,7 +272,7 @@
5 status = u1db_put_doc_if_newer(se->db, doc, 0, se->source_replica_uid,
6 source_gen, &insert_state, &at_gen);
7 if (insert_state == U1DB_INSERTED || insert_state == U1DB_CONVERGED) {
8- lh_table_insert(se->seen_ids, strdup(doc->doc_id), (void *)at_gen);
9+ lh_table_insert(se->seen_ids, strdup(doc->doc_id), (void *)(intptr_t)at_gen);
10 } else {
11 // state should be either U1DB_SUPERSEDED or U1DB_CONFLICTED, in either
12 // case, we don't count this as a 'seen_id' because we will want to be
13@@ -301,7 +301,7 @@
14 state = (struct _whats_changed_doc_ids_state *)context;
15 if (state->exclude_ids != NULL
16 && (e = lh_table_lookup_entry(state->exclude_ids, doc_id)) != NULL
17- && (int)e->v >= gen)
18+ && (intptr_t)e->v >= gen)
19 {
20 // This document was already seen at this gen,
21 // so we don't need to return it

Subscribers

People subscribed via source and target branches