From d31def2b6dc0fb5c4a17918d608d9f5107372a74 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 21 Nov 2007 12:09:06 +0000 Subject: keep compiler happy and check more error conditions Thanks Marcus Rueckert for pointing this out Signed-off-by: Michael Krelin --- (limited to 'lib/util.cc') diff --git a/lib/util.cc b/lib/util.cc index 94f6f53..94e09ed 100644 --- a/lib/util.cc +++ b/lib/util.cc @@ -28,9 +28,10 @@ namespace opkele { if(!bmem) throw exception_openssl(OPKELE_CP_ "failed to BIO_new() memory buffer"); BIO_push(b64,bmem); - if(BIO_write(b64,data,length)!=length) + if(((size_t)BIO_write(b64,data,length))!=length) throw exception_openssl(OPKELE_CP_ "failed to BIO_write()"); - BIO_flush(b64); + if(BIO_flush(b64)!=1) + throw exception_openssl(OPKELE_CP_ "failed to BIO_flush()"); char *rvd; long rvl = BIO_get_mem_data(bmem,&rvd); string rv(rvd,rvl); @@ -144,7 +145,7 @@ namespace opkele { string long_to_string(long l) { char rv[32]; int r=snprintf(rv,sizeof(rv),"%ld",l); - if(r<0 || r>=sizeof(rv)) + if(r<0 || r>=(int)sizeof(rv)) throw failed_conversion(OPKELE_CP_ "failed to snprintf()"); return rv; } -- cgit v0.9.0.2