MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SlCopyBytes

Function SlCopyBytes

src/saveload/saveload.cpp:783–797  ·  view source on GitHub ↗

* Save/Load bytes. These do not need to be converted to Little/Big Endian * so directly write them or read them to/from file * @param ptr The source or destination of the object being manipulated * @param length number of bytes this fast CopyBytes lasts */

Source from the content-addressed store, hash-verified

781 * @param length number of bytes this fast CopyBytes lasts
782 */
783static void SlCopyBytes(void *ptr, size_t length)
784{
785 uint8_t *p = (uint8_t *)ptr;
786
787 switch (_sl.action) {
788 case SLA_LOAD_CHECK:
789 case SLA_LOAD:
790 for (; length != 0; length--) *p++ = SlReadByte();
791 break;
792 case SLA_SAVE:
793 for (; length != 0; length--) SlWriteByte(*p++);
794 break;
795 default: NOT_REACHED();
796 }
797}
798
799/** Get the length of the current object */
800size_t SlGetFieldLength()

Callers 3

SlReadStringFunction · 0.85
SlStdStringFunction · 0.85
SlCopyInternalFunction · 0.85

Calls 3

SlReadByteFunction · 0.85
SlWriteByteFunction · 0.85
NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected