From 84d9380f5dd7348b64c46dce0a86fb7e52d1707d Mon Sep 17 00:00:00 2001 From: short <> Date: Sat, 13 Sep 2003 06:00:53 +0000 Subject: [PATCH] Cosmetic: captive_shared_cache_map_get_ref(): 'CallBacks' can be 'const'. captive_shared_cache_map_set_data_valid(): Validate last FileSize-matching page. --- src/libcaptive/cc/sharedcachemap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libcaptive/cc/sharedcachemap.c b/src/libcaptive/cc/sharedcachemap.c index 9f917a6..f1b925e 100644 --- a/src/libcaptive/cc/sharedcachemap.c +++ b/src/libcaptive/cc/sharedcachemap.c @@ -254,7 +254,7 @@ static void captive_shared_cache_map_object_purge(CaptiveSharedCacheMapObject *c } CaptiveSharedCacheMapObject *captive_shared_cache_map_get_ref(FILE_OBJECT *FileObject, - const CC_FILE_SIZES *FileSizes,BOOLEAN PinAccess,CACHE_MANAGER_CALLBACKS *CallBacks,VOID *LazyWriterContext) + const CC_FILE_SIZES *FileSizes,BOOLEAN PinAccess,const CACHE_MANAGER_CALLBACKS *CallBacks,VOID *LazyWriterContext) { CaptiveSharedCacheMapObject *captive_shared_cache_map_object; @@ -273,6 +273,7 @@ CaptiveSharedCacheMapObject *captive_shared_cache_map_object; /* FIXME: When to drop SharedCacheMap? * Currently we never close it. + * Fix also CcZeroData() workaround. */ g_object_ref(captive_shared_cache_map_object); @@ -442,7 +443,14 @@ guint64 now; g_return_if_fail(end<=CAPTIVE_ROUND_UP64(captive_shared_cache_map_object->AllocationSize,PAGE_SIZE)); start=CAPTIVE_ROUND_UP64(start,PAGE_SIZE); - end=CAPTIVE_ROUND_DOWN64(end,PAGE_SIZE); + if (endFileSize) + end=CAPTIVE_ROUND_DOWN64(end,PAGE_SIZE); + else { + /* We can validate the last page of the file + * even if it does not end on PAGE_SIZE boundary. + */ + end=CAPTIVE_ROUND_UP64(end,PAGE_SIZE); + } /* We may get end