aboutsummaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-02 13:47:39 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-02 13:47:39 +0000
commit49b0bf4c38f7b2ecdb25b138abc8aa5ff06267c4 (patch)
tree012dfcf4fcdc04870b829483c6d7913cfff9ef32 /src/cache.c
parentb819cd1defe15f492cd313129832383bf37ca82b (diff)
DirAx stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@139 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/cache.c b/src/cache.c
index 078fa72..ad47ca2 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -41,10 +41,10 @@ ReflectionList *cache_load(const char *filename) {
reflectionlist = reflectionlist_new();
f = fopen(filename, "rb");
if ( !f ) {
- fprintf(stderr, "Couldn't read reflections from cache\n");
+ fprintf(stderr, "Couldn't open cache file\n");
}
if ( fread(&ch, sizeof(CacheHeader), 1, f) == 0 ) {
- fprintf(stderr, "Couldn't read reflections from cache\n");
+ fprintf(stderr, "Couldn't read cache header\n");
fclose(f);
return NULL;
}
@@ -58,7 +58,7 @@ ReflectionList *cache_load(const char *filename) {
fprintf(stderr, "Couldn't read reflections from cache\n");
fclose(f);
free(cr);
- reflection_clear(reflectionlist);
+ reflectionlist_clear(reflectionlist);
return NULL;
}
@@ -129,9 +129,13 @@ unsigned int cache_is_cachefile(const char *filename) {
size_t nread;
fh = fopen(filename, "rb");
+ if ( !fh ) {
+ printf("Couldn't open file '%s'\n", filename);
+ return 0;
+ }
nread = fread(&ch, sizeof(CacheHeader), 1, fh);
fclose(fh);
-
+
if ( nread != 1 ) {
return 0;
}
@@ -140,11 +144,6 @@ unsigned int cache_is_cachefile(const char *filename) {
return 1;
}
- /* Backwards compatability */
- if ( strncmp(ch.top, "DTR-CACHE", 9) == 0 ) {
- return 1;
- }
-
return 0;
}