Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experimental] Bugfix/warnings #37

Open
wants to merge 6 commits into
base: v1.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 70 additions & 70 deletions c/alloc.c

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions c/bpxskt.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,17 @@ int setSocketTrace(int toWhat) {
return was;
}

void sleep(int seconds){
int returnValue;
int *returnValuePtr;
unsigned int sleep(unsigned int seconds){
unsigned int returnValue;
unsigned int *returnValuePtr;

#ifndef _LP64
returnValuePtr = (int*) (0x80000000 | ((int)&returnValue));
returnValuePtr = (unsigned int*) (0x80000000 | ((int)&returnValue));
#else
returnValuePtr = &returnValue;
#endif
BPXSLP(seconds,returnValuePtr);
return returnValue;
}

void bpxSleep(int seconds)
Expand Down Expand Up @@ -204,7 +205,7 @@ Socket *tcpClient3(SocketAddress *socketAddress,
int returnValue = 0;
*returnCode = *reasonCode = 0;
int *reasonCodePtr;
int status;
int status = 0;

#ifndef _LP64
reasonCodePtr = (int*) (0x80000000 | ((int)reasonCode));
Expand Down Expand Up @@ -1627,20 +1628,20 @@ int not_main(int argc, char **argv){
int port = argc >= 3 ? atoi(argv[2]) : 80;
InetAddr *inetAddr = NULL;
char readBuffer[1024];
int errno;
int __errno;
int retcode;

inetAddr = getAddressByName(addressString);

if (inetAddr){
SocketAddress *socketAddress
= makeSocketAddr(inetAddr,(unsigned short)port);
Socket *socket = tcpClient(socketAddress,&errno,&retcode);
Socket *socket = tcpClient(socketAddress,&__errno,&retcode);
int i;
int bytesRead;

fflush(stdout);
bytesRead = socketRead(socket,readBuffer,200,&errno,&retcode);
bytesRead = socketRead(socket,readBuffer,200,&__errno,&retcode);
dumpbuffer(readBuffer,bytesRead);
for (i=0; i<5; i++){
printf("SLEEP %d\n",i+1);fflush(stdout);
Expand Down
8 changes: 5 additions & 3 deletions c/cmutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
#include <metal/stddef.h>
#include <metal/stdlib.h>
#include <metal/string.h>
#include <metal/stdio.h>
#else
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#endif

#include "zowetypes.h"
#include "alloc.h"
#include "cmutils.h"
#include "zos.h"

static int getCallersKey() {
static int getCallersKey(void) {

int key = 0;
__asm(
Expand Down Expand Up @@ -1117,9 +1119,9 @@ static int testCellPool(void) {


#ifdef CMUTILS_TEST
int main() {
int main(void) {
#else
static int notMain() {
static int notMain(void) {
#endif

printf("info: starting cmutils test\n");
Expand Down
12 changes: 6 additions & 6 deletions c/collections.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void *htGet(hashtable *ht, void *key){
int loopCount = 0;

if (hashentry != NULL){
int (*compare)() = ht->comparator;
int (*compare)(void *, void *) = ht->comparator;
while (hashentry != NULL){
if (compare?
(compare)(hashentry->key,key) :
Expand Down Expand Up @@ -297,7 +297,7 @@ static int htPut2(hashtable *ht, void *key, void *value){
hashentry *entry = entry = ht->backbone[place];
hashentry *tail = NULL;
hashentry *newEntry = NULL;
int (*compare)() = ht->comparator;
int (*compare)(void *, void *) = ht->comparator;

if (entry != NULL){
while (entry != NULL){
Expand Down Expand Up @@ -479,7 +479,7 @@ int htRemove(hashtable *ht, void *key){
hashentry *prev = NULL;
int place = hashcode%(ht->backboneSize);
hashentry *entry = ht->backbone[place];
int (*compare)() = ht->comparator;
int (*compare)(void *, void *) = ht->comparator;
if (entry != NULL){
while (entry != NULL){
if (compare ? (compare)(entry->key,key) : (entry->key == key)){
Expand Down Expand Up @@ -677,7 +677,7 @@ void lhtDestroy(LongHashtable *lht){
}

void *lhtGet(LongHashtable *lht, int64 key){
int place = key%(lht->backboneSize);
int place = (int) (key%(lht->backboneSize));
LongHashEntry *prev = NULL;
LongHashEntry* hashentry = lht->backbone[place];
int loopCount = 0;
Expand Down Expand Up @@ -708,7 +708,7 @@ void *lhtGet(LongHashtable *lht, int64 key){

/* returns whether replaced */
int lhtPut(LongHashtable *ht, int64 key, void *value){
int place = key%(ht->backboneSize);
int place = (int) (key%(ht->backboneSize));
LongHashEntry *entry = entry = ht->backbone[place];
LongHashEntry *tail = NULL;
LongHashEntry *newEntry = NULL;
Expand Down Expand Up @@ -742,7 +742,7 @@ int lhtPut(LongHashtable *ht, int64 key, void *value){
/* remove returns non-zero if it really removes anything
*/
int lhtRemove(LongHashtable *ht, int64 key){
int place = key%(ht->backboneSize);
int place = (int) (key%(ht->backboneSize));
LongHashEntry *prev = NULL;
LongHashEntry *entry = entry = ht->backbone[place];
if (entry != NULL){
Expand Down
7 changes: 4 additions & 3 deletions c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ static void getSTCK(uint64 *stckValue) {
__asm(" STCK 0(%0)" : : "r"(stckValue));
}

int64 getLocalTimeOffset() {
int64 getLocalTimeOffset(void) {
CVT * __ptr32 cvt = *(void * __ptr32 * __ptr32)0x10;
void * __ptr32 cvtext2 = cvt->cvtext2;
int64 *cvtldto = (int64 * __ptr32)(cvtext2 + 0x38);
int64 *cvtldto = (int64 * __ptr32)(/*note that we're adding a number to a void **/cvtext2 + 0x38);
return *cvtldto;
}

Expand Down Expand Up @@ -3268,9 +3268,10 @@ static int handleModifyCommand(STCBase *base, CIB *cib, STCConsoleCommandType co
return 0;
}

static void sleep(int seconds){
static unsigned int sleep(unsigned int seconds){
int waitValue = seconds * 100;
__asm(" STIMER WAIT,BINTVL=%0\n" : : "m"(waitValue));
return 0;
}

static int isEnvironmentReady() {
Expand Down
3 changes: 1 addition & 2 deletions c/dataservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ const char* pluginTypeString(int pluginType)
{
PlugInMapEntry *e = plugInMap;
while (e->pluginString != 0) {
// this seems like an error, but it appears vestigial
if (pluginType = e->pluginType) {
if (pluginType == e->pluginType) {
return e->pluginString;
}
++e;
Expand Down
2 changes: 1 addition & 1 deletion c/datasetjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ static void updateVSAMDatasetWithJSON(HttpResponse *response, JsonObject *json,
/* TODO: note that non-KSDS uses a pointer to the ? */
/* TODO: get Key before storing */
char *key = jsonArrayGetString(recordArray,i); /* TODO: get key AND record here */
char *record; /* TODO: correctly parse the record, minding your decided format from the above loop. */
char *record = NULL; /* TODO: correctly parse the record, minding your decided format from the above loop. */
/* TODO: point to the key, based on which type of dataset it is. See pointByXXX functions in respondWithVSAMDataset() for example syntax */
if (update) {
getRecord(outACB, tempRecord, &recordLength); /* in VSAM, we need to GET for update before we can write over a record with a later PUT for update */
Expand Down
6 changes: 4 additions & 2 deletions c/discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ static void showVersionInfo(DiscoveryContext *context, char *ssName){
}
}

static GDA *getGDA(){
static GDA *getGDA(void){
CVT *cvt = getCVT();
ECVT *ecvt = getECVT();
GDA *gda = (GDA*)cvt->cvtgda;
return gda;
}

static int isPointerCommon(GDA *gda, void *pointer){
/* FIXME: why does arithmetic even work on void pointers?
are they just converted to int impilictly? */
if ( ((pointer >= gda->gdacsa) && (pointer < gda->gdacsa+gda->gdacsasz)) ||
((pointer >= gda->gdasqa) && (pointer < gda->gdasqa+gda->gdasqasz)) ||
((pointer >= gda->gdaesqa) && (pointer < gda->gdaesqa+gda->gdaesqas)) ||
Expand Down Expand Up @@ -848,7 +850,7 @@ static void scanSlowSoftware(ZOSModel *model){
context->cicsTraceLevel = 0;
context->db2TraceLevel = 0;
context->model = model;
discoverSubsystems(context,SOFTWARE_TYPE_ALL,NULL);
discoverSubsystems(context,SOFTWARE_TYPE_ALL,NULL); /* Converting 4294967295 to type "int" does not preserve its value */
zowelog(NULL, LOG_COMP_DISCOVERY, ZOWE_LOG_DEBUG2, "after discoverySubsystems() in slowScan\n");
fflush(stdout);

Expand Down
1 change: 1 addition & 0 deletions c/dynalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ int AllocIntReader(char *datasetOutputClass,

rc = -1;

/* Converting 128 to type "signed char" does not preserve its value */
below2G->textUnits[0] = createInt8TextUnit(DALRECFM, DALRECFM_F);
if (below2G->textUnits[0] == NULL) {
break;
Expand Down
1 change: 1 addition & 0 deletions c/httpfileservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "charsets.h"
#include "unixfile.h"
#include "httpfileservice.h"
#include "httpserver.h"

#ifdef __ZOWE_OS_ZOS
#define NATIVE_CODEPAGE CCSID_EBCDIC_1047
Expand Down
20 changes: 10 additions & 10 deletions c/httpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static char crlf[] ={ 0x0d, 0x0a};
#define DEFAULT_UMASK 0022
#endif

static int64 getFineGrainedTime();
static int64 getFineGrainedTime(void);


/* worry about compareIgnoringCase
Expand Down Expand Up @@ -520,7 +520,7 @@ static void writeToBigBuffer(BigBuffer *buffer, char *newData, int length){
static void writeByteToBigBuffer(BigBuffer *buffer, int b){
char c;

c = b&0xff;
c = (char)b&0xff;
writeToBigBuffer(buffer,&c,1);
}

Expand Down Expand Up @@ -568,7 +568,7 @@ static void addWSFrame(WSMessage *message, WSFrame *newFrame){
}
}

static WSReadMachine *makeWSReadMachine(){
static WSReadMachine *makeWSReadMachine(void){
WSReadMachine *machine = (WSReadMachine*)safeMalloc(sizeof(WSReadMachine),"WSReadMachine");
memset(machine,0,sizeof(WSReadMachine));
machine->payloadStream = makeBigBuffer(256,NULL);
Expand Down Expand Up @@ -611,7 +611,7 @@ static void addNewWSFrame(HttpWorkElement *workElement,
memcpy(workElement->buffer+2,&longLength,8);
} else if (payloadLength >= 126){
workElement->buffer[1] = 126;
unsigned short shortLength = payloadLength&0xFFFF;
unsigned short shortLength = (unsigned short) payloadLength&0xFFFF;
memcpy(workElement->buffer+2,&shortLength,2);
} else{
workElement->buffer[1] = payloadLength;
Expand Down Expand Up @@ -2350,12 +2350,12 @@ static char *getCookieValue(HttpRequest *request, char *cookieName){
}

#ifdef __ZOWE_OS_ZOS
static int isLowerCasePasswordAllowed(){
static int isLowerCasePasswordAllowed(void){
RCVT* rcvt = getCVT()->cvtrac;
return (RCVTFLG3_BIT_RCVTPLC & (rcvt->rcvtflg3)); /* if lower-case pw allowed */
}
#else
static int isLowerCasePasswordAllowed(){
static int isLowerCasePasswordAllowed(void){
return TRUE;
}
#endif
Expand Down Expand Up @@ -2621,9 +2621,9 @@ int extractBasicAuth(HttpRequest *request, HttpHeader *authHeader){

#ifdef __ZOWE_OS_ZOS

#define ONE_SECOND (4096*1000000) /* one second in STCK */
#define ONE_SECOND (4096llu*1000000llu) /* one second in STCK */

static int64 getFineGrainedTime(){
static int64 getFineGrainedTime(void){
int64 stck = 0;
unsigned long long outSeconds = 0;
__asm(ASM_PREFIX
Expand Down Expand Up @@ -2933,7 +2933,7 @@ static void serveRequest(HttpService* service, HttpResponse* response,
proxyServe(service, request, response);
} else {
char* serviceArgProblem = NULL;
if (serviceArgProblem = processServiceRequestParams(service, response)) {
if (0 != (serviceArgProblem = processServiceRequestParams(service, response))) {
respondWithError(response, 404, serviceArgProblem);
// Response is finished on return
} else {
Expand Down Expand Up @@ -3126,7 +3126,7 @@ static int serviceLoop(Socket *socket){
break;
}
HttpRequest *request = NULL;
while (request = dequeueHttpRequest(parser)){
while (NULL != (request = dequeueHttpRequest(parser))) {
HttpHeader *header;
HttpResponse *response = makeHttpResponse(request,parser->slh,socket);
/* parse URI after request and response ready for work, have SLH's, etc */
Expand Down
1 change: 1 addition & 0 deletions c/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <ctype.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>

#endif

Expand Down
8 changes: 4 additions & 4 deletions c/le.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ LibraryFunction libraryFunctionTable[LIBRARY_FUNCTION_COUNT]
#endif
};

char *getCAA(){
char *getCAA(void){
char *realCAA = NULL;

#if !defined(METTLE) && defined(_LP64)
Expand All @@ -110,7 +110,7 @@ char *getCAA(){
#define LE_MAX_SUPPORTED_ZOS 0x01020300u
#endif

void abortIfUnsupportedCAA() {
void abortIfUnsupportedCAA(void) {
#ifdef __ZOWE_OS_ZOS
ECVT *ecvt = getECVT();
unsigned int zosVersion = ecvt->ecvtpseq;
Expand Down Expand Up @@ -162,7 +162,7 @@ static LibraryFunction *findLibraryFunction(int rtlVectorOffset){

#define ESTIMATED_RTL_VECTOR_SIZE 0xB00

void showRTL(){
void showRTL(void){
CAA *caa = (CAA*)getCAA();
void **rtlVector = caa->runtimeLibraryVectorTable;
printf("RTL Vector at 0x%x\n",rtlVector);
Expand Down Expand Up @@ -271,7 +271,7 @@ void initRLEEnvironment(RLEAnchor *anchor) {

}

void termRLEEnvironment() {
void termRLEEnvironment(void) {

recoveryRemoveRouter();

Expand Down
Loading