Date: Fri, 04 Jan 2019 17:48:30 +0000
From: robin.rowe@cinepaint.org
To: openldap-its@OpenLDAP.org
Subject: Windows lmdb warnings and a memory error
 Full_Name: Robin Rowe
Version: --branch OPENLDAP_REL_ENG_2_4
OS: Windows 10
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (23.242.20.216)


Thanks for lmdb!

Building lmdb in Visual Studio 2017 produces warnings a memory error due to
returning address of local variable from function mdb_strerror. Many warnings
for integer truncation without using a cast. None of these seem severe. Will
anyone clean this up?

I used these switches in my cmake file to cut down the warnings:

add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
# Necessary for building mdb_dkey for mtest6:
add_definitions(-DMDB_DEBUG)

Visual Studio 2017 Build Output:

2>mdb.c
liblmdb\mdb.c(1640): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(1831): warning C4267: 'initializing': conversion from 'size_t' to
'unsigned int', possible loss of data
liblmdb\mdb.c(2014): warning C4267: '+=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(2053): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(2028): warning C4267: 'initializing': conversion from 'size_t' to
'unsigned int', possible loss of data
liblmdb\mdb.c(2258): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(2278): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(2164): warning C4267: 'initializing': conversion from 'size_t' to
'unsigned int', possible loss of data
liblmdb\mdb.c(2439): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(2893): warning C4267: '=': conversion from 'size_t' to 'int',
possible loss of data
liblmdb\mdb.c(2894): warning C4267: 'function': conversion from 'size_t' to
'int', possible loss of data
liblmdb\mdb.c(3360): warning C4267: '=': conversion from 'size_t' to 'DWORD',
possible loss of data
liblmdb\mdb.c(3361): warning C4267: 'function': conversion from 'size_t' to
'DWORD', possible loss of data
liblmdb\mdb.c(3300): warning C4267: 'initializing': conversion from 'size_t' to
'int', possible loss of data
liblmdb\mdb.c(3510): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(3514): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(3550): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(3553): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(3568): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(3875): warning C4244: '+=': conversion from '__int64' to 'off_t',
possible loss of data
liblmdb\mdb.c(3988): warning C4267: '=': conversion from 'size_t' to 'LONG',
possible loss of data
liblmdb\mdb.c(4334): warning C4996: 'GetVersion': was declared deprecated
2>C:\Program Files (x86)\Windows
Kits\10\Include\10.0.16299.0\um\sysinfoapi.h(184): note: see declaration of
'GetVersion'
liblmdb\mdb.c(4719): warning C4244: 'function': conversion from 'mdb_hash_t' to
'unsigned long', possible loss of data
liblmdb\mdb.c(5226): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(5229): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(5234): warning C4244: 'return': conversion from 'ssize_t' to
'int', possible loss of data
liblmdb\mdb.c(5260): warning C4244: 'return': conversion from 'ssize_t' to
'int', possible loss of data
liblmdb\mdb.c(5708): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(5716): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(5728): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(5729): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(6559): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(6674): warning C4267: '=': conversion from 'size_t' to 'uint16_t',
possible loss of data
liblmdb\mdb.c(6756): warning C4267: '=': conversion from 'size_t' to 'uint16_t',
possible loss of data
liblmdb\mdb.c(6762): warning C4267: '=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(6818): warning C4267: '=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\mdb.c(6898): warning C4146: unary minus operator applied to unsigned
type, result still unsigned
liblmdb\mdb.c(6906): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(7027): warning C4267: '=': conversion from 'size_t' to 'int',
possible loss of data
liblmdb\mdb.c(6854): warning C4267: 'initializing': conversion from 'size_t' to
'int', possible loss of data
liblmdb\mdb.c(7299): warning C4267: '-=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(7339): warning C4267: '=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(7347): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(7350): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(7352): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(7312): warning C4267: 'initializing': conversion from 'size_t' to
'int', possible loss of data
liblmdb\mdb.c(7413): warning C4267: '+=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(7475): warning C4333: '>>': right shift by too large amount,
data
loss
liblmdb\mdb.c(7811): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(7934): warning C4267: 'function': conversion from 'size_t' to
'int', possible loss of data
liblmdb\mdb.c(8697): warning C4267: '-=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(8705): warning C4267: '-=': conversion from 'size_t' to 'indx_t',
possible loss of data
liblmdb\mdb.c(8713): warning C4267: '=': conversion from 'size_t' to 'int',
possible loss of data
liblmdb\mdb.c(8715): warning C4267: '=': conversion from 'size_t' to 'int',
possible loss of data
liblmdb\mdb.c(9297): warning C4267: '=': conversion from 'size_t' to 'unsigned
short', possible loss of data
liblmdb\mdb.c(9484): warning C4267: '=': conversion from 'size_t' to 'DWORD',
possible loss of data
liblmdb\mdb.c(9520): warning C4267: '=': conversion from 'size_t' to 'DWORD',
possible loss of data
2>midl.c
liblmdb\midl.c(44): warning C4267: 'initializing': conversion from 'size_t' to
'unsigned int', possible loss of data
liblmdb\midl.c(146): warning C4267: '+=': conversion from 'size_t' to 'unsigned
int', possible loss of data
liblmdb\midl.c(176): warning C4267: 'function': conversion from 'size_t' to
'int', possible loss of data
2>Generating Code...
2>c:\code\github\libunistd\lmdb\liblmdb\mdb.c(1515): warning C4172: returning
address of local variable or temporary: buf
2>Db.cpp
2>liblmdb.vcxproj ->
C:\Code\github\libunistd\build\lmdb\Debug\liblmdb.lib
2>Done building project "liblmdb.vcxproj".
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped =========


Subject: Re: (ITS#8953) Windows lmdb warnings and a memory error
Date: Fri, 4 Jan 2019 20:45:06 +0000
From: Howard Chu
To: openldap-its@OpenLDAP.org

robin.rowe@cinepaint.org wrote:
> Full_Name: Robin Rowe
> Version: --branch OPENLDAP_REL_ENG_2_4
> OS: Windows 10
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (23.242.20.216)
> 
> 
> Thanks for lmdb!
> 
> Building lmdb in Visual Studio 2017 produces warnings a memory error due to
> returning address of local variable from function mdb_strerror. Many warnings
> for integer truncation without using a cast. None of these seem severe. Will
> anyone clean this up?

None of these are meaningful, so no.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/
