On 6/23/06, Arkady V.Belousov <[EMAIL PROTECTED]> wrote:
> Hi!
>
> 18-Июн-2006 06:43 [EMAIL PROTECTED] (Blair Campbell) wrote to
> [EMAIL PROTECTED]:
>
> BC> +++ lfnfuncs.c      18 Jun 2006 06:43:52 -0000      1.2
> BC> +#define _PUSH_DS __emit__(0x1E)
> BC> +#define _PUSH_ES __emit__(0x06)
> BC> +#define _POP_DS  __emit__(0x1F)
> BC> +#define _POP_ES  __emit__(0x07)
> BC>  char * getshortfilename( const char *longfilename )
> BC> +    _PUSH_DS;
> BC> +    _PUSH_ES;
> BC>      _DS = FP_SEG( longfilename );
> BC>      _SI = FP_OFF( longfilename );
> BC>      _ES = FP_SEG( shortfilename );
>
>      Note: saving ES _isn't_ required. Only DS should be preserved.
>
> BC> +    return( ( _CFLAG || _AX == 0x7100 ) ?
> BC> +            strcpy( shortfilename, longfilename ) : shortfilename );
>
>      May you explain, why you copy longfilname to shortfilename? Especially,
> there is latent bug, because shortfilename is local buffer, which will be
> overwritten by subsequent calls to getshortfilename(). May be, this is your
> way to eliminate error message (about returning const string as non-const)?
> But why you not add const modifier for return type?

There is nothing wrong with it being overwritten by subsequent calls,
because it is only used to help clib functions see long filenames.
>
> BC> +static void __creat_or_truncate( const char * filename, int mode )
> BC> +    if( _CFLAG || ( handle = _AX ) == 0x7100 )
> BC> +        handle = creatnew( filename, mode );
> BC> +    _close( handle );
>
>      Same question: why you try to mix assign with comparision? This is one
> line shorter in source, but harder to read (and understand) and less
> code-efficient, than:
>
> if (_CFLAG || _AX == 0x7100)
>   _AX = creatnew (filename, mode);
> _close (_AX);
>
> BC> -FILE * lfnfopen( const char *filename, const char *mode )
> BC> +FILE * lfnfopen( const char *filename, char *mode )
>
>      Why?
>
> BC> +    if( strchr( mode, 'a' ) != NULL )
> BC> +        __creat_or_truncate( filename, 0 );
> BC> +    else if( strchr( mode, 'w' ) != NULL )
> BC> +        __creat_or_truncate( filename, 0 );
>
> if (strchr( mode, 'a' ) ||
>     strchr( mode, 'w' ))
>   __creat_or_truncate (filename, 0);
>
> BC>  int lfnopen( const char *filename, int access, ... )
> BC> +    if( access & O_CREAT ) {
> BC> +        unsigned int mode = 0;
> BC> +        mode = va_arg( vargs, unsigned );
> BC> +        access |= O_CREAT;
> BC> +        __creat_or_truncate( filename, mode );
> BC> +    }
>
>      First: `access' is already contains O_CREAT bit set, so |= above is
> redundant. Or there is bug and this bit should be cleared?

Please read newer revisions before picking at old ones.
>
>      Second, optimization all of this block:
>
> if (access & O_CREAT)
>     __creat_or_truncate (filename, va_arg (vargs, unsigned));
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Freedos-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
>


-- 
Fall is my favorite season in Los Angeles, watching the birds change
color and fall from the trees.
   David Letterman (1947 - )

See ya
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to