[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Compiling LMDB with Visual C++
- To: Timur Kristóf <timur.kristof@gmail.com>, Howard Chu <hyc@symas.com>, openldap-devel@openldap.org
- Subject: Re: Compiling LMDB with Visual C++
- From: Robin Rowe <robin.rowe@cinepaint.org>
- Date: Thu, 24 Dec 2015 09:24:54 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cinepaint.org; s=2015; t=1450977893; bh=Y0fm4a2DNALpDV/pntUgfydjLyVkj8CJeZfuKSofwD4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=sZz9oBX2uscDFNEB8/ZXVsTUczsmGxHiluteNt3bKHuJ/Mp9/cbEia1238xB6M/y4 A9deKqz5HEEOVcQj39wIcag8MKU1ijLUnvhVo2e6sC4RGFbMjLxrRiXUrse5JcCTyF DAbfzRc8+0O1SY3/bZxQTai1lqSGeM/nUmkS+Pn4=
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cinepaint.org; s=2015; t=1450977893; bh=Y0fm4a2DNALpDV/pntUgfydjLyVkj8CJeZfuKSofwD4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=sZz9oBX2uscDFNEB8/ZXVsTUczsmGxHiluteNt3bKHuJ/Mp9/cbEia1238xB6M/y4 A9deKqz5HEEOVcQj39wIcag8MKU1ijLUnvhVo2e6sC4RGFbMjLxrRiXUrse5JcCTyF DAbfzRc8+0O1SY3/bZxQTai1lqSGeM/nUmkS+Pn4=
- In-reply-to: <1450904873.4063.2.camel@gmail.com>
- References: <56778DDD.1010901@cinepaint.org> <567AFD4D.5050503@symas.com> <1450904873.4063.2.camel@gmail.com>
- User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
Quanah wrote:
> Latest is 0.9.17.
Thanks. Where's the howto or link to fetch that?
Howard wrote:
You're welcome to submit code patches against the latest code
> in mdb.master. MSVC Project files and other such stuff
will not be accepted
Ok, thanks. How about cmake? Would you like that?
I created a set of small C++ wrapper classes to make the API easier to
use in C++ applications. Would you like that?
Timur wrote:
> I'd be interested to see those code changes.
Ok, I'll make a patch after I sync up with 0.9.17 and confirm it still
builds on Linux.
For the most part, the code changes I made were adding explicit void*
casts, which C++ is more strict about than C. I still have these VC++
warnings (in 0.9.15) that I didn't fix:
1>c:\code\lib\liblmdb\mdb.c(3892): warning C4244: '=' : conversion from
'LONGLONG' to 'size_t', possible loss of data
1>c:\code\lib\liblmdb\mdb.c(4287): warning C4244: 'argument' :
conversion from 'mdb_hash_t' to 'unsigned long', possible loss of data
1>c:\code\lib\liblmdb\mdb.c(6458): warning C4146: unary minus operator
applied to unsigned type, result still unsigned
1>c:\code\lib\liblmdb\mdb.c(8859): warning C4804: '>>' : unsafe use of
type 'bool' in operation
1>c:\code\lib\liblmdb\mdb.c(8860): warning C4804: '>>' : unsafe use of
type 'bool' in operation
I can make these warnings go away with casts. Should I? Do any of these
seem like they may be bugs?
One bug I noticed, I encountered a segfault when opening a directory
that didn't exist and so make this change to mdb.c:
/* For RDONLY, get lockfile after we know datafile exists */
if (!(flags & (MDB_RDONLY|MDB_NOLOCK))) {
rc = mdb_env_setup_locks(env, lpath, mode, &excl);
#ifndef _MSC_VER
if (rc)
goto leave;
#endif
}
The goto skips over allocating to a null pointer that is dereferenced
later, thus triggering a null pointer segfault.
Thanks!
Robin