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 0c5633b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 35 deletions.
4 changes: 3 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# 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)
Expand All @@ -23,12 +24,13 @@ IF (USE_OPENLDAP)
HPCC_ADD_SUBDIRECTORY (initldap "PLATFORM")
ENDIF(USE_OPENLDAP)
HPCC_ADD_SUBDIRECTORY (combine "PLATFORM")
HPCC_ADD_SUBDIRECTORY (swapnode "PLATFORM")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STRICT_CXX_FLAGS}")
HPCC_ADD_SUBDIRECTORY (dumpkey "PLATFORM")
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
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
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
36 changes: 16 additions & 20 deletions tools/wutool/wutool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,10 @@ class ScopeDumper : public IWuScopeVisitor
SCMStringBuffer curFormattedValue;

StatisticCreatorType curCreatorType = cur.getCreatorType();
StatisticScopeType curScopeType = cur.getScopeType();
StatisticMeasure curMeasure = cur.getMeasure();
unsigned __int64 count = cur.getCount();
unsigned __int64 max = cur.getMax();
unsigned __int64 ts = cur.getTimestamp();
const char * curScope = cur.queryScope();
cur.getCreator(curCreator);
cur.getDescription(curDescription, false);
cur.getFormattedValue(curFormattedValue);
Expand Down Expand Up @@ -371,7 +369,6 @@ int main(int argc, const char *argv[])
int ret = 0;
InitModuleObjects();
Owned<IPropertyTree> dummyconfig = loadConfiguration(defaultYaml, argv, "wutool", "WUTOOL", "wutool.xml", nullptr, nullptr, false);
unsigned count=0;
globals.setown(createProperties("wutool.ini", true));
const char *action = NULL;
StringArray wuids;
Expand Down Expand Up @@ -842,11 +839,11 @@ class WuTool : public CppUnit::TestFixture
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
unsigned before = factory->numWorkUnits();
unsigned start = msTick();
for (int i = 0; i < testSize; i++)
for (unsigned i = 0; i < testSize; i++)
{
VStringBuffer userId("WuTestUser%02d", i % 50);
VStringBuffer clusterName("WuTestCluster%d", i % 5);
VStringBuffer jobName("WuTest job %d", i % 3);
VStringBuffer userId("WuTestUser%02u", i % 50);
VStringBuffer clusterName("WuTestCluster%u", i % 5);
VStringBuffer jobName("WuTest job %u", i % 3);
Owned<IWorkUnit>wu = factory->createWorkUnit("WuTest", NULL, NULL, NULL);
if (i % 6)
wu->setState(WUStateCompleted);
Expand All @@ -864,15 +861,15 @@ class WuTool : public CppUnit::TestFixture
// We should really be doing a noteFileRead here but the API is such a pain that we'll do it this way
IPropertyTree *p = queryExtendedWU(wu)->queryPTree();
VStringBuffer fileinfo(" <FilesRead>"
" <File name='myfile%02d' useCount='2' cluster = 'mycluster'/>"
" <File name='myfile%02u' useCount='2' cluster = 'mycluster'/>"
" <File name='mysuperfile' useCount='2' cluster = 'mycluster'>"
" <Subfile name='myfile%02d'/>"
" <Subfile name='myfile%02u'/>"
" </File>"
" </FilesRead>", i % 10, i % 10);
p->setPropTree("FilesRead", createPTreeFromXMLString(fileinfo));
wu->noteFileRead(NULL); // Make sure we notice that it was modified

VStringBuffer myFileW("myfilewritten%02d", i % 10);
VStringBuffer myFileW("myfilewritten%02u", i % 10);
wu->addFile(myFileW, NULL, i % 3, WUFileStandard, NULL);
}
unsigned after = factory->numWorkUnits();
Expand Down Expand Up @@ -1424,7 +1421,7 @@ class WuTool : public CppUnit::TestFixture
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
unsigned before = factory->numWorkUnits();
unsigned start = msTick();
for (int i = 0; i < testSize; i++)
for (unsigned i = 0; i < testSize; i++)
{
factory->deleteWorkUnit(wuids.item(i));
}
Expand All @@ -1438,7 +1435,7 @@ class WuTool : public CppUnit::TestFixture
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
unsigned start = msTick();
int i;
unsigned i;
for (i = 0; i < testSize; i++)
{
Owned<IWorkUnit> wu = factory->updateWorkUnit(wuids.item(i));
Expand Down Expand Up @@ -1494,7 +1491,7 @@ class WuTool : public CppUnit::TestFixture
}
ASSERT(wu->getExceptionCount() == 10);
Owned<IConstWUExceptionIterator> exceptions = &wu->getExceptions();
int exNo = 0;
unsigned exNo = 0;
ForEach(*exceptions)
{
IConstWUException &ex = exceptions->query();
Expand Down Expand Up @@ -1588,7 +1585,7 @@ class WuTool : public CppUnit::TestFixture
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
unsigned start = msTick();
int i;
unsigned i;
for (i = 0; i < testSize; i++)
{
Owned<IWorkUnit> wu = factory->updateWorkUnit(wuids.item(i));
Expand Down Expand Up @@ -1755,7 +1752,7 @@ class WuTool : public CppUnit::TestFixture
start = msTick();
StringArray users;
factory->getUniqueValues(WUSFuser, "WUTest", users);
int expected = testSize < 50 ? testSize : 50;
unsigned expected = testSize < 50 ? testSize : 50;
ASSERT(users.length() == expected);
ForEachItemIn(idx, users)
{
Expand Down Expand Up @@ -1935,7 +1932,6 @@ class WuTool : public CppUnit::TestFixture
void testList2()
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
bool isDali = streq(factory->queryStoreType(), "Dali");
unsigned before = factory->numWorkUnits();
unsigned start = msTick();
unsigned numIterated = 0;
Expand Down Expand Up @@ -1968,7 +1964,6 @@ class WuTool : public CppUnit::TestFixture
void testListByAppValue()
{
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
bool isDali = streq(factory->queryStoreType(), "Dali");
unsigned start = msTick();
unsigned numIterated = 0;
// Test filter by appValue
Expand Down Expand Up @@ -2095,6 +2090,8 @@ class WuTool : public CppUnit::TestFixture
}
void testWorkUnitServices()
{
#if 0
// These tests are not valid at present, since the C++ structure does not accurately describe the variable layout fields
class DummyContext: implements ICodeContext
{
virtual const char *loadResource(unsigned id) { throwUnexpected(); }
Expand Down Expand Up @@ -2212,8 +2209,6 @@ class WuTool : public CppUnit::TestFixture

} ctx;

#if 0
// These tests are not valid at present, since the C++ structure does not accurately describe the variable layout fields
size32_t lenResult;
void * result;
wsWorkunitList(&ctx, lenResult, result, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, false, NULL);
Expand Down Expand Up @@ -2304,7 +2299,8 @@ class WuDetails : public CppUnit::TestFixture
}
virtual void noteException(IConstWUException & exception) override
{
noteException(exception);
SCMStringBuffer s;
DBGLOG(" Exception: %s", exception.getExceptionMessage(s).str());
}
};

Expand Down

0 comments on commit 0c5633b

Please sign in to comment.