read_binary_size return value on read error
This commit is contained in:
parent
fad3fc48ea
commit
9457120327
18
common.c
18
common.c
|
@ -4,6 +4,8 @@
|
||||||
*/
|
*/
|
||||||
#pragma noroot
|
#pragma noroot
|
||||||
#pragma optimize 79
|
#pragma optimize 79
|
||||||
|
#pragma debug 0x8000
|
||||||
|
#pragma lint -1
|
||||||
|
|
||||||
#include <Memory.h>
|
#include <Memory.h>
|
||||||
#include <MiscTool.h>
|
#include <MiscTool.h>
|
||||||
|
@ -39,6 +41,7 @@ int read_binary(Word ipid, FILE *file, ReadBlock *dcb)
|
||||||
DecBusy();
|
DecBusy();
|
||||||
|
|
||||||
count = rb.rrBuffCount;
|
count = rb.rrBuffCount;
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
if (rv) break;
|
if (rv) break;
|
||||||
|
@ -48,6 +51,8 @@ int read_binary(Word ipid, FILE *file, ReadBlock *dcb)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tcount = fwrite(buffer, 1, count, file);
|
tcount = fwrite(buffer, 1, count, file);
|
||||||
if (dcb) dcb->transferCount += tcount;
|
if (dcb) dcb->transferCount += tcount;
|
||||||
|
|
||||||
|
@ -89,9 +94,11 @@ int read_binary_size(Word ipid, FILE *file, ReadBlock *dcb)
|
||||||
DecBusy();
|
DecBusy();
|
||||||
|
|
||||||
count = rb.rrBuffCount;
|
count = rb.rrBuffCount;
|
||||||
|
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
if (rv) break;
|
if (rv) return -1;
|
||||||
IncBusy();
|
IncBusy();
|
||||||
TCPIPPoll();
|
TCPIPPoll();
|
||||||
DecBusy();
|
DecBusy();
|
||||||
|
@ -109,16 +116,15 @@ int read_binary_size(Word ipid, FILE *file, ReadBlock *dcb)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ConnectLoop(char *host, Word port, Connection *connection)
|
int ConnectLoop(char *host, Word port, Connection *connection)
|
||||||
{
|
{
|
||||||
LongWord qtick;
|
LongWord qtick;
|
||||||
|
|
||||||
ConnectionInit(connection, MMStartUp(), flags._v ? DisplayCallback : NULL);
|
ConnectionInit(connection, MMStartUp(), flags._v ? DisplayCallback : NULL);
|
||||||
ConnectionOpenC(connection, host, port);
|
ConnectionOpenC(connection, host, port);
|
||||||
|
|
||||||
// 30 second timeout.
|
// 30 second timeout.
|
||||||
qtick = GetTick() + 30 * 60;
|
qtick = GetTick() + 30 * 60;
|
||||||
|
@ -156,4 +162,4 @@ int CloseLoop(Connection *connection)
|
||||||
while (!ConnectionPoll(connection)) ; // wait for it to close.
|
while (!ConnectionPoll(connection)) ; // wait for it to close.
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue