From 088c938eb8a4c6e4db96603e30b3558fd3d67580 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 19 Jul 2001 19:51:41 +0000 Subject: [PATCH] Added typecasts to make C++ happy. --- client/admin.c | 7 +++++-- client/client.c | 12 ++++++++---- server/requestq.c | 7 +++++-- server/seshigh.c | 38 +++++++++++++++++++++----------------- server/session.h | 7 +++++-- util/nmem.c | 7 +++++-- ztest/ztest.c | 31 +++++++++++++++++++------------ 7 files changed, 68 insertions(+), 41 deletions(-) diff --git a/client/admin.c b/client/admin.c index 1e956da..46cf777 100644 --- a/client/admin.c +++ b/client/admin.c @@ -1,6 +1,9 @@ /* * $Log: admin.c,v $ - * Revision 1.9 2001-02-21 13:46:53 adam + * Revision 1.10 2001-07-19 19:51:41 adam + * Added typecasts to make C++ happy. + * + * Revision 1.9 2001/02/21 13:46:53 adam * C++ fixes. * * Revision 1.8 2000/04/17 14:21:38 adam @@ -222,6 +225,7 @@ int cmd_adm_import(char *arg) struct dirent *ent; int chunk = 10; Z_APDU *apdu = 0; + Z_Segment *segment = 0; ODR out = getODROutputStream(); if (arg && sscanf (arg, "%19s %1023s %1023s", type_str, @@ -252,7 +256,6 @@ int cmd_adm_import(char *arg) if (S_ISREG(status.st_mode) && (inf = fopen(fname, "r"))) { - Z_Segment *segment; Z_NamePlusRecord *rec; Odr_oct *oct = (Odr_oct *) odr_malloc (out, sizeof(*oct)); diff --git a/client/client.c b/client/client.c index be3a8d3..8feb388 100644 --- a/client/client.c +++ b/client/client.c @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: client.c,v $ - * Revision 1.124 2001-07-04 20:13:51 ja7 + * Revision 1.125 2001-07-19 19:51:41 adam + * Added typecasts to make C++ happy. + * + * Revision 1.124 2001/07/04 20:13:51 ja7 * Added new commend "proxy" for ysing a yaz-proxy to connect to the target * Added new command line option -p for setting the proxy host * @@ -425,6 +428,7 @@ #include #include #include +#include #include @@ -472,7 +476,7 @@ static char ccl_fields[512] = "default.bib"; static char* esPackageName = 0; static char* yazProxy = 0; -static char last_cmd[100] = "?"; +static char last_cmd[32] = "?"; static FILE *marcdump = 0; static char *refid = NULL; @@ -2505,7 +2509,7 @@ static int client(int wait) #ifdef USE_SELECT fd_set input; #endif - char line[1024], word[1024], arg[1024]; + char line[1024], word[32], arg[1024]; #ifdef USE_SELECT FD_ZERO(&input); @@ -2548,7 +2552,7 @@ static int client(int wait) gettimeofday (&tv_start, 0); #endif - if ((res = sscanf(line, "%s %[^;]", word, arg)) <= 0) + if ((res = sscanf(line, "%31s %1023[^;]", word, arg)) <= 0) { strcpy(word, last_cmd); *arg = '\0'; diff --git a/server/requestq.c b/server/requestq.c index 380fb41..7c8ee00 100644 --- a/server/requestq.c +++ b/server/requestq.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: requestq.c,v $ - * Revision 1.7 1999-11-30 13:47:12 adam + * Revision 1.8 2001-07-19 19:51:41 adam + * Added typecasts to make C++ happy. + * + * Revision 1.7 1999/11/30 13:47:12 adam * Improved installation. Moved header files to include/yaz. * * Revision 1.6 1998/02/11 11:53:35 adam @@ -105,7 +108,7 @@ request *request_get(request_q *q) r->q = q; r->len_refid = 0; r->refid = 0; - r->request = 0; + r->apdu_request = 0; r->request_mem = 0; r->len_response = 0; r->clientData = 0; diff --git a/server/seshigh.c b/server/seshigh.c index d8e174e..62c3eb3 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: seshigh.c,v $ - * Revision 1.117 2001-06-13 20:47:40 adam + * Revision 1.118 2001-07-19 19:51:41 adam + * Added typecasts to make C++ happy. + * + * Revision 1.117 2001/06/13 20:47:40 adam * When error is returned from present handler, non-surrogate diagnostic * is returned in present response (and fetch handler is no longer called). * @@ -669,7 +672,7 @@ void ir_session(IOCHAN h, int event) req = request_get(&assoc->incoming); /* get a new request structure */ odr_reset(assoc->decode); odr_setbuf(assoc->decode, assoc->input_buffer, res, 0); - if (!z_APDU(assoc->decode, &req->request, 0, 0)) + if (!z_APDU(assoc->decode, &req->apdu_request, 0, 0)) { yaz_log(LOG_LOG, "ODR error on incoming PDU: %s [near byte %d] ", odr_errmsg(odr_geterror(assoc->decode)), @@ -680,7 +683,7 @@ void ir_session(IOCHAN h, int event) return; } req->request_mem = odr_extract_mem(assoc->decode); - if (assoc->print && !z_APDU(assoc->print, &req->request, 0, 0)) + if (assoc->print && !z_APDU(assoc->print, &req->apdu_request, 0, 0)) { yaz_log(LOG_WARN, "ODR print error: %s", odr_errmsg(odr_geterror(assoc->print))); @@ -753,12 +756,12 @@ static int process_request(association *assoc, request *req, char **msg) *msg = "Unknown Error"; assert(req && req->state == REQUEST_IDLE); - if (req->request->which != Z_APDU_initRequest && !assoc->init) + if (req->apdu_request->which != Z_APDU_initRequest && !assoc->init) { *msg = "Missing InitRequest"; return -1; } - switch (req->request->which) + switch (req->apdu_request->which) { case Z_APDU_initRequest: res = process_initRequest(assoc, req); break; @@ -859,7 +862,7 @@ void backend_response(IOCHAN i, int event) yaz_log(LOG_DEBUG, "backend_response"); assert(assoc && req && req->state != REQUEST_IDLE); /* determine what it is we're waiting for */ - switch (req->request->which) + switch (req->apdu_request->which) { case Z_APDU_searchRequest: res = response_searchRequest(assoc, req, 0, &fd); break; @@ -936,7 +939,7 @@ static int process_response(association *assoc, request *req, Z_APDU *res) static Z_APDU *process_initRequest(association *assoc, request *reqb) { statserv_options_block *cb = statserv_getcontrol(); - Z_InitRequest *req = reqb->request->u.initRequest; + Z_InitRequest *req = reqb->apdu_request->u.initRequest; Z_APDU *apdu = zget_APDU(assoc->encode, Z_APDU_initResponse); Z_InitResponse *resp = apdu->u.initResponse; bend_initresult *binitres; @@ -1367,7 +1370,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, static Z_APDU *process_searchRequest(association *assoc, request *reqb, int *fd) { - Z_SearchRequest *req = reqb->request->u.searchRequest; + Z_SearchRequest *req = reqb->apdu_request->u.searchRequest; bend_search_rr *bsrr = (bend_search_rr *)nmem_malloc (reqb->request_mem, sizeof(*bsrr)); @@ -1444,7 +1447,7 @@ int bend_searchresponse(void *handle, bend_search_rr *bsrr) {return 0;} static Z_APDU *response_searchRequest(association *assoc, request *reqb, bend_search_rr *bsrt, int *fd) { - Z_SearchRequest *req = reqb->request->u.searchRequest; + Z_SearchRequest *req = reqb->apdu_request->u.searchRequest; Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); Z_SearchResponse *resp = (Z_SearchResponse *) odr_malloc (assoc->encode, sizeof(*resp)); @@ -1554,7 +1557,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, static Z_APDU *process_presentRequest(association *assoc, request *reqb, int *fd) { - Z_PresentRequest *req = reqb->request->u.presentRequest; + Z_PresentRequest *req = reqb->apdu_request->u.presentRequest; oident *prefformat; oid_value form; Z_APDU *apdu; @@ -1628,7 +1631,7 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, */ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) { - Z_ScanRequest *req = reqb->request->u.scanRequest; + Z_ScanRequest *req = reqb->apdu_request->u.scanRequest; Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu)); Z_ScanResponse *res = (Z_ScanResponse *) odr_malloc (assoc->encode, sizeof(*res)); @@ -1764,7 +1767,7 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) static Z_APDU *process_sortRequest(association *assoc, request *reqb, int *fd) { - Z_SortRequest *req = reqb->request->u.sortRequest; + Z_SortRequest *req = reqb->apdu_request->u.sortRequest; Z_SortResponse *res = (Z_SortResponse *) odr_malloc (assoc->encode, sizeof(*res)); bend_sort_rr *bsrr = (bend_sort_rr *) @@ -1823,7 +1826,8 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb, static Z_APDU *process_deleteRequest(association *assoc, request *reqb, int *fd) { - Z_DeleteResultSetRequest *req = reqb->request->u.deleteResultSetRequest; + Z_DeleteResultSetRequest *req = + reqb->apdu_request->u.deleteResultSetRequest; Z_DeleteResultSetResponse *res = (Z_DeleteResultSetResponse *) odr_malloc (assoc->encode, sizeof(*res)); bend_delete_rr *bdrr = (bend_delete_rr *) @@ -1890,7 +1894,7 @@ static Z_APDU *process_deleteRequest(association *assoc, request *reqb, static void process_close(association *assoc, request *reqb) { - Z_Close *req = reqb->request->u.close; + Z_Close *req = reqb->apdu_request->u.close; static char *reasons[] = { "finished", @@ -1984,7 +1988,7 @@ static Z_APDU *process_segmentRequest (association *assoc, request *reqb) { bend_segment_rr request; - request.segment = reqb->request->u.segmentRequest; + request.segment = reqb->apdu_request->u.segmentRequest; request.stream = assoc->encode; request.decode = assoc->decode; request.print = assoc->print; @@ -1999,14 +2003,14 @@ static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd) { bend_esrequest_rr esrequest; - Z_ExtendedServicesRequest *req = reqb->request->u.extendedServicesRequest; + Z_ExtendedServicesRequest *req = reqb->apdu_request->u.extendedServicesRequest; Z_APDU *apdu = zget_APDU(assoc->encode, Z_APDU_extendedServicesResponse); Z_ExtendedServicesResponse *resp = apdu->u.extendedServicesResponse; yaz_log(LOG_DEBUG,"inside Process esRequest"); - esrequest.esr = reqb->request->u.extendedServicesRequest; + esrequest.esr = reqb->apdu_request->u.extendedServicesRequest; esrequest.stream = assoc->encode; esrequest.decode = assoc->decode; esrequest.print = assoc->print; diff --git a/server/session.h b/server/session.h index 5217a89..2e55035 100644 --- a/server/session.h +++ b/server/session.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: session.h,v $ - * Revision 1.24 2000-11-23 10:58:32 adam + * Revision 1.25 2001-07-19 19:51:42 adam + * Added typecasts to make C++ happy. + * + * Revision 1.24 2000/11/23 10:58:32 adam * SSL comstack support. Separate POSIX thread support library. * * Revision 1.23 2000/04/05 07:39:55 adam @@ -106,7 +109,7 @@ typedef struct request char *refid; /* referenceid */ request_state state; - Z_APDU *request; /* Current request */ + Z_APDU *apdu_request; /* Current request */ NMEM request_mem; /* memory handle for request */ int size_response; /* size of buffer */ diff --git a/util/nmem.c b/util/nmem.c index d337d3f..7e3fc1b 100644 --- a/util/nmem.c +++ b/util/nmem.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: nmem.c,v $ - * Revision 1.25 2001-06-26 14:11:27 adam + * Revision 1.26 2001-07-19 19:51:42 adam + * Added typecasts to make C++ happy. + * + * Revision 1.25 2001/06/26 14:11:27 adam * Added MUTEX functions for NMEM module (used by OID utility). * * Revision 1.24 2000/05/11 14:37:55 adam @@ -144,7 +147,7 @@ YAZ_EXPORT void nmem_mutex_create(NMEM_MUTEX *p) NMEM_ENTER; if (!*p) { - *p = malloc (sizeof(**p)); + *p = (NMEM_MUTEX) malloc (sizeof(**p)); #ifdef WIN32 InitializeCriticalSection(&(*p)->m_handle); #elif _REENTRANT diff --git a/ztest/ztest.c b/ztest/ztest.c index 8946137..b87258f 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -6,7 +6,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.43 2001-06-28 09:27:25 adam + * Revision 1.44 2001-07-19 19:51:42 adam + * Added typecasts to make C++ happy. + * + * Revision 1.43 2001/06/28 09:27:25 adam * Number of Extended Services Requests logged. * * Revision 1.42 2001/04/06 12:26:46 adam @@ -176,7 +179,8 @@ int ztest_present (void *handle, bend_present_rr *rr) int ztest_esrequest (void *handle, bend_esrequest_rr *rr) { - int *counter = handle; /* user-defined handle - created in bend_init */ + /* user-defined handle - created in bend_init */ + int *counter = (int*) handle; yaz_log(LOG_LOG, "ESRequest no %d", *counter); @@ -365,12 +369,14 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) } if (toKeep) { - Z_External *ext = odr_malloc (rr->stream, sizeof(*ext)); - Z_IUOriginPartToKeep *keep = - odr_malloc (rr->stream, sizeof(*keep)); - Z_IUTargetPart *targetPart = + Z_External *ext = (Z_External *) + odr_malloc (rr->stream, sizeof(*ext)); + Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *) + odr_malloc (rr->stream, sizeof(*keep)); + Z_IUTargetPart *targetPart = (Z_IUTargetPart *) odr_malloc (rr->stream, sizeof(*targetPart)); - rr->taskPackage = odr_malloc (rr->stream, sizeof(*rr->taskPackage)); + rr->taskPackage = (Z_TaskPackage *) + odr_malloc (rr->stream, sizeof(*rr->taskPackage)); rr->taskPackage->packageType = odr_oiddup (rr->stream, rr->esr->packageType); rr->taskPackage->packageName = 0; @@ -381,10 +387,10 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) rr->taskPackage->targetReference = (Odr_oct *) odr_malloc (rr->stream, sizeof(Odr_oct)); rr->taskPackage->targetReference->buf = - odr_strdup (rr->stream, "123"); + (unsigned char *) odr_strdup (rr->stream, "123"); rr->taskPackage->targetReference->len = rr->taskPackage->targetReference->size = - strlen(rr->taskPackage->targetReference->buf); + strlen((char *) (rr->taskPackage->targetReference->buf)); rr->taskPackage->creationDateTime = 0; rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0); rr->taskPackage->packageDiagnostics = 0; @@ -403,7 +409,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) ext->u.update->u.taskPackage->originPart = keep; ext->u.update->u.taskPackage->targetPart = targetPart; - keep->action = odr_malloc (rr->stream, sizeof(int)); + keep->action = (int *) odr_malloc (rr->stream, sizeof(int)); *keep->action = *toKeep->action; keep->databaseName = odr_strdup (rr->stream, toKeep->databaseName); @@ -413,9 +419,10 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) targetPart->updateStatus = odr_intdup (rr->stream, 1); targetPart->num_globalDiagnostics = 0; - targetPart->globalDiagnostics = odr_nullval(); + targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval(); targetPart->num_taskPackageRecords = 0; - targetPart->taskPackageRecords = odr_nullval(); + targetPart->taskPackageRecords = + (Z_IUTaskPackageRecordStructure **) odr_nullval(); } if (notToKeep) { -- 1.7.10.4