----------------------------------------------------------------------------- Write to a file. The number of bytes to write is passed in size, the data is passed in src. The number of bytes written is available in bytesWritten if a non-Null pointer is provided. -----------------------------------------------------------------------------
| 761 | // pointer is provided. |
| 762 | //----------------------------------------------------------------------------- |
| 763 | File::Status File::write(U32 size, const char *src, U32 *bytesWritten) |
| 764 | { |
| 765 | // JMQ: despite the U32 parameters, the maximum filesize supported by this |
| 766 | // function is probably the max value of S32, due to the unix syscall |
| 767 | // api. |
| 768 | AssertFatal(Closed != currentStatus, "File::write: file closed"); |
| 769 | AssertFatal(NULL != handle, "File::write: invalid file handle"); |
| 770 | AssertFatal(NULL != src, "File::write: NULL source pointer"); |
| 771 | AssertFatal(true == hasCapability(FileWrite), "File::write: file lacks capability"); |
| 772 | AssertWarn(0 != size, "File::write: size of zero"); |
| 773 | |
| 774 | if ((Ok != currentStatus && EOS != currentStatus) || 0 == size) |
| 775 | return currentStatus; |
| 776 | else |
| 777 | { |
| 778 | S32 numWritten = x86UNIXWrite(*((int *)handle), src, size); |
| 779 | if (numWritten < 0) |
| 780 | return setStatus(); |
| 781 | |
| 782 | if (bytesWritten) |
| 783 | *bytesWritten = static_cast<U32>(numWritten); |
| 784 | return currentStatus = Ok; |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | //----------------------------------------------------------------------------- |
| 789 | // Self-explanatory. JMQ: No explanation needed. Move along. These aren't |
nothing calls this directly
no test coverage detected