Ejemplo n.º 1
0
unsigned int
rd_unsigned2(fd)
{
	char buf[2];

	rd_bytes(fd, buf, 2L);
	return uget2(buf);
}
Status BinCommon::rd_value(CommandInitiator* thread, Binary& value)
{
  uint size;
  Status status = rd_value(thread, size);
  if (status == OK) {
    if (size > 0) { // protect from unrealistic size?
      value.reserve(size);
      status = rd_bytes(thread, size, (char*) value.data());
    }
  }
  return status;
}
 Status BinCommon::rd_value(CommandInitiator* thread, String& value)  
 {
   uint size;
   Status status = rd_value(thread, size);
   if (status == OK && size > 0) {
     value = String(size+1);
     if ((status = rd_bytes(thread, size, (char*)value.data())) != OK) return status;
     ((char*)value.data())[size]=0;
   } else {
     value = String();
   }
   return status;   
 }
Ejemplo n.º 4
0
static
void OUTREAD(int p, char *b, long n)
{
	register long l = outseek[p];

	if (currpos != l) {
		lseek(outfile, l, 0);
	}
	rd_bytes(outfile, b, n);
	l += n;
	currpos = l;
	outseek[p] = l;
}