Exemplo n.º 1
0
/*
 * open disk (obtain disk drive control block)
 *       open a device indicated by `devnm', and return the disk information in `dcb'.
 *       devnm can specify a device name with partition number.
 *       return the partition number specified by devnm.
 *       return value     0   : entire disks
 *               1 - : partition number
 *               < 0 : error
 */
EXPORT W openDisk( const UB *devnm, DISKCB **dcb_p )
{
	const CFGDISK	*cfg;
	DISKCB		*dcb;
	W		pno;
	ER		err;

        /* search for a device */
	pno = searchDevice(devnm, &cfg);
	if ( pno < E_OK ) return pno;

        /* allocating a disk control block */
	dcb = getDISKCB(cfg);

        /* initialize disk */
	err = (*cfg->initdisk)(dcb, cfg);
	if ( err < E_OK ) return err;
	if ( dcb->blksz == 0 ) return E_NOMDA;

	if ( dcb->boot == 0xff ) {
                /* read the partition information */
		err = readPart(dcb);
		if ( err < E_OK ) return err;
	}

	*dcb_p = dcb;
	return pno;
}
Exemplo n.º 2
0
void MailMessage::readMultipart(std::istream& istr, PartHandler& handler)
{
	MediaType contentType(getContentType());
	_boundary = contentType.getParameter("boundary");
	MultipartReader reader(istr, _boundary);
	while (reader.hasNextPart())
	{
		MessageHeader partHeader;
		reader.nextPart(partHeader);
		readPart(reader.stream(), partHeader, handler);
	}
}
Exemplo n.º 3
0
void MailMessage::read(std::istream& istr, PartHandler& handler)
{
	readHeader(istr);
	if (isMultipart())
	{
		readMultipart(istr, handler);
	}
	else
	{
		StringPartHandler handler(_content);
		readPart(istr, *this, handler);
	}
}
Exemplo n.º 4
0
bool FileIStream::read(void *data, unsigned int size, unsigned int &processedSize) {
	processedSize = 0;
	do {
		unsigned int processedLoc = 0;
		bool res = readPart(data, size, processedLoc);
		processedSize += processedLoc;
		if (!res)
			return false;
		if (processedLoc == 0)
			return true;
		data = (void *)((unsigned char *)data + processedLoc);
		size -= processedLoc;
	} while (size > 0);
	return true;
}
Exemplo n.º 5
0
void *partTemplateGen(char *directory, float scale)
{
  int count, i;
  part part_t;
  char filePath[100];
  FILE *tfp, *ifp;
   
  strcpy(filePath, directory);
  strcat(filePath, "/partTemplate.tbl");
  ifp = fopen(partEncFilePath, "r");
  tfp = fopen(filePath, "w");
  count = PARTMAX*scale;
  for (i=0; i<count; i++)
    {
      readPart(&part_t, ifp);
      printPartTemplate(&part_t, tfp);
      part_free(&part_t);
    }
  fclose(ifp);
  fclose(tfp);
}