ldap/servers/slapd/tools/ldclt/ldclt.c | 14 +++++++-------
lib/ldaputil/vtable.c | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit 2bfbe594a2c5593fd1ae695c118be94939651264
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Jul 14 15:19:01 2010 -0600
Bug 614242 - C99/ANSI C++ related compile errors on HP-UX
https://bugzilla.redhat.com/show_bug.cgi?id=614242
Resolves: bug 614242
Bug Description: C99/ANSI C++ related compile errors on HP-UX
Reviewed by: rmeggins
Branch: HEAD
Fix Description: In lib/ldaputil/vtable.c, a global static struct is declared and
initialized to
{}. I see gcc allows this, and aCC does also but only with -AA ("newly
supported ANSI C++ Standard features").
In ldap/servers/slapd/tools/ldclt/ldclt.c, an array size is set using a
variable, which I think is legal in C99. Since the size is not computed, and
this is the only place C99 is taken advantage of, this can be changed to a
then I would instead add the -AC99 compiler flag for HP-UX.
Platforms tested: HP-UX
Flag Day: no
Doc impact: no
Patch submitted by: Ulf Weltman <ulf.weltman(a)hp.com>
diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c
b/ldap/servers/slapd/tools/ldclt/ldclt.c
index 53115ad..cabdea8 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.c
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.c
@@ -1259,6 +1259,7 @@ parseFilter (
RETURN : -1 if error, 0 else.
DESCRIPTION :
*****************************************************************************/
+#define BUFFERSIZE 1024 /* buffer size for buffer */
int
basicInit (void)
{
@@ -1270,8 +1271,7 @@ basicInit (void)
int oflags;/* open() flags */ /*JLS 05-04-01*/
struct stat file_st ; /* file status checker for attreplacefile option */
FILE *attrF; /* file pointer for attreplacefile option */
- int buffersize=1024; /* buffer size for buffer */
- char buffer[buffersize]; /* buffer used to read attreplacefile content */
+ char buffer[BUFFERSIZE]; /* buffer used to read attreplacefile content */
/*
* Misc inits
@@ -1560,17 +1560,17 @@ basicInit (void)
/* start to read file content */
mctx.attrplFileContent = (char *)malloc(mctx.attrplFileSize + 1);
i=0;
- while ( fread(buffer, buffersize , 1, attrF) )
+ while ( fread(buffer, BUFFERSIZE , 1, attrF) )
{
- memcpy(mctx.attrplFileContent+i, buffer , buffersize );
- memset(buffer ,'\0', buffersize );
- i = i + buffersize;
+ memcpy(mctx.attrplFileContent+i, buffer , BUFFERSIZE );
+ memset(buffer ,'\0', BUFFERSIZE );
+ i = i + BUFFERSIZE;
}
/* copy remainding content into mctx.attrplFileContent */
if (i<mctx.attrplFileSize)
{
memcpy(mctx.attrplFileContent+i, buffer , (mctx.attrplFileSize - 1 - i));
- memset(buffer ,'\0', buffersize ); /* clear the buffer */
+ memset(buffer ,'\0', BUFFERSIZE ); /* clear the buffer */
}
mctx.attrplFileContent[mctx.attrplFileSize]='\0'; // append the close bit
diff --git a/lib/ldaputil/vtable.c b/lib/ldaputil/vtable.c
index 18ac0a4..7886006 100644
--- a/lib/ldaputil/vtable.c
+++ b/lib/ldaputil/vtable.c
@@ -43,7 +43,7 @@
#include "ldaputili.h"
#include <ldap.h>
-static LDAPUVTable_t ldapu_VTable = {};
+static LDAPUVTable_t ldapu_VTable = {0};
/* Replace ldapu_VTable. Subsequently, ldaputil will call the
functions in 'from' (not the LDAP API) to access the directory.