Skip to content

Commit

Permalink
Allow 'aio copyto' and 'aio read' to copy >2GB
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Reported-by: af123 <jimdevel@hummypkg.org.uk>
  • Loading branch information
msteveb committed Feb 1, 2012
1 parent 695c66c commit c810336
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions jim-aio.c
Expand Up @@ -328,23 +328,20 @@ static int aio_cmd_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
char buf[AIO_BUF_LEN];
Jim_Obj *objPtr;
int nonewline = 0;
int neededLen = -1; /* -1 is "read as much as possible" */
jim_wide neededLen = -1; /* -1 is "read as much as possible" */

if (argc && Jim_CompareStringImmediate(interp, argv[0], "-nonewline")) {
nonewline = 1;
argv++;
argc--;
}
if (argc == 1) {
jim_wide wideValue;

if (Jim_GetWide(interp, argv[0], &wideValue) != JIM_OK)
if (Jim_GetWide(interp, argv[0], &neededLen) != JIM_OK)
return JIM_ERR;
if (wideValue < 0) {
if (neededLen < 0) {
Jim_SetResultString(interp, "invalid parameter: negative len", -1);
return JIM_ERR;
}
neededLen = (int)wideValue;
}
else if (argc) {
return -1;
Expand Down Expand Up @@ -391,16 +388,16 @@ static int aio_cmd_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int aio_cmd_copy(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
long count = 0;
long maxlen = LONG_MAX;
jim_wide count = 0;
jim_wide maxlen = LLONG_MAX;
FILE *outfh = Jim_AioFilehandle(interp, argv[0]);

if (outfh == NULL) {
return JIM_ERR;
}

if (argc == 2) {
if (Jim_GetLong(interp, argv[1], &maxlen) != JIM_OK) {
if (Jim_GetWide(interp, argv[1], &maxlen) != JIM_OK) {
return JIM_ERR;
}
}
Expand Down

0 comments on commit c810336

Please sign in to comment.