MCPcopy Create free account
hub / github.com/assaultcube/AC / hexbinwrite

Function hexbinwrite

source/src/worldio.cpp:1244–1261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1242static vector<uchar> hexbin;
1243
1244void hexbinwrite(stream *f, void *data, int len, bool ascii = true) // write block of binary data as hex values with up to 24 bytes per line
1245{
1246 string asc;
1247 uchar *s = (uchar *) data;
1248 while(len > 0)
1249 {
1250 int chunk = min(len, 24);
1251 f->printf("hexbinchunk");
1252 loopi(chunk)
1253 {
1254 asc[i] = isalnum(*s) ? *s : '.'; asc[i + 1] = '\0';
1255 f->printf(" %02x", int(*s++));
1256 }
1257 if(ascii) f->printf(" // %s\n", asc);
1258 else f->printf("\n");
1259 len -= chunk;
1260 }
1261}
1262
1263COMMANDF(hexbinchunk, "v", (char **args, int numargs) // read up to 24 bytes from the command's arguments to the hexbin buffer
1264{

Callers 2

writeMethod · 0.85
loopvMethod · 0.85

Calls 2

minFunction · 0.85
printfMethod · 0.45

Tested by

no test coverage detected