summaryrefslogtreecommitdiff
path: root/navit/map
diff options
context:
space:
mode:
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-06-07 19:28:00 +0000
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-06-07 19:28:00 +0000
commit94b7ddf91f3bc0205326dad49ec9abfa41cecf3e (patch)
tree7bea63ce1f652a94f155cdb6cc3c14ffa03010ad /navit/map
parent56fef9d2bf77afa909bd756e7cd38d83cf966c8d (diff)
downloadnavit-94b7ddf91f3bc0205326dad49ec9abfa41cecf3e.tar.gz
Fix:core:Fixed crashes after downloading map data
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4515 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map')
-rw-r--r--navit/map/binfile/binfile.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c
index d7c5bda82..52bcccf5b 100644
--- a/navit/map/binfile/binfile.c
+++ b/navit/map/binfile/binfile.c
@@ -1042,14 +1042,14 @@ download_start(struct map_download *download)
download->cd_copy=g_malloc(download->m->cde_size);
memcpy(download->cd_copy, download->cd, download->m->cde_size);
}
- file_data_free(download->file, (unsigned char *)download->cd);
+ file_data_remove(download->file, (unsigned char *)download->cd);
download->cd=NULL;
offset=file_size(download->file);
offset-=sizeof(struct zip_eoc);
eoc=(struct zip_eoc *)file_data_read(download->file, offset, sizeof(struct zip_eoc));
download->zip_eoc=g_malloc(sizeof(struct zip_eoc));
memcpy(download->zip_eoc, eoc, sizeof(struct zip_eoc));
- file_data_free(download->file, (unsigned char *)eoc);
+ file_data_remove(download->file, (unsigned char *)eoc);
download->start_offset=download->offset=offset;
return download_request(download);
}
@@ -1090,21 +1090,22 @@ download_finish(struct map_download *download)
struct zip_lfh *lfh;
char *lfh_filename;
struct zip_cd_ext *ext;
-
+ long long lfh_offset;
file_data_write(download->file, download->offset, sizeof(struct zip_eoc), (void *)download->zip_eoc);
lfh=(struct zip_lfh *)(file_data_read(download->file,download->start_offset, sizeof(struct zip_lfh)));
ext=binfile_cd_ext(download->cd_copy);
- if (ext)
+ if (ext)
ext->zipofst=download->start_offset;
else
download->cd_copy->zipofst=download->start_offset;
download->cd_copy->zipcsiz=lfh->zipsize;
download->cd_copy->zipcunc=lfh->zipuncmp;
download->cd_copy->zipccrc=lfh->zipcrc;
- lfh_filename=(char *)file_data_read(download->file,binfile_cd_offset(download->cd_copy)+sizeof(struct zip_lfh),lfh->zipfnln);
+ lfh_offset = binfile_cd_offset(download->cd_copy)+sizeof(struct zip_lfh);
+ lfh_filename=(char *)file_data_read(download->file,lfh_offset,lfh->zipfnln);
memcpy(download->cd_copy+1,lfh_filename,lfh->zipfnln);
- file_data_free(download->file,(void *)lfh_filename);
- file_data_free(download->file,(void *)lfh);
+ file_data_remove(download->file,(void *)lfh_filename);
+ file_data_remove(download->file,(void *)lfh);
file_data_write(download->file, download->m->eoc->zipeofst + download->zipfile*download->m->cde_size, binfile_cd_extra(download->cd_copy)+sizeof(struct zip_cd), (void *)download->cd_copy);
file_data_flush(download->file, download->m->eoc->zipeofst + download->zipfile*download->m->cde_size, sizeof(struct zip_cd));