当前位置: 首页>>代码示例>>C++>>正文


C++ UIerr函数代码示例

本文整理汇总了C++中UIerr函数的典型用法代码示例。如果您正苦于以下问题:C++ UIerr函数的具体用法?C++ UIerr怎么用?C++ UIerr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UIerr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UI_ctrl

int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void))
  {
  if (ui == NULL)
    {
    UIerr(UI_F_UI_CTRL,ERR_R_PASSED_NULL_PARAMETER);
    return -1;
    }
  switch(cmd)
    {
  case UI_CTRL_PRINT_ERRORS:
    {
    int save_flag = !!(ui->flags & UI_FLAG_PRINT_ERRORS);
    if (i)
      ui->flags |= UI_FLAG_PRINT_ERRORS;
    else
      ui->flags &= ~UI_FLAG_PRINT_ERRORS;
    return save_flag;
    }
  case UI_CTRL_IS_REDOABLE:
    return !!(ui->flags & UI_FLAG_REDOABLE);
  default:
    break;
    }
  UIerr(UI_F_UI_CTRL,UI_R_UNKNOWN_CONTROL_COMMAND);
  return -1;
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:26,代码来源:ui_lib.c

示例2: UIerr

static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,
  int prompt_freeable, enum UI_string_types type, int input_flags,
  char *result_buf)
  {
  UI_STRING *ret = NULL;

  if (prompt == NULL)
    {
    UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,ERR_R_PASSED_NULL_PARAMETER);
    }
  else if ((type == UIT_PROMPT || type == UIT_VERIFY
       || type == UIT_BOOLEAN) && result_buf == NULL)
    {
    UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER);
    }
  else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING))))
    {
    ret->out_string=prompt;
    ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0;
    ret->input_flags=input_flags;
    ret->type=type;
    ret->result_buf=result_buf;
    }
  return ret;
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:25,代码来源:ui_lib.c

示例3: OPENSSL_zalloc

UI *UI_new_method(const UI_METHOD *method)
{
    UI *ret = OPENSSL_zalloc(sizeof(*ret));

    if (ret == NULL) {
        UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        return NULL;
    }

    ret->lock = CRYPTO_THREAD_lock_new();
    if (ret->lock == NULL) {
        UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        OPENSSL_free(ret);
        return NULL;
    }

    if (method == NULL)
        method = UI_get_default_method();
    if (method == NULL)
        method = UI_null();
    ret->meth = method;

    if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data)) {
        OPENSSL_free(ret);
        return NULL;
    }
    return ret;
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:28,代码来源:ui_lib.c

示例4: UI_dup_input_boolean

int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
  const char *ok_chars, const char *cancel_chars,
  int flags, char *result_buf)
  {
  char *prompt_copy = NULL;
  char *action_desc_copy = NULL;
  char *ok_chars_copy = NULL;
  char *cancel_chars_copy = NULL;

  if (prompt)
    {
    prompt_copy=BUF_strdup(prompt);
    if (prompt_copy == NULL)
      {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN,ERR_R_MALLOC_FAILURE);
      goto err;
      }
    }
  
  if (action_desc)
    {
    action_desc_copy=BUF_strdup(action_desc);
    if (action_desc_copy == NULL)
      {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN,ERR_R_MALLOC_FAILURE);
      goto err;
      }
    }
  
  if (ok_chars)
    {
    ok_chars_copy=BUF_strdup(ok_chars);
    if (ok_chars_copy == NULL)
      {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN,ERR_R_MALLOC_FAILURE);
      goto err;
      }
    }
  
  if (cancel_chars)
    {
    cancel_chars_copy=BUF_strdup(cancel_chars);
    if (cancel_chars_copy == NULL)
      {
      UIerr(UI_F_UI_DUP_INPUT_BOOLEAN,ERR_R_MALLOC_FAILURE);
      goto err;
      }
    }
  
  return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
    ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags,
    result_buf);
 err:
  if (prompt_copy) OPENSSL_free(prompt_copy);
  if (action_desc_copy) OPENSSL_free(action_desc_copy);
  if (ok_chars_copy) OPENSSL_free(ok_chars_copy);
  if (cancel_chars_copy) OPENSSL_free(cancel_chars_copy);
  return -1;
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:59,代码来源:ui_lib.c

示例5: UIerr

const char *UI_get0_result(UI *ui, int i)
{
    if (i < 0) {
        UIerr(UI_F_UI_GET0_RESULT, UI_R_INDEX_TOO_SMALL);
        return NULL;
    }
    if (i >= sk_UI_STRING_num(ui->strings)) {
        UIerr(UI_F_UI_GET0_RESULT, UI_R_INDEX_TOO_LARGE);
        return NULL;
    }
    return UI_get0_result_string(sk_UI_STRING_value(ui->strings, i));
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:12,代码来源:ui_lib.c

示例6: UI_get_result_length

int UI_get_result_length(UI *ui, int i)
{
    if (i < 0) {
        UIerr(UI_F_UI_GET_RESULT_LENGTH, UI_R_INDEX_TOO_SMALL);
        return -1;
    }
    if (i >= sk_UI_STRING_num(ui->strings)) {
        UIerr(UI_F_UI_GET_RESULT_LENGTH, UI_R_INDEX_TOO_LARGE);
        return -1;
    }
    return UI_get_result_string_length(sk_UI_STRING_value(ui->strings, i));
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:12,代码来源:ui_lib.c

示例7: general_allocate_boolean

static int general_allocate_boolean(UI *ui,
  const char *prompt, const char *action_desc,
  const char *ok_chars, const char *cancel_chars,
  int prompt_freeable, enum UI_string_types type, int input_flags,
  char *result_buf)
  {
  int ret = -1;
  UI_STRING *s;
  const char *p;

  if (ok_chars == NULL)
    {
    UIerr(UI_F_GENERAL_ALLOCATE_BOOLEAN,ERR_R_PASSED_NULL_PARAMETER);
    }
  else if (cancel_chars == NULL)
    {
    UIerr(UI_F_GENERAL_ALLOCATE_BOOLEAN,ERR_R_PASSED_NULL_PARAMETER);
    }
  else
    {
    for(p = ok_chars; *p; p++)
      {
      if (strchr(cancel_chars, *p))
        {
        UIerr(UI_F_GENERAL_ALLOCATE_BOOLEAN,
          UI_R_COMMON_OK_AND_CANCEL_CHARACTERS);
        }
      }

    s = general_allocate_prompt(ui, prompt, prompt_freeable,
      type, input_flags, result_buf);

    if (s)
      {
      if (allocate_string_stack(ui) >= 0)
        {
        s->_.boolean_data.action_desc = action_desc;
        s->_.boolean_data.ok_chars = ok_chars;
        s->_.boolean_data.cancel_chars = cancel_chars;
        ret=sk_UI_STRING_push(ui->strings, s);
        /* sk_push() returns 0 on error.
           Let's addapt that */
        if (ret <= 0) ret--;
        }
      else
        free_string(s);
      }
    }
  return ret;
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:50,代码来源:ui_lib.c

示例8: UI_set_result

int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
{
#if 0
    /*
     * This is placed here solely to preserve UI_F_UI_SET_RESULT
     * To be removed for OpenSSL 1.2.0
     */
    UIerr(UI_F_UI_SET_RESULT, ERR_R_DISABLED);
#endif
    return UI_set_result_ex(ui, uis, result, strlen(result));
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:11,代码来源:ui_lib.c

示例9: UI_dup_user_data

int UI_dup_user_data(UI *ui, void *user_data)
{
    void *duplicate = NULL;

    if (ui->meth->ui_duplicate_data == NULL
        || ui->meth->ui_destroy_data == NULL) {
        UIerr(UI_F_UI_DUP_USER_DATA, UI_R_USER_DATA_DUPLICATION_UNSUPPORTED);
        return -1;
    }

    duplicate = ui->meth->ui_duplicate_data(ui, user_data);
    if (duplicate == NULL) {
        UIerr(UI_F_UI_DUP_USER_DATA, ERR_R_MALLOC_FAILURE);
        return -1;
    }

    (void)UI_add_user_data(ui, duplicate);
    ui->flags |= UI_FLAG_DUPL_DATA;

    return 0;
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:21,代码来源:ui_lib.c

示例10: UI_dup_error_string

int UI_dup_error_string(UI *ui, const char *text)
{
    char *text_copy = NULL;

    if (text != NULL) {
        text_copy = OPENSSL_strdup(text);
        if (text_copy == NULL) {
            UIerr(UI_F_UI_DUP_ERROR_STRING, ERR_R_MALLOC_FAILURE);
            return -1;
        }
    }
    return general_allocate_string(ui, text_copy, 1, UIT_ERROR, 0, NULL,
                                   0, 0, NULL);
}
开发者ID:danielctull-forks,项目名称:openssl,代码行数:14,代码来源:ui_lib.c

示例11: OPENSSL_zalloc

UI_METHOD *UI_create_method(const char *name)
{
    UI_METHOD *ui_method = OPENSSL_zalloc(sizeof(*ui_method));

    if (ui_method != NULL) {
        ui_method->name = OPENSSL_strdup(name);
        if (ui_method->name == NULL) {
            OPENSSL_free(ui_method);
            UIerr(UI_F_UI_CREATE_METHOD, ERR_R_MALLOC_FAILURE);
            return NULL;
        }
    }
    return ui_method;
}
开发者ID:1234-,项目名称:openssl,代码行数:14,代码来源:ui_lib.c

示例12: UI_dup_info_string

int UI_dup_info_string(UI *ui, const char *text)
{
    char *text_copy = NULL;

    if (text) {
        text_copy = BUF_strdup(text);
        if (text_copy == NULL) {
            UIerr(UI_F_UI_DUP_INFO_STRING, ERR_R_MALLOC_FAILURE);
            return -1;
        }
    }

    return general_allocate_string(ui, text_copy, 1, UIT_INFO, 0, NULL,
                                   0, 0, NULL);
}
开发者ID:crypto-org-ua,项目名称:openssl-ua,代码行数:15,代码来源:ui_lib.c

示例13: OPENSSL_zalloc

UI *UI_new_method(const UI_METHOD *method)
{
    UI *ret = OPENSSL_zalloc(sizeof(*ret));

    if (ret == NULL) {
        UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    if (method == NULL)
        ret->meth = UI_get_default_method();
    else
        ret->meth = method;

    CRYPTO_new_ex_data(CRYPTO_EX_INDEX_UI, ret, &ret->ex_data);
    return ret;
}
开发者ID:crypto-org-ua,项目名称:openssl-ua,代码行数:16,代码来源:ui_lib.c

示例14: UI_dup_verify_string

int
UI_dup_verify_string(UI *ui, const char *prompt, int flags,
    char *result_buf, int minsize, int maxsize, const char *test_buf)
{
	char *prompt_copy = NULL;

	if (prompt) {
		prompt_copy = strdup(prompt);
		if (prompt_copy == NULL) {
			UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
			return -1;
		}
	}
	return general_allocate_string(ui, prompt_copy, 1, UIT_VERIFY, flags,
	    result_buf, minsize, maxsize, test_buf);
}
开发者ID:NSGod,项目名称:openbsd,代码行数:16,代码来源:ui_lib.c

示例15: UI_dup_input_string

/* Same as UI_add_input_string(), excepts it takes a copy of the prompt */
int
UI_dup_input_string(UI *ui, const char *prompt, int flags, char *result_buf,
    int minsize, int maxsize)
{
	char *prompt_copy = NULL;

	if (prompt) {
		prompt_copy = strdup(prompt);
		if (prompt_copy == NULL) {
			UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
			return 0;
		}
	}
	return general_allocate_string(ui, prompt_copy, 1, UIT_PROMPT, flags,
	    result_buf, minsize, maxsize, NULL);
}
开发者ID:NSGod,项目名称:openbsd,代码行数:17,代码来源:ui_lib.c


注:本文中的UIerr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。