fix for 64 bit machines

This commit is contained in:
zimoch
2011-09-14 09:08:17 +00:00
parent 1d5c7adb61
commit 31dae22428

View File

@ -205,7 +205,7 @@ class AsynDriverInterface : StreamBusInterface
void connectHandler(); void connectHandler();
void disconnectHandler(); void disconnectHandler();
bool connectToAsynPort(); bool connectToAsynPort();
void asynReadHandler(const char *data, int numchars, int eomReason); void asynReadHandler(const char *data, size_t numchars, int eomReason);
asynQueuePriority priority() { asynQueuePriority priority() {
return static_cast<asynQueuePriority> return static_cast<asynQueuePriority>
(StreamBusInterface::priority()); (StreamBusInterface::priority());
@ -643,9 +643,10 @@ writeHandler()
status = pasynOctet->write(pvtOctet, pasynUser, status = pasynOctet->write(pvtOctet, pasynUser,
outputBuffer, outputSize, &written); outputBuffer, outputSize, &written);
debug("AsynDriverInterface::writeHandler(%s): " debug("AsynDriverInterface::writeHandler(%s): "
"write(..., outputSize=%d, written=%d) [timeout=%f seconds] = %s\n", "write(..., outputSize=%ld, written=%ld) "
clientName(), outputSize, written, pasynUser->timeout, "[timeout=%f seconds] = %s\n",
asynStatusStr[status]); clientName(), (long)outputSize, (long)written,
pasynUser->timeout, asynStatusStr[status]);
// Up to asyn 4.17 I can't see when the server has disconnected. Why? // Up to asyn 4.17 I can't see when the server has disconnected. Why?
int connected; int connected;
@ -816,7 +817,7 @@ readHandler()
} while (deveoslen); } while (deveoslen);
} }
int bytesToRead = peeksize; long bytesToRead = peeksize;
long buffersize; long buffersize;
if (expectedLength > 0) if (expectedLength > 0)
@ -863,9 +864,10 @@ readHandler()
if (ioAction == Read || status != asynTimeout) if (ioAction == Read || status != asynTimeout)
{ {
debug("AsynDriverInterface::readHandler(%s): " debug("AsynDriverInterface::readHandler(%s): "
"read(..., bytesToRead=%d, ...) [timeout=%f seconds] = %s\n", "read(..., bytesToRead=%ld, received=%ld...) "
clientName(), bytesToRead, pasynUser->timeout, "[timeout=%f seconds] = %s\n",
asynStatusStr[status]); clientName(), bytesToRead, (long)received,
pasynUser->timeout, asynStatusStr[status]);
} }
pasynManager->isConnected(pasynUser, &connected); pasynManager->isConnected(pasynUser, &connected);
debug("AsynDriverInterface::readHandler(%s): " debug("AsynDriverInterface::readHandler(%s): "
@ -896,10 +898,10 @@ readHandler()
{ {
#ifndef NO_TEMPORARY #ifndef NO_TEMPORARY
debug("AsynDriverInterface::readHandler(%s): " debug("AsynDriverInterface::readHandler(%s): "
"AsyncRead poll: received %d of %d bytes \"%s\" " "AsyncRead poll: received %ld of %ld bytes \"%s\" "
"eomReason=%s [data ignored]\n", "eomReason=%s [data ignored]\n",
clientName(), (int)received, bytesToRead, clientName(), (long)received, bytesToRead,
StreamBuffer(buffer, (int)received).expand()(), StreamBuffer(buffer, received).expand()(),
eomReasonStr[eomReason&0x7]); eomReasonStr[eomReason&0x7]);
#endif #endif
// ignore what we got from here. // ignore what we got from here.
@ -910,10 +912,10 @@ readHandler()
} }
#ifndef NO_TEMPORARY #ifndef NO_TEMPORARY
debug("AsynDriverInterface::readHandler(%s): " debug("AsynDriverInterface::readHandler(%s): "
"received %d of %d bytes \"%s\" " "received %ld of %ld bytes \"%s\" "
"eomReason=%s\n", "eomReason=%s\n",
clientName(), (int)received, bytesToRead, clientName(), (long)received, bytesToRead,
StreamBuffer(buffer, (int)received).expand()(), StreamBuffer(buffer, received).expand()(),
eomReasonStr[eomReason&0x7]); eomReasonStr[eomReason&0x7]);
#endif #endif
// asynOctet->read() cuts off terminator, but: // asynOctet->read() cuts off terminator, but:
@ -969,9 +971,10 @@ readHandler()
// read timeout // read timeout
#ifndef NO_TEMPORARY #ifndef NO_TEMPORARY
debug("AsynDriverInterface::readHandler(%s): " debug("AsynDriverInterface::readHandler(%s): "
"ioAction=%s, timeout [%f seconds] after %d of %d bytes \"%s\"\n", "ioAction=%s, timeout [%f seconds] "
"after %ld of %ld bytes \"%s\"\n",
clientName(), ioActionStr[ioAction], pasynUser->timeout, clientName(), ioActionStr[ioAction], pasynUser->timeout,
(int)received, bytesToRead, (long)received, bytesToRead,
StreamBuffer(buffer, received).expand()()); StreamBuffer(buffer, received).expand()());
#endif #endif
if (ioAction == AsyncRead || ioAction == AsyncReadMore) if (ioAction == AsyncRead || ioAction == AsyncReadMore)
@ -1032,7 +1035,7 @@ readHandler()
bytesToRead = inputBuffer.capacity(); bytesToRead = inputBuffer.capacity();
} }
debug("AsynDriverInterface::readHandler(%s) " debug("AsynDriverInterface::readHandler(%s) "
"readMore=%ld bytesToRead=%d\n", "readMore=%ld bytesToRead=%ld\n",
clientName(), readMore, bytesToRead); clientName(), readMore, bytesToRead);
pasynUser->timeout = readTimeout; pasynUser->timeout = readTimeout;
waitForReply = false; waitForReply = false;
@ -1064,7 +1067,7 @@ void intrCallbackOctet(void* /*pvt*/, asynUser *pasynUser,
// get asynchronous input // get asynchronous input
void AsynDriverInterface:: void AsynDriverInterface::
asynReadHandler(const char *buffer, int received, int eomReason) asynReadHandler(const char *buffer, size_t received, int eomReason)
{ {
// Due to multithreading, timerExpired() might come at any time. // Due to multithreading, timerExpired() might come at any time.
// It queues the next poll request which is now useless because // It queues the next poll request which is now useless because
@ -1080,9 +1083,9 @@ asynReadHandler(const char *buffer, int received, int eomReason)
#ifndef NO_TEMPORARY #ifndef NO_TEMPORARY
debug("AsynDriverInterface::asynReadHandler(%s, buffer=\"%s\", " debug("AsynDriverInterface::asynReadHandler(%s, buffer=\"%s\", "
"received=%d eomReason=%s) ioAction=%s\n", "received=%ld eomReason=%s) ioAction=%s\n",
clientName(), StreamBuffer(buffer, received).expand()(), clientName(), StreamBuffer(buffer, received).expand()(),
received, eomReasonStr[eomReason&0x7], ioActionStr[ioAction]); (long)received, eomReasonStr[eomReason&0x7], ioActionStr[ioAction]);
#endif #endif
ioAction = None; ioAction = None;
@ -1138,7 +1141,7 @@ asynReadHandler(const char *buffer, int received, int eomReason)
// set by stream, cut it off now. // set by stream, cut it off now.
status = pasynOctet->getInputEos(pvtOctet, status = pasynOctet->getInputEos(pvtOctet,
pasynUser, deveos, sizeof(deveos)-1, &deveoslen); pasynUser, deveos, sizeof(deveos)-1, &deveoslen);
if (status == asynSuccess && received >= deveoslen) if (status == asynSuccess && (long)received >= (long)deveoslen)
{ {
int i; int i;
for (i = 1; i <= deveoslen; i++) for (i = 1; i <= deveoslen; i++)