MCPcopy Create free account
hub / github.com/TurningWheel/Barony / stringCopy

Function stringCopy

src/main.cpp:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include <assert.h>
26
27char* stringCopy(char* dest, const char* src, size_t dest_size, size_t src_size) {
28 // verify input
29 assert(dest);
30 assert(src);
31 if (!dest || !src || !dest_size) {
32 return dest;
33 }
34
35 // copy string
36 if (src_size < dest_size) {
37 memcpy(dest, src, src_size);
38 dest[src_size] = '\0';
39 } else {
40 memcpy(dest, src, dest_size);
41 dest[dest_size - 1] = '\0';
42 }
43
44 return dest;
45}
46
47char* stringCopyUnsafe(char* dest, const char* src, size_t size) {
48 // verify input

Callers 14

setEntityStringMethod · 0.85
loadAllScoresJSONFunction · 0.85
loadGameFunction · 0.85
loadGameFollowersFunction · 0.85
readItemsFromFileMethod · 0.85
sendClientDataOverNetMethod · 0.85
makeFollowerFunction · 0.85
forceFollowerFunction · 0.85
lobbyPlayerJoinRequestFunction · 0.85
net.cppFile · 0.85
getCalloutMessageMethod · 0.85
setCalloutTextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected