summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-21 13:32:37 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-21 13:32:37 +0000
commitccaf55a8ae707951d9e91a799bfa05970df829c9 (patch)
treed426d0aebe077a648d6c8e1a2024d57647729dd3
parentdf448bf7a192322ced589f375496f8c17f706111 (diff)
downloadrockbox-ccaf55a8ae707951d9e91a799bfa05970df829c9.tar.gz
rockbox-ccaf55a8ae707951d9e91a799bfa05970df829c9.zip
fix FIX_PTR macro so it actually fixes every pointer (was skipping x == current case)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30577 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/tree.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 8f2e91222a..d275c6501c 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -190,7 +190,7 @@ static int move_callback(int handle, void* current, void* new)
190 (void)handle; 190 (void)handle;
191 size_t diff = new - current; 191 size_t diff = new - current;
192#define FIX_PTR(x) \ 192#define FIX_PTR(x) \
193 { if ((void*)x > current && (void*)x < (current+strdup_bufsize)) x+= diff; } 193 { if ((void*)x >= current && (void*)x < (current+strdup_bufsize)) x+= diff; }
194 for(int i = 0; i < filetype_count; i++) 194 for(int i = 0; i < filetype_count; i++)
195 { 195 {
196 FIX_PTR(filetypes[i].extension); 196 FIX_PTR(filetypes[i].extension);
diff --git a/apps/tree.c b/apps/tree.c
index ca4c567235..2fcaba74a5 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1019,7 +1019,7 @@ static int move_callback(int handle, void* current, void* new)
1019 size_t diff = new - current; 1019 size_t diff = new - current;
1020 /* FIX_PTR makes sure to not accidentally update static allocations */ 1020 /* FIX_PTR makes sure to not accidentally update static allocations */
1021#define FIX_PTR(x) \ 1021#define FIX_PTR(x) \
1022 { if ((void*)x > current && (void*)x < (current+cache->name_buffer_size)) x+= diff; } 1022 { if ((void*)x >= current && (void*)x < (current+cache->name_buffer_size)) x+= diff; }
1023 1023
1024 if (handle == cache->name_buffer_handle) 1024 if (handle == cache->name_buffer_handle)
1025 { /* update entry structs, *even if they are struct tagentry */ 1025 { /* update entry structs, *even if they are struct tagentry */