Пример #1
0
int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub)
{
	struct burn_drive *d = o->drive;
	unsigned char subs[96];
	unsigned char *data;

	data = get_sector(o, t, t->mode);
	if (data == NULL)
		return 0;
	/* ts A61010 */
	if (convert_data(o, t, t->mode, data) <= 0)
		return 0;

	/* ts A61031 */
	if ((t->open_ended || t->end_on_premature_eoi) && t->track_data_done) {
		unget_sector(o, t->mode);
		return 2;
	}

	/* ts A61219 : allow track without .entry */
	if (t->entry == NULL)
		;
	else if (!t->source->read_sub)
		subcode_user(o, subs, t->entry->point,
			     t->entry->control, 1, &t->isrc, psub);
	else if (!t->source->read_sub(t->source, subs, 96))
		subcode_user(o, subs, t->entry->point,
			     t->entry->control, 1, &t->isrc, psub);
	convert_subs(o, t->mode, subs, data);

	if (sector_headers(o, data, t->mode, 0) <= 0)
		return 0;
	sector_common(++)
	return 1;
}
Пример #2
0
bool CCOutput::write_data(const ByteArray &data)
{
	Q_UNUSED(data);
	convert_data(data);
	bool result = write();
	try_pause();
	return result;
}
Пример #3
0
PUBLIC void
put_scrap(int type, int srclen, char *src)
{
  scrap_type format;
  int dstlen;
  char *dst;

  format = convert_format(type);
  dstlen = convert_data(type, NULL, src, srclen);

#if defined(X11_SCRAP)
/* * */
  dst = (char *)alloca(dstlen);
  if ( dst != NULL )
    {
      convert_data(type, dst, src, srclen);
      XChangeProperty(SDL_Display, DefaultRootWindow(SDL_Display),
		      XA_CUT_BUFFER0, format, 8, PropModeReplace,
		      (unsigned char *) dst, dstlen);
      if ( we_lost_clipboard() )
        XSetSelectionOwner(SDL_Display, XA_PRIMARY, SDL_Window, CurrentTime);
    }

#elif defined(WIN_SCRAP)
/* * */
  if ( OpenClipboard(SDL_Window) )
    {
      HANDLE hMem;

      hMem = GlobalAlloc((GMEM_MOVEABLE|GMEM_DDESHARE), dstlen);
      if ( hMem != NULL )
        {
          dst = (char *)GlobalLock(hMem);
          convert_data(type, dst, src, srclen);
          GlobalUnlock(hMem);
          EmptyClipboard();
          SetClipboardData(format, hMem);
        }
      CloseClipboard();
    }

#endif /* scrap type */
}
Пример #4
0
void CLCDDisplay::update()
{
#ifndef HAVE_GENERIC_HARDWARE
	convert_data();
	if(paused || !available)
		return;
	else
		if ( write(fd, lcd, LCD_BUFFER_SIZE) < 0) {
			perror("lcdd: CLCDDisplay::update(): write()");
		}
#endif
}
Пример #5
0
int vmailmgr_autoconvert(void)
{
  int writefd = -1;
  ibuf reader;
  struct cdb_make writer;
  int error = 0;
  int readall = 0;
  int writerr = 0;
  if ((writefd = path_mktemp(pwfile, &tmppwfile)) != -1) {

    if (cdb_make_start(&writer, writefd) != 0)
      error = CVME_IO | CVME_FATAL;
    else {

      if (ibuf_open(&reader, pwfile, 0)) {

	uint32 end;
	struct stat st;
	if (fstat(reader.io.fd, &st) == 0
	    && fchmod(writefd, st.st_mode) == 0
	    && fchown(writefd, st.st_uid, st.st_gid) == 0
	    && read_start(&reader, &end)) {
	  while (ibuf_tell(&reader) < end) {
	    if (!read_cdb_pair(&reader, &key, &data))
	      break;
	    if (str_diff(&key, &virtuser) == 0)
	      if (!convert_data()) {
		writerr = 1;
		break;
	      }
	    if (cdb_make_add(&writer, key.s, key.len, data.s, data.len) != 0) {
	      writerr = 1;
	      break;
	    }
	  }
	  readall = ibuf_tell(&reader) == end;
	}
	ibuf_close(&reader);
      }
      if (cdb_make_finish(&writer) != 0)
	error |= CVME_FATAL;
      else
	if (readall && !writerr)
	  rename(tmppwfile.s, pwfile);
    }
    close(writefd);
    unlink(tmppwfile.s);
  }
  return error;
}
Пример #6
0
void input_to_pkt(struct INPUT* inputModel, struct PACKET* packet, struct SPECIAL_INPUT* p_input) {
	packet->header = HEADER;
	switch(p_input->updated) {
		case true:
			packet->modecommand = P_VALUES_MODE;
			packet->data = convert_p_values_to_data(p_input);
			p_input->updated = false;
			break;
		case false:
			packet->modecommand = convert_modecommand(inputModel->mode);
			packet->data = convert_data(inputModel);
			break;
	}
	packet->checksum = CALCULATE_CHECKSUM(packet->modecommand, packet->data);
}
Пример #7
0
int sector_lout(struct burn_write_opts *o, unsigned char control, int mode)
{
	struct burn_drive *d = o->drive;
	unsigned char subs[96];
	unsigned char *data;

	data = get_sector(o, NULL, mode);
	if (!data)
		return 0;
	/* ts A61010 */
	if (convert_data(o, NULL, mode, data) <= 0)
		return 0;
	subcode_lout(o, control, subs);
	convert_subs(o, mode, subs, data);
	if (sector_headers(o, data, mode, 0) <= 0)
		return 0;
	sector_common(++)
	return 1;
}
Пример #8
0
int sector_toc(struct burn_write_opts *o, int mode)
{
	struct burn_drive *d = o->drive;
	unsigned char *data;
	unsigned char subs[96];

	data = get_sector(o, NULL, mode);
	if (data == NULL)
		return 0;
	/* ts A61010 */
	if (convert_data(o, NULL, mode, data) <= 0)
		return 0;
	subcode_toc(d, mode, subs);
	convert_subs(o, mode, subs, data);
	if (sector_headers(o, data, mode, 1) <= 0)
		return 0;
	sector_common(++)
	return 1;
}
Пример #9
0
int sector_pregap(struct burn_write_opts *o,
		   unsigned char tno, unsigned char control, int mode)
{
	struct burn_drive *d = o->drive;
	unsigned char *data;
	unsigned char subs[96];

	data = get_sector(o, NULL, mode);
	if (data == NULL)
		return 0;
	/* ts A61010 */
	if (convert_data(o, NULL, mode, data) <= 0)
		return 0;
	subcode_user(o, subs, tno, control, 0, NULL, 1);
	convert_subs(o, mode, subs, data);
	if (sector_headers(o, data, mode, 0) <= 0)
		return 0;
	sector_common(--)
	return 1;
}
Пример #10
0
/**
 * write_data_to_file - writes data in file with certain format
 * @payload: infocoll message
 */
int write_data_to_file(char *payload, FILE *fp, int file_format) {
	if (file_format == TEXT) { 
		unsigned char type = payload[0];

		uint64_t time_sec, time_nsec
			, f1, f2, f3, f4, f5;
		convert_data(payload, &time_sec, &time_nsec, &f1, &f2, &f3, &f4, &f5);

		fprintf(fp, "%d\t" // type
			   "%llu.%09llu\t" // time
			   "%llu\t" // f1
			   "%llu\t" // f2
			   "%llu\t" // f3
			   "%llu\t" // f4
			   "%llu\t\n" // f5
			   , type, time_sec, time_nsec, f1, f2, f3, f4, f5);
	}
	
	if (file_format == BINARY) {
		fwrite(payload, 1, PAYLOAD_SIZE, fp);
	}

	fflush(fp);
}
Пример #11
0
void
put_scrap(int type, int srclen, char *src)
{
    scrap_type format;
    int dstlen;
#if (defined(WZ_WS_X11) || defined(WZ_WS_WIN) || defined(WZ_WS_QNX))
    char *dst;
#endif

    format = convert_format(type);
    dstlen = convert_data(type, NULL, src, srclen);

#if defined(WZ_WS_X11)
    dst = (char *)malloc(dstlen);
    if ( dst != NULL )
    {
        Lock_Display();
        convert_data(type, dst, src, srclen);
        XChangeProperty(SDL_Display, DefaultRootWindow(SDL_Display),
                        XA_CUT_BUFFER0, format, 8, PropModeReplace, (unsigned char *)dst, dstlen);
        free(dst);
        if ( lost_scrap() )
            XSetSelectionOwner(SDL_Display, XA_PRIMARY, SDL_Window, CurrentTime);
        Unlock_Display();
    }

#elif defined(WZ_WS_WIN)
    /* * */
    if ( OpenClipboard(SDL_Window) )
    {
        HANDLE hMem;

        hMem = GlobalAlloc((GMEM_MOVEABLE|GMEM_DDESHARE), dstlen);
        if ( hMem != NULL )
        {
            dst = (char *)GlobalLock(hMem);
            convert_data(type, dst, src, srclen);
            GlobalUnlock(hMem);
            EmptyClipboard();
            SetClipboardData(format, hMem);
        }
        CloseClipboard();
    }

#elif defined(WZ_WS_QNX)
    /* * */
#if (_NTO_VERSION < 620) /* before 6.2.0 releases */
    {
        PhClipHeader clheader= {Ph_CLIPBOARD_TYPE_TEXT, 0, NULL};
        int* cldata;
        int status;

        dst = (char *)malloc(dstlen+4);
        if (dst != NULL)
        {
            cldata=(int*)dst;
            *cldata=type;
            convert_data(type, dst+4, src, srclen);
            clheader.data=dst;
            if (dstlen>65535)
            {
                clheader.length=65535; /* maximum photon clipboard size :( */
            }
            else
            {
                clheader.length=dstlen+4;
            }
            status=PhClipboardCopy(InputGroup, 1, &clheader);
            if (status==-1)
            {
                fprintf(stderr, "Photon: copy to clipboard was failed !\n");
            }
            free(dst);
        }
    }
#else /* 6.2.0 and 6.2.1 and future releases */
    {
        PhClipboardHdr clheader= {Ph_CLIPBOARD_TYPE_TEXT, 0, NULL};
        int* cldata;
        int status;

        dst = (char *)malloc(dstlen+4);
        if (dst != NULL)
        {
            cldata=(int*)dst;
            *cldata=type;
            convert_data(type, dst+4, src, srclen);
            clheader.data=dst;
            clheader.length=dstlen+4;
            status=PhClipboardWrite(InputGroup, 1, &clheader);
            if (status==-1)
            {
                fprintf(stderr, "Photon: copy to clipboard was failed !\n");
            }
            free(dst);
        }
    }
#endif
#endif /* scrap type */
}