You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do not retrieve size by opening a handle and by calling GetFileSizeEx.
Instead use the GetFileAttributesExA, which doesn't need an open handle and is basically a wrapper for the NtQueryFullAttributesFile syscall.
It is faster by the order of a magnitude.
Also the return of "-1" with return type of uintmax_t is a bug as its unsigned and checking if the return value is < 0 will never true (Technically you could still check for == -1, but it is not a good design as the return type does imply otherwise).
Throw instead, or use optional or some other way to signal an error.
The text was updated successfully, but these errors were encountered:
Thank you! It's my first time writing code using pure Win32 and most(if not all) of the implementation are naïve, so I'll make the necessary adjustments where necessary. Please note that the code as-is doesn't compile and haven't been tested AT ALL, so a lot of it will be changing before I declare it usable.
tinydircpp/tiny_fs/tinydircpp.cpp
Line 187 in be8e92c
Do not retrieve size by opening a handle and by calling GetFileSizeEx.
Instead use the GetFileAttributesExA, which doesn't need an open handle and is basically a wrapper for the NtQueryFullAttributesFile syscall.
It is faster by the order of a magnitude.
Also the return of "-1" with return type of uintmax_t is a bug as its unsigned and checking if the return value is < 0 will never true (Technically you could still check for == -1, but it is not a good design as the return type does imply otherwise).
Throw instead, or use optional or some other way to signal an error.
The text was updated successfully, but these errors were encountered: