Changeset 3296
- Timestamp:
- 04/27/08 14:51:58 (3 months ago)
- Files:
-
- trunk/wrapper/opensync-helper.i (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wrapper/opensync-helper.i
r3167 r3296 26 26 27 27 ~HashTable() { 28 osync_hashtable_ free(self);28 osync_hashtable_unref(self); 29 29 } 30 30 31 void reset_reports() { 32 osync_hashtable_reset_reports(self); 33 } 31 bool load() { 32 Error *err = NULL; 33 osync_hashtable_load(self, &err); 34 35 if (raise_exception_on_error(err)) 36 return FALSE; 37 38 return TRUE; 39 } 40 41 bool save() { 42 Error *err = NULL; 43 osync_hashtable_save(self, &err); 44 45 if (raise_exception_on_error(err)) 46 return FALSE; 47 48 return TRUE; 49 } 34 50 35 51 bool slowsync() { … … 47 63 } 48 64 49 /* returns a tuple of (uid, hash) strings */ 50 PyObject *nth_entry(int nth) { 51 char *uid, *hash; 52 53 if (!osync_hashtable_nth_entry(self, nth, &uid, &hash)) { 54 wrapper_exception("osync_hashtable_nth_entry failed"); 55 return NULL; 56 } 57 58 return Py_BuildValue("(ss)", uid, hash); 59 } 60 61 void write(const char *uid, const char *hash) { 62 osync_hashtable_write(self, uid, hash); 63 } 64 65 void delete(const char *uid) { 66 osync_hashtable_delete(self, uid); 67 } 68 69 void update_hash(ChangeType type, const char *uid, const char *hash) { 70 osync_hashtable_update_hash(self, type, uid, hash); 71 } 72 73 void report(const char *uid) { 74 osync_hashtable_report(self, uid); 65 void update_change(Change *change) { 66 osync_hashtable_update_change(self, change); 75 67 } 76 68 77 69 /* returns a list of deleted UIDs as strings */ 78 70 PyObject *get_deleted() { 79 char **uids = osync_hashtable_get_deleted(self);71 OSyncList *uids = osync_hashtable_get_deleted(self); 80 72 if (uids == NULL) { 81 73 wrapper_exception("osync_hashtable_get_deleted failed"); … … 86 78 if (ret != NULL) { 87 79 int i; 88 for (i = 0; uids[i] != NULL; i++) { 89 PyObject *item = PyString_FromString(uids[i]); 80 OSyncList *u; 81 for (u = uids; u; u = u->next) { 82 char *uid = u->data; 83 PyObject *item = PyString_FromString(uid); 90 84 if (item == NULL || PyList_Append(ret, item) != 0) { 91 85 Py_XDECREF(item); … … 97 91 } 98 92 99 free(uids);100 93 return ret; 101 94 } 102 95 103 ChangeType get_changetype( const char *uid, const char *hash) {104 return osync_hashtable_get_changetype(self, uid, hash);96 ChangeType get_changetype(Change *change) { 97 return osync_hashtable_get_changetype(self, change); 105 98 } 106 99
