openbabel: fix narrowing errors on archs where char is unsigned

by default (ppc, arm).

While here, move to PERMIT_PACKAGE.

OK sthen@
This commit is contained in:
cwen 2019-06-25 11:54:02 +00:00
parent 529f72283c
commit bf21df5dfe
3 changed files with 48 additions and 3 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.26 2018/10/24 14:28:08 sthen Exp $
# $OpenBSD: Makefile,v 1.27 2019/06/25 11:54:02 cwen Exp $
COMMENT= chemistry file translation program
V= 2.2.3
DISTNAME= openbabel-${V}
REVISION= 7
REVISION= 8
CATEGORIES= misc
SUBST_VARS= V
@ -14,7 +14,7 @@ SHARED_LIBS+= openbabel 5.0 # .3.0
HOMEPAGE= http://openbabel.sourceforge.net/
# GPLv2
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE= Yes
WANTLIB += c iconv lzma m pthread ${COMPILER_LIBCXX} xml2 z

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_formats_pngformat_cpp,v 1.1 2019/06/25 11:54:02 cwen Exp $
Fix the build on archs where char is unsigned by default (arm,ppc)
see:
https://github.com/openbabel/openbabel/commit/e26491017efefdc6aaf73d4d49f284f4e9436244
Index: src/formats/pngformat.cpp
--- src/formats/pngformat.cpp.orig
+++ src/formats/pngformat.cpp
@@ -120,7 +120,7 @@ bool PNGFormat::ReadMolecule(OBBase* pOb, OBConversion
if(pConv->IsFirstInput())
count=0;
- const char pngheader[] = {-119,80,78,71,13,10,26,10,0};
+ const unsigned char pngheader[] = {137,80,78,71,13,10,26,10,0};
char readbytes[9];
ifs.read(readbytes, 8);

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-src_formats_yasaraformat_cpp,v 1.1 2019/06/25 11:54:02 cwen Exp $
fix narrowing conversion errors on archs where char is unsigned by default
(arm, ppc), see
https://github.com/openbabel/openbabel/pull/1744
Index: src/formats/yasaraformat.cpp
--- src/formats/yasaraformat.cpp.orig
+++ src/formats/yasaraformat.cpp
@@ -478,7 +478,7 @@ bool YOBFormat::WriteMolecule(OBBase* pOb, OBConversio
// bool hetatom;
char buffer[32],/*resname[4],*/atomname[5];
- char double1[8]={0,0,0,0,0,0,-16,0x3f};
+ unsigned char double1[8]={0,0,0,0,0,0,0xf0,0x3f};
// char *str;
int i,j,/*m,q,*/pos;
int /*resno,chainNum,link,linktype,*/atoms,element,links/*,chain*/;
@@ -506,7 +506,7 @@ bool YOBFormat::WriteMolecule(OBBase* pOb, OBConversio
mem_set(buffer,0,8);
for (i=0;i<4;i++)
{ for (j=0;j<4;j++)
- { if (i==j) ofs.write(double1,8);
+ { if (i==j) ofs.write((char*)double1,8);
else ofs.write(buffer,8); } }
storeint32le(buffer,MOB_INFOEND);
storeint32le(&buffer[4],MOB_INFOENDSIZE);