Skip to content

Commit

Permalink
HPCC-32809 Fix warnings in tools subdirectory
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Oct 16, 2024
1 parent 9d3734f commit a31dec3
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 64 deletions.
2 changes: 1 addition & 1 deletion system/security/LdapSecurity/ldapconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5513,7 +5513,7 @@ class CLdapClient : implements ILdapClient, public CInterface
}
}

virtual const bool organizationalUnitExists(const char * ou) const
virtual bool organizationalUnitExists(const char * ou) const
{
Owned<ILdapConnection> lconn = m_connections->getConnection();
LDAP* sys_ld = lconn.get()->getLd();
Expand Down
2 changes: 1 addition & 1 deletion system/security/LdapSecurity/ldapconnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ interface ILdapClient : extends IInterface
virtual void queryViewMembers(const char * viewName, StringArray & viewUsers, StringArray & viewGroups) = 0;
virtual bool userInView(const char * user, const char* viewName) = 0;
virtual void createLdapBasedn(ISecUser* user, const char* basedn, SecPermissionType ptype, const char* description) = 0;
virtual const bool organizationalUnitExists(const char * ou) const = 0;
virtual bool organizationalUnitExists(const char * ou) const = 0;
virtual bool addUser(ISecUser & user, const char* basedn) = 0;
};

Expand Down
2 changes: 1 addition & 1 deletion system/security/LdapSecurity/ldapsecurity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ void CLdapSecManager::createLdapBasedn(ISecUser* user, const char* basedn, SecPe
m_ldap_client->createLdapBasedn(user, basedn, ptype, description);
}

const bool CLdapSecManager::organizationalUnitExists(const char * ou) const
bool CLdapSecManager::organizationalUnitExists(const char * ou) const
{
return m_ldap_client->organizationalUnitExists(ou);
}
Expand Down
8 changes: 7 additions & 1 deletion system/security/LdapSecurity/ldapsecurity.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
#ifndef __LDAPSECURITY_IPP_
#define __LDAPSECURITY_IPP_

#ifdef _MSC_VER
#pragma warning (push)
#pragma warning(disable:4786)
#endif

#include "permissions.ipp"
#include "aci.ipp"
Expand Down Expand Up @@ -447,7 +450,7 @@ public:
bool retrieveUserData(ISecUser& requestedUser, ISecUser* requestingUser = nullptr, IEspSecureContext* secureContext = nullptr) override;
bool removeResources(ISecUser& sec_user, ISecResourceList * resources, IEspSecureContext* secureContext = nullptr) override { return false; }
virtual void createLdapBasedn(ISecUser* user, const char* basedn, SecPermissionType ptype, const char* description);
virtual const bool organizationalUnitExists(const char * ou) const;
virtual bool organizationalUnitExists(const char * ou) const;
virtual bool addUser(ISecUser & user, const char* basedn);

//Data View related interfaces
Expand All @@ -465,4 +468,7 @@ public:
virtual bool userInView(const char * user, const char* viewName);
};

#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif
10 changes: 8 additions & 2 deletions system/security/shared/caching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

#ifndef _CACHING_HPP__
#define _CACHING_HPP__
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning(disable:4786)
#endif

#include "jliball.hpp"
#include "seclib.hpp"
Expand Down Expand Up @@ -180,7 +183,7 @@ class CPermissionsCache : public CInterface
else
setTransactionalCacheTimeout(timeoutSeconds);
}
const int getCacheTimeout() { return m_cacheTimeoutInSeconds; }
int getCacheTimeout() { return m_cacheTimeoutInSeconds; }
bool isCacheEnabled() { return m_cacheTimeoutInSeconds > 0; }

void setTransactionalEnabled(bool enable)
Expand All @@ -192,7 +195,7 @@ class CPermissionsCache : public CInterface
setTransactionalCacheTimeout(getCacheTimeout());
}
void setTransactionalCacheTimeout(int timeoutSeconds) { m_transactionalCacheTimeout = timeoutSeconds; }
const int getTransactionalCacheTimeout() { return m_transactionalCacheTimeout; }
int getTransactionalCacheTimeout() { return m_transactionalCacheTimeout; }

bool isTransactionalEnabled() { return m_transactionalEnabled;}

Expand Down Expand Up @@ -239,4 +242,7 @@ class CPermissionsCache : public CInterface

time_t getThreadCreateTime();

#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif
4 changes: 3 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
project (tools)
HPCC_ADD_SUBDIRECTORY (esdlcomp)
HPCC_ADD_SUBDIRECTORY (hidl)
HPCC_ADD_SUBDIRECTORY (esdlcmd-xml)
HPCC_ADD_SUBDIRECTORY (esdlcmd)
HPCC_ADD_SUBDIRECTORY (esp-api)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STRICT_CXX_FLAGS}")
HPCC_ADD_SUBDIRECTORY (backupnode "PLATFORM")
HPCC_ADD_SUBDIRECTORY (swapnode "PLATFORM")
IF (USE_OPENLDAP)
HPCC_ADD_SUBDIRECTORY (initldap "PLATFORM")
ENDIF(USE_OPENLDAP)
Expand All @@ -28,7 +31,6 @@ HPCC_ADD_SUBDIRECTORY (keydiff "PLATFORM")
HPCC_ADD_SUBDIRECTORY (pstart "PLATFORM")
HPCC_ADD_SUBDIRECTORY (pskill "PLATFORM")
HPCC_ADD_SUBDIRECTORY (testsocket)
HPCC_ADD_SUBDIRECTORY (swapnode "PLATFORM")
HPCC_ADD_SUBDIRECTORY (vkey "PLATFORM")
HPCC_ADD_SUBDIRECTORY (wuget "CLIENTTOOLS")
HPCC_ADD_SUBDIRECTORY (wutool "PLATFORM")
Expand Down
18 changes: 8 additions & 10 deletions tools/backupnode/backupnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ static void printerr(const char *format, ...) __attribute__((format(printf, 1, 2
}
#endif

#ifdef _WIN32
static bool shouldCompressFile(const char *name)
{
if (compressAll)
return true;
OwnedIFile file = createIFile(name);
bool iskey = false;
unsigned __int64 filesize = file->size();
if (filesize < MINCOMPRESS_THRESHOLD)
{
Expand All @@ -101,7 +101,7 @@ static bool shouldCompressFile(const char *name)
}
return !isCompressedIndex(name);
}

#endif

static bool CopySingleFile(IFile *srcfile,IFile *dstfile, bool compress, bool suppressnotfounderrs)
{
Expand Down Expand Up @@ -216,7 +216,6 @@ static void usage()
printf(" generates data files in outdir containing all files to be checked (*.DAT) \n\n");
printf("Options:\n");
printf(" -A - compression options apply to all files (normally excludes small files and all keys)\n");
printf(" -B - use /mnt/mirror for replicate target\n");
printf(" -C - compress files on target (including existing files)\n");
printf(" -D - overwrite existing files if size/date mismatch\n");
printf(" -E - set compression state of existing files\n");
Expand All @@ -227,7 +226,6 @@ static void usage()
printf(" -Q - quiet mode: only errors are reported\n");
printf(" -V - verbose mode\n");
printf(" -Y - report what would have been copied/compressed but do nothing\n");
printf(" -S - snmp enabled\n");
printf(" -X <dir> - read part lists (%%n.DAT) from and write %%n.ERR to specified dir\n");
exit(2);
}
Expand Down Expand Up @@ -290,7 +288,7 @@ static void CopyDirectory(const char *source, const char *target, unsigned numSl
targetname.append(PATHSEPCHAR);
dir->getName(targetname);
OwnedIFile destFile = createIFile(targetname.str());
if ((destFile->size()==-1) || (sourceIsMaster && different(*destFile, sourceFile)))
if ((destFile->size()==(offset_t)-1) || (sourceIsMaster && different(*destFile, sourceFile)))
{
if (first && !checkMode)
{
Expand Down Expand Up @@ -526,8 +524,6 @@ int main(int argc, const char *argv[])
bool thorMode = false;
bool waitMode = false;
bool forceSlaveIP = false;
bool snmpEnabled = false;
bool useMirrorMount = false;
bool outputMode = false;
StringAttr errdatdir;
StringArray args;
Expand All @@ -549,7 +545,8 @@ int main(int argc, const char *argv[])
compressAll = true;
break;
case 'B':
useMirrorMount = true;
// Deprecated option - ignore
println("Ignoring deprecated option B");
break;
case 'C':
compress = true;
Expand Down Expand Up @@ -586,7 +583,8 @@ int main(int argc, const char *argv[])
silent = true;
break;
case 'S':
snmpEnabled = true;
// Deprecated option - ignore
println("Ignoring deprecated option S");
break;
case 'T':
thorMode = true;
Expand Down Expand Up @@ -637,7 +635,7 @@ int main(int argc, const char *argv[])
slaveNum = atoi(args.item(0));
numSlaves = atoi(args.item(1));
const char *myIp = args.item(2);
const char *backupIp = args.item(3);
[[maybe_unused]] const char *backupIp = args.item(3);

setDaliServixSocketCaching(true);
if (!slaveNum || slaveNum>numSlaves)
Expand Down
2 changes: 0 additions & 2 deletions tools/backupnode/backupnode2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,10 @@ class CFileListWriter
parent.numfiles++;
StringBuffer fn;
StringBuffer dir;
bool incluster = true;
StringBuffer ln;
for (unsigned p=0;p<np;p++) {
if (abort)
return;
unsigned matched = 0;
unsigned nc = fdesc->numCopies(p);
unsigned c;
UnsignedArray map;
Expand Down
2 changes: 1 addition & 1 deletion tools/combine/combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ int main(int argc, const char *argv[])
StringBuffer glue;
StringBuffer prefix;
bool sub = false;
for (unsigned ai=1;ai<argc;ai++) {
for (int ai=1;ai<argc;ai++) {
const char *arg = argv[ai];
if (arg[0]=='-')
{
Expand Down
1 change: 0 additions & 1 deletion tools/copyexp/copyexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ int main(int argc, char * const * argv)
try
{
bool test=false;
unsigned arg = 1;
StringBuffer fname1;
StringBuffer fname2;
bool lzw = false;
Expand Down
1 change: 0 additions & 1 deletion tools/initldap/initldap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ bool initLDAP(IPropertyTree * ldapProps)
return false;
}
StringAttr adminGroup;
bool isActiveDir = true;
if (0 == stricmp(serverType.get(),"ActiveDirectory"))
adminGroup.set("Administrators");
else
Expand Down
4 changes: 0 additions & 4 deletions tools/swapnode/swapnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ int main(int argc, const char *argv[])

int ret = 0;
bool dryRun = false;
bool offline = false;
StringAttr daliServer, envPath;

enum CmdType { cmd_none, cmd_swap, cmd_auto, cmd_history, cmd_email, cmd_swapped, cmd_reset, cmd_resetspares, cmd_addspares, cmd_removespares, cmd_resethistory };
Expand All @@ -92,7 +91,6 @@ int main(int argc, const char *argv[])

try
{
bool stop=false;
StringArray params;
for (; !ret&&!iter.done(); iter.next())
{
Expand All @@ -102,8 +100,6 @@ int main(int argc, const char *argv[])
bool value;
if (iter.matchFlag(value, "-dryrun"))
dryRun = value;
else if (iter.matchFlag(value, "-offline"))
offline = value;
else
{
PROGLOG("Unknown option");
Expand Down
10 changes: 5 additions & 5 deletions tools/swapnode/swapnodelib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ class CAutoSwapNode : public CSwapNode
SocketEndpointArray badepa;
UnsignedArray failedcodes;
StringArray failedmessages;
unsigned start = msTick();

const char *thorname = options->queryProp("@name");
StringBuffer dataDir, mirrorDir;
Expand Down Expand Up @@ -653,7 +652,7 @@ class CAutoSwapNode : public CSwapNode
return false;
}
bnt->setProp("@time", ts.str());
int r = bnt->getPropInt("@rank", -1);
rank_t r = bnt->getPropInt("@rank", -1);
if ((int)r < 0)
{ // shouldn't occur
ERRLOG("SWAPNODE node %s rank not found in group %s", ips.str(), groupName.get());
Expand All @@ -664,7 +663,7 @@ class CAutoSwapNode : public CSwapNode
{
SocketEndpoint ep1(badepa.item(j1));
ep1.port = 0; // should be no ports in group
int r1 = (int)badrank.item(j1);
rank_t r1 = badrank.item(j1);
if ((r == (r1 + 1) % grp->ordinality()) ||
(r1 == (r + 1) % grp->ordinality()))
{
Expand Down Expand Up @@ -693,13 +692,14 @@ class CAutoSwapNode : public CSwapNode
const char *ips = swappednode.queryProp("@outNetAddress");
if (!ips || !*ips)
continue;
int r1 = swappednode.getPropInt("@rank", -1);
rank_t r1 = swappednode.getPropInt("@rank", -1);
// MORE - should perhaps assert that it is NOT -1
SocketEndpoint swappedep(ips);
swappedep.port = 0;
ForEachItemIn(i2, badepa)
{
SocketEndpoint badep(badepa.item(i2));
int badr = (int)badrank.item(i2);
rank_t badr = badrank.item(i2);
badep.port = 0;
if (swappedep.equals(badep))
{
Expand Down
4 changes: 1 addition & 3 deletions tools/testsocket/testsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ int readResults(ISocket * socket, bool readBlocked, bool useHTTP, StringBuffer &
break;
}

bool isSpecial = false;
bool pluginRequest = false;
bool dataBlockRequest = false;
bool remoteReadRequest = false;
if (len & 0x80000000)
{
unsigned char flag;
isSpecial = true;
socket->read(&flag, sizeof(flag));
switch (flag)
{
Expand Down Expand Up @@ -395,7 +393,7 @@ int readResults(ISocket * socket, bool readBlocked, bool useHTTP, StringBuffer &
mb.read(dataLen);
if (!dataLen)
break;
const void *rowData = mb.readDirect(dataLen);
[[maybe_unused]] const void *rowData = mb.readDirect(dataLen);
// JCSMORE - output binary row data?

// cursor
Expand Down
20 changes: 10 additions & 10 deletions tools/vkey/vkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ unsigned long mcrc32(const char *buf, unsigned len, unsigned long crc)

switch (len)
{
case 11: c = *buf++; crc = UPDC32(c,crc);
case 10: c = *buf++; crc = UPDC32(c,crc);
case 9: c = *buf++; crc = UPDC32(c,crc);
case 8: c = *buf++; crc = UPDC32(c,crc);
case 7: c = *buf++; crc = UPDC32(c,crc);
case 6: c = *buf++; crc = UPDC32(c,crc);
case 5: c = *buf++; crc = UPDC32(c,crc);
case 4: c = *buf++; crc = UPDC32(c,crc);
case 3: c = *buf++; crc = UPDC32(c,crc);
case 2: c = *buf++; crc = UPDC32(c,crc);
case 11: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 10: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 9: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 8: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 7: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 6: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 5: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 4: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 3: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 2: c = *buf++; crc = UPDC32(c,crc); [[fallthrough]];
case 1: c = *buf++; crc = UPDC32(c,crc);
}

Expand Down
Loading

0 comments on commit a31dec3

Please sign in to comment.