osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error) { OSyncObjFormat *file = osync_format_env_find_objformat(env, "file"); OSyncObjFormat *plain = NULL; OSyncFormatConverter *conv = NULL; if (!file) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find file format"); return FALSE; } plain = osync_format_env_find_objformat(env, "plain"); if (!plain) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find plain format"); return FALSE; } conv = osync_converter_new(OSYNC_CONVERTER_DECAP, file, plain, conv_file_to_plain, error); if (!conv) return FALSE; osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_ENCAP, plain, file, conv_plain_to_file, error); if (!conv) return FALSE; osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; }
osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error) { OSyncFormatConverter *conv = NULL; /* mock converter */ OSyncObjFormat *mockformat1 = osync_format_env_find_objformat(env, "mockformat1"); osync_assert(mockformat1); OSyncObjFormat *mockformat2 = osync_format_env_find_objformat(env, "mockformat2"); osync_assert(mockformat2); conv = osync_converter_new(OSYNC_CONVERTER_DECAP, mockformat1, mockformat2, conv_file_to_plain, error); osync_assert(conv); osync_format_env_register_converter(env, conv); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_ENCAP, mockformat2, mockformat1, conv_plain_to_file, error); osync_assert(conv); osync_format_env_register_converter(env, conv); osync_converter_unref(conv); return TRUE; }