I fixed most of the things, you talked about, but am not completely done. Will send the corrected patches, if everything is fixed (hopefully), probably this week.
Am 06.11.2012, 00:51 Uhr, schrieb Michael Karcher <Michael.Karcher@fu-berlin.de>:
| From e096e749587e50da5c72bb0afa7da5bbd0e1c725 Mon Sep 17 00:00:00 2001 | From: Kevin Chabowski <kevin@kch42.de> | Date: Mon, 22 Oct 2012 21:43:35 +0200 | Subject: [PATCH 07/16] himd_set_track_label implemented This patch definitely does not pass quality control. While you describe being able to change existing labels, and it appears to work fine at the beginning, you are leaking HiMD strings. The 14-byte string fragments that are unused are organized in a linked freelist.
I am not really sure, if I am doing The Right Thing here...I have now written a function, that will delete a string properly, i.e. append all string chunks to the freelist, before creating and assigning a new string:
| int himd_delete_string(struct himd * himd, unsigned int idx, | struct himderrinfo * status) | { | unsigned char* cur_strchunk = NULL; | unsigned char* freelist_head = NULL; | unsigned int tmpidx; | gboolean first = TRUE; | | g_return_val_if_fail(idx != 0, -1); | | freelist_head = get_strchunk(himd, 0); | | while(idx > 0) /* idx == 0 --> End of string */ | { | cur_strchunk = get_strchunk(himd, idx); || if((!first) && (strtype(cur_strchunk) != STRING_TYPE_CONTINUATION))
| { | set_status_printf(status, HIMD_ERROR_STRING_CHAIN_BROKEN,| "String slot %d has type %d, should be %d\n",
| idx, strtype(cur_strchunk), | STRING_TYPE_CONTINUATION); | return -1; | } | | tmpidx = idx; | idx = strlink(cur_strchunk); | | /* Mark current chunk as unused */ | set_strtype(cur_strchunk, STRING_TYPE_UNUSED); | /* Insert at beginning of freelist */ | set_strlink(cur_strchunk, strlink(freelist_head)); | set_strlink(freelist_head, tmpidx); | | first = 0; | } | | return 0; | } Kevin