Exemple #1
0
static idn_result_t
setdefaults_body(idn_resconf_t ctx, int conf_mask) {
	idn_result_t r;

	TRACE(("setdefaults_body()\n"));
	assert(ctx != NULL);

	if (!(conf_mask & DEFAULT_CONF_NAMEPREP)) {
		TRACE(("set default nameprep\n"));
		r = idn_resconf_setnameprepversion(ctx, IDN_NAMEPREP_CURRENT);
		if (r != idn_success) {
			return (r);
		}
	}
	if (!(conf_mask & DEFAULT_CONF_IDN_ENCODING)) {
		TRACE(("set default idn encoding\n"));
		r = idn_converter_create(IDN_ENCODING_CURRENT,
					 &ctx->idn_converter,
					 IDN_CONVERTER_DELAYEDOPEN |
					 IDN_CONVERTER_RTCHECK);
		if (r != idn_success) {
			ERROR(("libidnkit: cannot create idn converter, %s\n",
			       idn_result_tostring(r)));
			return (r);
		}
	}

	return (idn_success);
}
Exemple #2
0
void
set_nameprep(idn_resconf_t conf, char *version) {
	idn_result_t r;

	r = idn_resconf_setnameprepversion(conf, version);
	if (r != idn_success) {
		errormsg("error setting nameprep %s: %s\n",
			 version, idn_result_tostring(r));
		exit(1);
	}
}