Esempio n. 1
0
/*! \fn updateInitialGuessDB
 *
 *  This function writes new values to solution list.
 *
 *  \param [in]  [nonlinsys]
 *  \param [in]  [time] time for extrapolation
 *  \param [in]  [context] current context of evaluation
 *
 */
int updateInitialGuessDB(NONLINEAR_SYSTEM_DATA *nonlinsys, double time, int context)
{
  /* write solution to oldValue list for extrapolation */
  if (nonlinsys->solved == 1)
  {
    /* do not use solution of jacobian for next extrapolation */
    if (context < 4)
    {
      addListElement((VALUES_LIST*)nonlinsys->oldValueList,
              createValueElement(nonlinsys->size, time, nonlinsys->nlsx));
    }
  }
  else if (nonlinsys->solved == 2)
  {
    if (listLen(((VALUES_LIST*)nonlinsys->oldValueList)->valueList)>0)
    {
      cleanValueList((VALUES_LIST*)nonlinsys->oldValueList, NULL);
    }
    /* do not use solution of jacobian for next extrapolation */
    if (context < 4)
    {
      addListElement((VALUES_LIST*)nonlinsys->oldValueList,
              createValueElement(nonlinsys->size, time, nonlinsys->nlsx));
    }
  }
  messageClose(LOG_NLS_EXTRAPOLATE);
  return 0;
}
void pfx_cert_install_cb(void *data, Evas_Object *obj, void *event_info) {
    LOGD("pfx_cert_cb");

    struct ug_data *ad = (struct ug_data *) data;
    Evas_Object *list = NULL;

    DIR *dir;
    struct dirent *dp;

    firstListElement = initList();
    lastListElement = firstListElement;

    list = elm_list_add(ad->win_main);
    elm_list_mode_set(list, ELM_LIST_COMPRESS);



    dir = opendir(dir_path);
    if (dir == NULL) {
        LOGE("There's no such directory: %s", dir_path);
        return; //TODO What if there's no SD card?
    }

    LOGD("Scanning dir (%s) - looking for certs", dir_path);
    while ((dp = readdir(dir)) != NULL) {
        char *tmp;
        tmp = path_cat(dir_path, dp->d_name);
        char *dot = strrchr(dp->d_name, '.');

        if(dot != NULL && strlen(dot)>3 && (strncmp(dot, ".pfx", 4) == 0 || strncmp(dot, ".PFX", 4) == 0 ||
                             strncmp(dot, ".p12", 4) == 0 || strncmp(dot, ".P12", 4) == 0)) {
            if (!(dp->d_type == DT_DIR)) {
                Elm_Object_Item * it;
                struct ListElement *current;
                current = addListElement(lastListElement, dp->d_name);
                lastListElement = current;
                it = elm_list_item_append(list, dp->d_name, NULL, NULL, install_pfx_button_cb, current);
                LOGD("elm list append = %s", current->name);
            }
            if (tmp) {
                free(tmp);
                tmp = NULL;
            }
        }
    }
    closedir(dir);

    elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "CHOOSE_PFX_TO_INSTALL"), NULL, NULL, list, NULL);
}
Esempio n. 3
0
void buildTable(HashTable *hash, char *string)
{
	int index = hashFunction(string, hash->size);
	addListElement(hash->table[index], string);
}