int main(void)
{
  do_mult("1", "3");
  do_mult("9", "2");
  do_mult("10", "42");
  do_mult("9", "99");
  do_convert("101010", "01");
  do_convert("2A", "0123456789ABCDEF");
  do_substract("10", "5");
  do_substract("11", "9");
  do_substract("100", "99");
  do_divide("10", "2");
  do_divide("21", "2");
  do_divide("500", "4");
  do_divide("500", "25");
  do_divide("500000000000000005", "5");
  do_divide("500000000500000005", "5");
  do_divide("500000000500000005", "2");
  do_divide("833", "42");
  do_divide("50458", "357");
  do_divide("80303", "42");
  do_mod("10", "2");
  do_mod("11", "2");
  do_mod("50", "4");
  do_mod("50000", "7");
  do_mod("50000", "365");
  converter("101010", "01", "0123456789ABCDEF");
  converter("101010", "01", "0123456789");
  converter("11101110", "01", "abcdefghij");
  converter("99989998", "89", "abcdefghij");
  return 0;
}
Beispiel #2
0
static void convert(struct snd_pcm_plugin *plugin,
		    const struct snd_pcm_plugin_channel *src_channels,
		    struct snd_pcm_plugin_channel *dst_channels,
		    snd_pcm_uframes_t frames)
{
	struct linear_priv *data = (struct linear_priv *)plugin->extra_data;
	int channel;
	int nchannels = plugin->src_format.channels;
	for (channel = 0; channel < nchannels; ++channel) {
		char *src;
		char *dst;
		int src_step, dst_step;
		snd_pcm_uframes_t frames1;
		if (!src_channels[channel].enabled) {
			if (dst_channels[channel].wanted)
				snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
			dst_channels[channel].enabled = 0;
			continue;
		}
		dst_channels[channel].enabled = 1;
		src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
		dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
		src_step = src_channels[channel].area.step / 8;
		dst_step = dst_channels[channel].area.step / 8;
		frames1 = frames;
		while (frames1-- > 0) {
			do_convert(data, dst, src);
			src += src_step;
			dst += dst_step;
		}
	}
}
Beispiel #3
0
int main(object me,string arg)
//arg should be like this: "/d/fy/ 15,4,3" like this
{
    string *files;
    string dir;
    int i;
    int size;
    set_eval_limit(1); 
    seteuid(getuid());
    
    return notify_fail("
此命令用于转换相对坐标,破坏性极大,
风云4.0已完成此项工作,如果需要使用此命令请阅读修改此文件后执行。\n");

    sscanf(arg,"%s %d,%d,%d",dir,xcenter,ycenter,zcenter);    
    
    files= get_dir(dir);
    
    for(i=0; i<sizeof(files); i++) 
    {
        size=sizeof(files[i]);
        if(files[i][(size-2)..size]==".c")
        {
            do_convert(dir+files[i]);
        }
    }
    return 1;
}
Beispiel #4
0
bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
                          const char * src_charset)
  {
  iconv_t ic;
  bool result;
  ic = iconv_open("UTF-8", src_charset);
  result = do_convert(ic, src, src_len, dst, NULL);
  iconv_close(ic);
  return result;
  }
Beispiel #5
0
bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst,
                            int * dst_len, const char * dst_charset)
  {
  iconv_t ic;
  bool result;
  ic = iconv_open(dst_charset, "UTF-8");
  result = do_convert(ic, src, -1, dst, dst_len);
  iconv_close(ic);
  return result;
  }
Beispiel #6
0
int dropbearconvert_main(int argc, char ** argv) {
#else 
int main(int argc, char ** argv) {
#endif

	int intype, outtype;
	const char* infile;
	const char* outfile;

	crypto_init();
	seedrandom();

#if DEBUG_TRACE
	/* It's hard for it to get in the way _too_ much */
	debug_trace = 1;
#endif

	/* get the commandline options */
	if (argc != 5) {
		fprintf(stderr, "All arguments must be specified\n");
		goto usage;
	}

	/* input type */
	if (argv[1][0] == 'd') {
		intype = KEYFILE_DROPBEAR;
	} else if (argv[1][0] == 'o') {
		intype = KEYFILE_OPENSSH;
	} else {
		fprintf(stderr, "Invalid input key type\n");
		goto usage;
	}

	/* output type */
	if (argv[2][0] == 'd') {
		outtype = KEYFILE_DROPBEAR;
	} else if (argv[2][0] == 'o') {
		outtype = KEYFILE_OPENSSH;
	} else {
		fprintf(stderr, "Invalid output key type\n");
		goto usage;
	}

	/* we don't want output readable by others */
	umask(077);

	infile = argv[3];
	outfile = argv[4];

	return do_convert(intype, infile, outtype, outfile);

usage:
	printhelp(argv[0]);
	return 1;
}
Beispiel #7
0
int main(int argc, char **argv) {
    int opt;
    struct state st;

    memset(&st, 0, sizeof(st));
    st.bytes = 0x23d0;

    while ((opt = getopt(argc, argv, "i:o:s:v")) != -1) {
        switch(opt) {
            case 'i':
                if (st.in_fd)
                    close(st.in_fd);
                st.in_fd = open(optarg, O_RDONLY);
                if (-1 == st.in_fd) {
                    perror("Unable to open ram stream");
                    return 1;
                }
                break;

            case 'o':
                if (st.out_fd)
                    close(st.out_fd);
                st.out_fd = open(optarg, O_WRONLY | O_CREAT | O_TRUNC, 0644);
                if (-1 == st.out_fd) {
                    perror("Unable to open output stream");
                    return 1;
                }
                break;

            case 'v':
                st.verbose++;
                break;

            case 'b':
                st.bytes = strtoul(optarg, NULL, 0);
                break;

            case 'h':
            default:
                return print_usage(argv[0]);
        }
    }

    if (!st.out_fd || !st.in_fd)
        return print_usage(argv[0]);

    argv += optind;
    argc -= optind;

    return do_convert(&st);
}
Beispiel #8
0
/*
 * take the input as a pascal string and return a converted c-string in UTF-8
 * returns the number of bytes read, return -1 if fatal error
 * the converted UTF-8 will be saved in ret
 * Return: *ret != NULL
 */
gint qq_get_vstr(gchar **ret, const gchar *from_charset, guint8 *data)
{
	guint8 len;

	g_return_val_if_fail(data != NULL && from_charset != NULL, -1);

	len = data[0];
	if (len == 0) {
		*ret = g_strdup("");
		return 1;
	}
	*ret = do_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset);

	return len + 1;
}
int dropbearconvert_main(int argc, char ** argv) {
#else 
int main(int argc, char ** argv) {
#endif

	int intype, outtype;
	const char* infile;
	const char* outfile;

	/* get the commandline options */
	if (argc != 5) {
		fprintf(stderr, "All arguments must be specified\n");
		goto usage;
	}

	/* input type */
	if (argv[1][0] == 'd') {
		intype = KEYFILE_DROPBEAR;
	} else if (argv[1][0] == 'o') {
		intype = KEYFILE_OPENSSH;
	} else {
		fprintf(stderr, "Invalid input key type\n");
		goto usage;
	}

	/* output type */
	if (argv[2][0] == 'd') {
		outtype = KEYFILE_DROPBEAR;
	} else if (argv[2][0] == 'o') {
		outtype = KEYFILE_OPENSSH;
	} else {
		fprintf(stderr, "Invalid output key type\n");
		goto usage;
	}

	/* we don't want output readable by others */
	umask(077);

	infile = argv[3];
	outfile = argv[4];

	return do_convert(intype, infile, outtype, outfile);

usage:
	printhelp(argv[0]);
	return 1;
}
Beispiel #10
0
gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset)
{
	gchar *str;
	guint8 len;

	if (str_utf8 == NULL || (len = strlen(str_utf8)) == 0) {
		buf[0] = 0;
		return 1;
	}
	str = do_convert(str_utf8, -1, to_charset, UTF8);
	len = strlen(str_utf8);
	buf[0] = len;
	if (len > 0) {
		memcpy(buf + 1, str, len);
	}
	return 1 + len;
}
Beispiel #11
0
int do_cgi_data()
{
    int a;
    char data[1024];
    char part[255];
    int  partnum;
    char *lenstr;
    long len;
    long cgipos;
    char datfelder[16][255];

    lenstr= getenv("CONTENT_LENGTH");
    if(lenstr==NULL)
    {
	printf("<BR>ERROR!<BR>");
	if(system("relayi2c -a 0 -b 0 -c 0 -d 0 -a 0 -b 0 -c 0 -d 0")){
		printf ("error: relais off\n");
	}else{
		printf("<BR>relay off<BR>");
	}
    }
    else
    {
	sscanf(lenstr,"%ld",&len);
	printf("<BR>%ld<BR>",len);
	fgets(data,len+1,stdin);
	printf("<BR>%s<BR>",data);

	for(a=0;a<16;a++) // l�sche Felder
    	{
      	datfelder[a][0]=0;
    	}

        cgipos=0;
	partnum=0;
	while(cgipos != -1)
	{
          cgipos=do_convert(data,cgipos,part);	
	  printf("<BR>%d %s %ld<BR>",partnum,part,cgipos);  // debug
	  sprintf(datfelder[partnum],"%s",part);
	  partnum++;
	}
	action_switch(datfelder[1],datfelder[3],datfelder[5],datfelder[7],datfelder[9],datfelder[11],datfelder[13],datfelder[15]);
    }
    return(0); 
}
Beispiel #12
0
char *convert(int_array_t *pconversions, char *line)
{
	conversion *cur_conv = NULL;
	cv_off *cv_offsets = NULL;
	int conv_index;
	int conv_req;
	int new_len = 0;
	int cur_n_cv_matches = 0;
	char *new_string = NULL;
	int offset_old = 0, offset_new = 0;
	int old_len = strlen(line);
	int n_conversions = get_iat_size(pconversions);

	if (n_conversions == 0)
		return line;

	for(conv_req=0; conv_req < n_conversions; conv_req++)
	{
		cur_conv = &conversions[get_iat_element(pconversions, conv_req)];

		/* find where they match */
		for(conv_index=0; conv_index<cur_conv -> n; conv_index++)
		{
			int offset = 0;
			do
			{
				int cur_match_index;
				int cur_offset = offset;
				regmatch_t matches[MAX_N_RE_MATCHES];

				/* FIXME: what to do with regexp errors? */
				if (regexec(&(cur_conv -> pcb)[conv_index].regex, &line[offset], MAX_N_RE_MATCHES, matches, offset?REG_NOTBOL:0) != 0)
					break;

				for(cur_match_index=1; cur_match_index<MAX_N_RE_MATCHES; cur_match_index++)
				{
					char *dummy;
					int dummylen;
					int match_start, match_end;

					match_start = matches[cur_match_index].rm_so + cur_offset;
					match_end   = matches[cur_match_index].rm_eo + cur_offset;

					offset = max(offset + 1, match_end);

					if (matches[cur_match_index].rm_so == -1)
						break;

					(cur_conv -> pcb)[conv_index].match_count++;

					cv_offsets = (cv_off *)myrealloc(cv_offsets, sizeof(cv_off) * (cur_n_cv_matches + 1));
					cv_offsets[cur_n_cv_matches].start = match_start;
					cv_offsets[cur_n_cv_matches].end   = match_end;

					dummylen = match_end - match_start;

					dummy = mymalloc(dummylen + 1);
					memcpy(dummy, &line[match_start], dummylen);
					dummy[dummylen] = 0x00;

					cv_offsets[cur_n_cv_matches].newstr = do_convert(dummy, dummylen, (cur_conv -> pcb)[conv_index].type, &(cur_conv -> pcs)[conv_index]);

					myfree(dummy);

					cur_n_cv_matches++;
				}
			} while (offset < old_len);
		}
	}

	if (cur_n_cv_matches)
	{
		int n_copy;

		/* sort */
		if (cur_n_cv_matches > 1)
			qsort(cv_offsets, cur_n_cv_matches, sizeof(cv_off), cv_offsets_compare);

		/* create new string */
		for(conv_index=0; conv_index < cur_n_cv_matches; conv_index++)
		{
			n_copy = cv_offsets[conv_index].start - offset_old;
			if (n_copy > 0)
			{
				new_string = myrealloc(new_string, new_len + n_copy + 1);
				memcpy(&new_string[offset_new], &line[offset_old], n_copy);
				new_string[offset_new + n_copy] = 0x00;
				new_len += n_copy;
				offset_new += n_copy;
			}
			offset_old = cv_offsets[conv_index].end;

			n_copy = strlen(cv_offsets[conv_index].newstr);
			new_string = myrealloc(new_string, new_len + n_copy + 1);
			memcpy(&new_string[offset_new], cv_offsets[conv_index].newstr, n_copy);
			new_string[offset_new + n_copy] = 0x00;
			myfree(cv_offsets[conv_index].newstr);
			new_len += n_copy;
			offset_new += n_copy;
		}

		n_copy = old_len - offset_old;
		if (n_copy)
		{
			new_string = myrealloc(new_string, new_len + n_copy + 1);
			memcpy(&new_string[offset_new], &line[offset_old], n_copy);
			new_string[offset_new + n_copy] = 0x00;
		}
	}
	else
	{
		new_string = line;
	}

	myfree(cv_offsets);

	return new_string;
}
Beispiel #13
0
bool cdio_charset_convert(cdio_charset_coverter_t*cnv,
                          char * src, int src_len,
                          char ** dst, int * dst_len)
  {
  return do_convert(cnv->ic, src, src_len, dst, dst_len);
  }
Beispiel #14
0
/* Warning: do not return NULL */
gchar *qq_to_utf8(const gchar *str, const gchar *from_charset)
{
	return do_convert(str, -1, UTF8, from_charset);
}
Beispiel #15
0
/* Warning: do not return NULL */
gchar *utf8_to_qq(const gchar *str, const gchar *to_charset)
{
	return do_convert(str, -1, to_charset, UTF8);
}
Beispiel #16
0
static int
do_check_and_conv (unsigned char *to, unsigned char *from)
{
  static unsigned char tmp[BUFSIZ];
  unsigned char *tmp_p = &tmp[0];
  int p1, p2, i, j;
  int kanji = TRUE;

  switch (DetectKanjiCode (from))
    {
    case NEW:
      debug ("Kanji code is New JIS.");
      do_convert (&tmp_p, &from, NEWJISSTR);
      break;
    case OLD:
      debug ("Kanji code is Old JIS.");
      do_convert (&tmp_p, &from, OLDJISSTR);
      break;
    case ESCI:
      debug
	("This string includes Hankaku-Kana (jisx0201) escape sequence [ESC] + ( + I.");
      do_convert (&tmp_p, &from, NEWJISSTR);
      break;
    case NEC:
      debug ("Kanji code is NEC Kanji.");
      error ("cannot convert NEC Kanji.");
      ustrcpy (tmp, from);
      kanji = FALSE;
      break;
    case EUC:
      debug ("Kanji code is EUC.");
      ustrcpy (tmp, from);
      break;
    case SJIS:
      debug ("Kanji code is SJIS.");
      do_convert (&tmp_p, &from, SJISSTR);
      break;
    case EUCORSJIS:
      debug ("Kanji code is EUC or SJIS.");
      ustrcpy (tmp, from);
      kanji = FALSE;
      break;
    case ASCII:
      debug ("This is ASCII string.");
      ustrcpy (tmp, from);
      kanji = FALSE;
      break;
    default:
      debug ("This string includes unknown code.");
      ustrcpy (tmp, from);
      kanji = FALSE;
      break;
    }

  /* Hankaku Kana ---> Zenkaku Kana */
  if (kanji)
    {
      j = 0;
      for (i = 0; tmp[i] != '\0' && j < BUFSIZ; i++)
	{
	  if (tmp[i] == SS2)
	    {
	      p1 = tmp[++i];
	      if (tmp[i + 1] == SS2)
		{
		  p2 = tmp[i + 2];
		  if (p2 == 222 || p2 == 223)
		    i += 2;
		  else
		    p2 = 0;
		}
	      else
		p2 = 0;
	      han2zen (&p1, &p2);
	      SJIStoJIS (&p1, &p2);
	      to[j++] = p1 + 128;
	      to[j++] = p2 + 128;
	    }
	  else
	    to[j++] = tmp[i];
	}

      if (j >= BUFSIZ)
	{
	  error ("output buffer overflow at Hankaku --> Zenkaku");
	  ustrcpy (to, tmp);
	}
      else
	to[j] = '\0';
    }
  else
    ustrcpy (to, tmp);

  return kanji;
}
Beispiel #17
0
/** Handle loading of diagrams given on command line, including conversions.
 * Returns TRUE if any automatic conversions were performed.
 * Note to future hackers:  'size' is currently the only argument that can be
 * sent to exporters.  If more arguments are desired, please don't just add
 * even more arguments, but create a more general system.
 */
static gboolean
handle_initial_diagram(const char *in_file_name, 
		       const char *out_file_name,
		       const char *export_file_format,
		       const char *size,
		       char* show_layers,
		       const char *outdir) {
  Diagram *diagram = NULL;
  gboolean made_conversions = FALSE;

  if (export_file_format) {
    char *export_file_name = NULL;
    DiaExportFilter *ef = NULL;

    /* First try guessing based on extension */
    export_file_name = build_output_file_name(in_file_name, export_file_format, outdir);

    /* to make the --size hack even uglier but work again for the only filter supporting it */
    if (   size && strcmp(export_file_format, "png") == 0)
      ef = filter_export_get_by_name ("png-libart");
    if (!ef)
      ef = filter_guess_export_filter(export_file_name);
    if (ef == NULL) {
      ef = filter_export_get_by_name(export_file_format);
      if (ef == NULL) {
	g_critical(_("Can't find output format/filter %s\n"), export_file_format);
	return FALSE;
      }
      g_free (export_file_name);
      export_file_name = build_output_file_name(in_file_name, ef->extensions[0], outdir);
    }
    made_conversions |= do_convert(in_file_name,
      (out_file_name != NULL?out_file_name:export_file_name),
				   ef, size, show_layers);
    g_free(export_file_name);
  } else if (out_file_name) {
    DiaExportFilter *ef = NULL;

    /* if this looks like an ugly hack to you, agreed ;)  */
    if (size && strstr(out_file_name, ".png"))
      ef = filter_export_get_by_name ("png-libart");
    
    made_conversions |= do_convert(in_file_name, out_file_name, ef,
				   size, show_layers);
  } else {
    if (g_file_test(in_file_name, G_FILE_TEST_EXISTS)) {
      diagram = diagram_load (in_file_name, NULL);
    } else {
      diagram = new_diagram (in_file_name);
    }
	      
    if (diagram != NULL) {
      diagram_update_extents(diagram);
      if (app_is_interactive()) {
	layer_dialog_set_diagram(diagram);
        /* the display initial diagram holds two references */
	new_display(diagram);
      } else {
        g_object_unref(diagram);
      }
    }
  }
  return made_conversions;
}
Beispiel #18
0
static int
convert_video(FTSENT *ftsent)
{
  char dir[MAXPATHLEN];
  char webm_name[MAXPATHLEN] = {};
  int offset;
  char webm[MAXPATHLEN];
  char arch[MAXPATHLEN];
  char *last_slash;

  strncpy(dir, ftsent->fts_path, sizeof(dir));
  last_slash = rindex(dir, '/');
  assert( NULL != last_slash );
  *last_slash = '\0';
  
  time_t dt;
  int ret;

  ret = probe_setmtime(dir, &dt);
  if ( ret < 0 )
    return ret;
  dir_to_restore = dir;
  time_to_restore = dt;
  
  if ( '.' == ftsent->fts_name[0] )
    {
      offset = 1;
      strncpy(arch, ftsent->fts_path, sizeof(arch));
    }
  else
    {
      offset = 0;
      snprintf(arch, sizeof(arch), "%s/.%s", dir, ftsent->fts_name);
      struct stat st;
      ret = stat(arch, &st);
      if ( 0 == ret )
	{
	  char target[MAXPATHLEN];
	  snprintf(target, sizeof(target), "%s~", arch);
	  WARNING("%s already exists, %s moved as %s", arch, ftsent->fts_path, target);
	  ret = rename(ftsent->fts_path, target);
	  if ( ret < 0 )
	    {
	      ERROR("rename(%s, %s): %s", ftsent->fts_path, target, strerror(errno));
	      ret = 1;
	      goto end;
	    }
	  ret = 0;
	  goto end;
	}
      else if ( errno != ENOENT )
	{
	  ERROR("stat(%s): %s", arch, strerror(errno));
	  ret = 1;
	  goto end;
	}
      ret = rename(ftsent->fts_path, arch);
      if ( ret < 0 )
	{
	  ERROR("rename(%s, %s): %s", ftsent->fts_path, arch, strerror(errno));
	  ret = 1;
	  goto end;
	}
    }
  memcpy(webm_name, ftsent->fts_name + offset, ftsent->fts_namelen-4-offset);
  snprintf(webm, sizeof(webm), "%s/%s.webm", dir, webm_name);

  struct stat st_webm, st_arch;

  ret = stat(webm, &st_webm);
  if ( ret < 0 )
    {
      if ( errno != ENOENT )
	{
	  ERROR("stat(%s): %s", webm, strerror(errno));
	  ret = 1;
	  goto end;
	}
      memset(&st_webm, 0, sizeof(st_webm));
    }
  ret = stat(arch, &st_arch);
  if ( ret < 0 )
    {
      ERROR("stat(%s): %s", arch, strerror(errno));
      ret = 1;
      goto end;
    }

  if ( st_arch.st_mtim.tv_sec >= st_webm.st_mtim.tv_sec ||
       force_update )
    {
      MESSAGE("UPDATE OF: %s", arch);
      ret = do_convert(arch, webm);
    }
 end:
  if ( setmtime(dir, dt) != 0 )
    {
      ERROR("Failed to restore %s timestamp", dir);
      return 1;
    }
  dir_to_restore = NULL;
  time_to_restore = 0;
  return ret; 
}
Beispiel #19
0
static void
process_item(GtkTreeIter *iter, Settings *user_settings, gboolean skip_done,
             int is_first)
{
    gchar *in_file, *out_full, *ancillary_file, *meta_file,
      *status, *polsarpro_aux_info, *interferogram_file,
      *coherence_file, *slave_metadata_file, *baseline_file,
      *uavsar_type;
    int pid, isPolSARPro = FALSE;

    pid = getpid();

    gtk_tree_model_get(GTK_TREE_MODEL(list_store), iter,
		       COL_INPUT_FILE, &in_file,
		       COL_ANCILLARY_FILE, &ancillary_file,
		       COL_METADATA_FILE, &meta_file,
		       COL_OUTPUT_FILE, &out_full,
		       COL_STATUS, &status,
		       COL_POLSARPRO_INFO, &polsarpro_aux_info,
		       COL_INTERFEROGRAM, &interferogram_file,
		       COL_COHERENCE, &coherence_file,
		       COL_SLAVE_METADATA, &slave_metadata_file,
		       COL_BASELINE, &baseline_file,
           COL_UAVSAR_TYPE, &uavsar_type,
		       -1);

    int image_data_type = extract_image_data_type(polsarpro_aux_info);
    if (image_data_type >= 0 && image_data_type < 3)
      isPolSARPro = TRUE;

    if (strcmp(status, "Done") != 0 || !skip_done)
    {
        //char *in_basename = stripExt(in_file);
        char *out_basename = stripExt(out_full);
        char *out_nameonly = get_basename(out_full);
        char *output_dir = getPath(out_full);
        char *config_file, *cmd_output, *tmp_dir, *intermediates_file;
        gchar *err_string;

        /* Ensure we have access to the output directory */
        if (!have_access_to_dir(output_dir, &err_string))
        {
            /* We don't -- issue a message in the "Status" column. */
            gtk_list_store_set(list_store, iter, COL_STATUS, err_string, -1);

            g_free(err_string);
            //free(in_basename);
            free(out_basename);
            free(output_dir);

            return;
        }

        tmp_dir = MALLOC(sizeof(char)*
            (strlen(output_dir)+strlen(out_nameonly)+32));
        if (strlen(output_dir) > 0) {
          sprintf(tmp_dir, "%s%c%s-%s", output_dir, DIR_SEPARATOR,
                  out_nameonly, time_stamp_dir());
        }
        else {
          sprintf(tmp_dir, "%s-%s", out_nameonly, time_stamp_dir());
        }

        create_clean_dir(tmp_dir);
        set_asf_tmp_dir(tmp_dir);

        config_file =
            settings_to_config_file(user_settings,
                                    in_file, ancillary_file, meta_file,
                                    out_full, output_dir,
                                    tmp_dir, polsarpro_aux_info,
				    interferogram_file, coherence_file,
				    slave_metadata_file, baseline_file, uavsar_type);
        if (!config_file) {
            err_string = "Error creating configuration file.";
            gtk_list_store_set(list_store, iter, COL_STATUS, err_string, -1);

            free(out_basename);
            free(output_dir);
            free(tmp_dir);
            return;
        }

        cmd_output = do_convert(pid, iter, config_file, TRUE,
            user_settings->keep_files, &intermediates_file);
        err_string = check_for_error(cmd_output);
        if (err_string) {
            // unsuccessful
            gtk_list_store_set(list_store, iter, COL_STATUS, err_string,
                COL_LOG, cmd_output, -1);
            FREE(err_string);
        }
        else {
            // successful -- move to "completed" list
            GtkTreeIter completed_iter;
            move_to_completed_files_list(iter, &completed_iter, cmd_output,
                                         intermediates_file);
            set_thumbnail(&completed_iter, tmp_dir, out_full, isPolSARPro);
            input_data_formats_changed();
            refresh_file_names();
        }

        // for subsequent runs, save the imported dem & mask
        settings_update_dem(user_settings, output_dir);
        settings_update_mask(user_settings, output_dir);

        free(config_file);
        free(out_basename);
        free(output_dir);
        free(out_nameonly);
        free(intermediates_file);
        g_free(cmd_output);

        if (!user_settings->keep_files)
            remove_dir(tmp_dir);

        free(tmp_dir);
    }

    g_free(status);
    g_free(out_full);
    g_free(ancillary_file);
    g_free(meta_file);
    g_free(in_file);
    g_free(polsarpro_aux_info);
}
Beispiel #20
0
gchar *Conv_ToInternal(Converter *conv, const gchar *ext_str, int len)
{
  return do_convert(conv->ext_codeset, int_codeset, ext_str, len);
}