MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / WriteString

Method WriteString

neo/idlib/BitMsg.cpp:174–203  ·  view source on GitHub ↗

================ idBitMsg::WriteString ================ */

Source from the content-addressed store, hash-verified

172================
173*/
174void idBitMsg::WriteString( const char *s, int maxLength, bool make7Bit ) {
175 if ( !s ) {
176 WriteData( "", 1 );
177 } else {
178 int i, l;
179 byte *dataPtr;
180 const byte *bytePtr;
181
182 l = idStr::Length( s );
183 if ( maxLength >= 0 && l >= maxLength ) {
184 l = maxLength - 1;
185 }
186 dataPtr = GetByteSpace( l + 1 );
187 bytePtr = reinterpret_cast<const byte *>(s);
188 if ( make7Bit ) {
189 for ( i = 0; i < l; i++ ) {
190 if ( bytePtr[i] > 127 ) {
191 dataPtr[i] = '.';
192 } else {
193 dataPtr[i] = bytePtr[i];
194 }
195 }
196 } else {
197 for ( i = 0; i < l; i++ ) {
198 dataPtr[i] = bytePtr[i];
199 }
200 }
201 dataPtr[i] = '\0';
202 }
203}
204
205/*
206================

Callers 10

InspectVariableMethod · 0.45
SendAddBreakpointMethod · 0.45
SendCommandMethod · 0.45
HandleAddBreakpointMethod · 0.45
HandleInspectVariableMethod · 0.45
CheckBreakpointsMethod · 0.45
BreakMethod · 0.45
PrintMethod · 0.45
WriteToSaveGameMethod · 0.45
ReadStringMethod · 0.45

Calls 2

ReadStringMethod · 0.45
WriteBitsMethod · 0.45

Tested by

no test coverage detected