From 2e4fdccee325253bc98d893144c7b2a2e2499a98 Mon Sep 17 00:00:00 2001 From: Dan Heidinga Date: Mon, 16 Oct 2017 13:03:03 -0400 Subject: [PATCH] Fix compile errors due to non-boolean if statements Several if statements were not doing boolean comparisons and were directly assigning to a variable in the if statement i.e. if (foo = getFoo()) { ... Rewrote the code to be in the form: foo = getFoo(); if (NULL != foo) {... Signed-off-by: Dan Heidinga --- runtime/util/vmargs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runtime/util/vmargs.c b/runtime/util/vmargs.c index c9cb72f311d..15c34a3131c 100644 --- a/runtime/util/vmargs.c +++ b/runtime/util/vmargs.c @@ -174,7 +174,8 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match success = FALSE; optionValueOperations(PORTLIB, j9vm_args, optionCntr, GET_OPTION, &valueString, 0, ':', 0, NULL); /* assumes ':' */ if (valueString) { - if (cursor = strrchr(valueString, ':')) { /* Skip past any additional sub-options eg. -Xdump:java: */ + cursor = strrchr(valueString, ':'); /* Skip past any additional sub-options eg. -Xdump:java: */ + if (NULL != cursor) { ++cursor; } else { cursor = valueString; @@ -187,7 +188,10 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match break; } } - if (cursor = strchr(cursor, ',')) ++cursor; /* skip to next option */ + cursor = strchr(cursor, ','); + if (NULL != cursor) { + cursor += 1; /* skip to next option */ + } } } } @@ -455,8 +459,10 @@ optionValueOperations(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, IDATA break; case MAP_TWO_COLONS_TO_ONE : cursor = j9vm_args->actualVMArgs->options[element].optionString; - if (cursor = strchr(cursor, ':')) { - if (cursor = strchr(++cursor, ':')) { + cursor = strchr(cursor, ':'); + if (NULL != cursor) { + cursor = strchr(++cursor, ':'); + if (NULL != cursor) { if (bufSize > 0) { strncpy(*valuesBuffer, ++cursor, (bufSize-1)); if (strlen(cursor) > (bufSize-1)) {