Esempio n. 1
0
static void AddMetaData(char *oid, const char *metafile) {
  json_object *obj, *result, *child;

  obj = ReadMetaFile(metafile);
  if (obj == NULL) {
    obj = json_object_new_object();
    result = json_object_new_array();
    json_object_object_add(obj, "result", result);
  } else {
    json_object_object_get_ex(obj, "result", &result);
  }

  child = json_object_new_object();
  json_object_object_add(child, "type", json_object_new_string(Type));
  json_object_object_add(child, "object_id", json_object_new_string(oid));
  if (Printer != NULL) {
    json_object_object_add(child, "printer", json_object_new_string(Printer));
  }
  if (Title != NULL) {
    json_object_object_add(child, "title", json_object_new_string(Title));
  }
  if (ShowDialog) {
    json_object_object_add(child, "showdialog", json_object_new_boolean(TRUE));
  }
  if (Filename != NULL) {
    json_object_object_add(child, "filename", json_object_new_string(Filename));
  }
  if (Desc != NULL) {
    json_object_object_add(child, "description", json_object_new_string(Desc));
  }

  json_object_array_add(result, child);

  WriteMetaFile(metafile, obj);
}
Esempio n. 2
0
static void IncGlobalMeta(int run_type)
{
    if ( (run_type <= G_RUN_CNT) || (run_type >= INVALID_BOUND) )
    {
        PRINT("Invalid Update Item.\n");
        FATAL_ERROR();
    }
    
    ((uint64_t*)&g_meta)[run_type]++;
    
    WriteMetaFile();
}