X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/blobdiff_plain/e0701bfb3e9047a565191d1e582f7f5d97a79f5f..1f99f95d6a7eecc05cae8fb357f9b7bf564c2725:/csrc/stdio/pf_fileio_stdio.c diff --git a/csrc/stdio/pf_fileio_stdio.c b/csrc/stdio/pf_fileio_stdio.c index 9a25092..f58fbc0 100644 --- a/csrc/stdio/pf_fileio_stdio.c +++ b/csrc/stdio/pf_fileio_stdio.c @@ -3,14 +3,17 @@ ** ** This file is part of pForth ** -** The pForth software code is dedicated to the public domain, -** and any third party may reproduce, distribute and modify -** the pForth software code or any derivative works thereof -** without any compensation or license. The pForth software -** code is provided on an "as is" basis without any warranty -** of any kind, including, without limitation, the implied -** warranties of merchantability and fitness for a particular -** purpose and their equivalents under the laws of any jurisdiction. +** Permission to use, copy, modify, and/or distribute this +** software for any purpose with or without fee is hereby granted. +** +** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ** ****************************************************************/ @@ -106,20 +109,12 @@ static bool_t ExtendFile( FileStream *File, size_t Diff ) return Error; } -/* Return non-FALSE if the double-cell unsigned number LO/HI - * is greater then LONG_MAX. - */ -static bool_t IsGreaterThanLongMax( ucell_t Lo, ucell_t Hi ) -{ - return (Hi != 0) || (Lo > LONG_MAX); -} - -ThrowCode sdResizeFile( FileStream *File, ucell_t SizeLo, ucell_t SizeHi ) +ThrowCode sdResizeFile( FileStream *File, uint64_t Size ) { bool_t Error = TRUE; - if( !IsGreaterThanLongMax( SizeLo, SizeHi ) ) + if( Size <= LONG_MAX ) { - long Newsize = (long) SizeLo; + long Newsize = (long) Size; if( fseek( File, 0, SEEK_END ) == 0 ) { long Oldsize = ftell( File );