/** Ask for the pointer using sizebuf_t.cursize (RST) */ public static int GetSpace(sizebuf_t buf, int length) { int oldsize; if (buf.cursize + length > buf.maxsize) { if (!buf.allowoverflow) { Com.Error(Defines.ERR_FATAL, "SZ_GetSpace: overflow without allowoverflow set"); } if (length > buf.maxsize) { Com.Error(Defines.ERR_FATAL, "SZ_GetSpace: " + length + " is > full buffer size"); } Com.Printf("SZ_GetSpace: overflow\n"); SZ.Clear(buf); buf.overflowed = true; } oldsize = buf.cursize; buf.cursize += length; return(oldsize); }
public static void InsertText(string text) { var templen = 0; // copy off any commands still remaining in the exec buffer templen = Globals.cmd_text.cursize; if (templen != 0) { Array.Copy(Globals.cmd_text.data, 0, Cbuf.tmp, 0, templen); SZ.Clear(Globals.cmd_text); } // add the entire text of the file Cbuf.AddText(text); // add the copied off data if (templen != 0) { SZ.Write(Globals.cmd_text, Cbuf.tmp, templen); } }