[x264-devel] some questions about "x264_is_regular_file" & "x264_is_regular_file_path" in file "common\osdep.h"

zxfishhack zxfishhack at 126.com
Fri Mar 30 18:57:46 CEST 2012


There is some problem that using a pipe for input stream of x264.exe on Window Platform, I think the problem is the two functions I mention.
I think it's check the return value in wrong way.

In the function mention in the topic, I found the code below:

    if( fstat( fileno( filehandle ), &file_stat ) )
        return -1;

    if( stat( filename, &file_stat ) )
        return -1;

but when I check for fstat & stat in MSDN and Linux man page @linux.die.net , I found the return value is defined below:
fstat - Linux man page(link: http://linux.die.net/man/2/fstat)

Return Value
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. 

stat - Linux man page(link: http://linux.die.net/man/2/stat)

Return Value
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. 

and also in MSDN Library.

fstat :

Return Value
Returns 0 if the file-status information is obtained. A return value of ¨C1 indicates an error. If the file descriptor is invalid or buffer is NULL, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, errno is set to EBADF, in the case of an invalid file descriptor, or to EINVAL, if buffer is NULL. 

stat :

Return Value
Each of these functions returns 0 if the file-status information is obtained. A return value of ¨C1 indicates an error, in which case errno is set to ENOENT, indicating that the filename or path could not be found. A return value of EINVAL indicates an invalid parameter; errno is also set to EINVAL in this case. 

SORRY FOR MY POOR ENGLISH.



zxfishhack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20120331/636bab60/attachment.html>


More information about the x264-devel mailing list