X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;ds=sidebyside;f=bluesky%2Futil.c;h=d292634731b662827dc8c0dfbeec0f566ab5a32a;hb=8ab9f6acce5bbc6e56d2f3fa1833be06faf46770;hp=f899420b1455279aa45608dcea076635171800eb;hpb=4fa8649924cb61b3d77ced461fe716a7ee18fc1d;p=bluesky.git diff --git a/bluesky/util.c b/bluesky/util.c index f899420..d292634 100644 --- a/bluesky/util.c +++ b/bluesky/util.c @@ -75,14 +75,14 @@ BlueSkyRCStr *bluesky_string_new_from_gstring(GString *s) } /* Create a new BlueSkyRCStr from a memory-mapped buffer. */ -BlueSkyRCStr *bluesky_string_new_from_mmap(BlueSkyMmap *mmap, +BlueSkyRCStr *bluesky_string_new_from_mmap(BlueSkyCacheFile *mmap, int offset, gsize len) { - g_assert(offset + len < mmap->len); + g_assert(offset + len <= mmap->len); BlueSkyRCStr *string = g_new(BlueSkyRCStr, 1); string->mmap = mmap; - g_atomic_int_inc(&mmap->refcount); + g_atomic_int_inc(&mmap->mapcount); string->data = (char *)mmap->addr + offset; string->len = len; g_atomic_int_set(&string->refcount, 1);