-
-
Notifications
You must be signed in to change notification settings - Fork 194
Fix edge cases and consolidate implementations of file I/O #1760
Copy link
Copy link
Open
Labels
bugUnexpected behavior / crashes; to be fixed ASAP!Unexpected behavior / crashes; to be fixed ASAP!optimizationThis increases performance or decreases sizeThis increases performance or decreases sizerefactoringThis PR is intended to clean up code more than change functionalityThis PR is intended to clean up code more than change functionalityrgbasmThis affects RGBASMThis affects RGBASMrgbfixThis affects RGBFIXThis affects RGBFIXrgbgfxThis affects RGBGFXThis affects RGBGFXrgblinkThis affects RGBLINKThis affects RGBLINK
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
bugUnexpected behavior / crashes; to be fixed ASAP!Unexpected behavior / crashes; to be fixed ASAP!optimizationThis increases performance or decreases sizeThis increases performance or decreases sizerefactoringThis PR is intended to clean up code more than change functionalityThis PR is intended to clean up code more than change functionalityrgbasmThis affects RGBASMThis affects RGBASMrgbfixThis affects RGBFIXThis affects RGBFIXrgbgfxThis affects RGBGFXThis affects RGBGFXrgblinkThis affects RGBLINKThis affects RGBLINK
RGBDS comprises four programs, all of which have multiple kinds of input and/or output. There are a number of issues with how they implement that:
-for stdin/stdout, including printing it as "<stdin>"/"<stdout>").read()/fread()might read fewer bytes than you requested, e.g. if the file is a pipe. That's not an error, it just means you need to loop more calls until finished./dev/zeroand/dev/urandomcan behave oddly. For example,INCBIN "/dev/zero"hangs indefinitely.-Include directories withfstk_FindFile, and actually opening the file.We would probably benefit from more high-level C++ STL file I/O, since we're manually doing things with
read(),fread(),std::filebuf, etc, whenstd::ifstreamexists.