/* Internal version of scs_decode(). */ static void *verify (scs_t *ctx, const char *tag, size_t *pstate_sz) { scs_keyset_t *ks; scs_atoms_t *ats = &ctx->atoms; int skip_atoms_encoding = 1; /* 1. If (tid is available) * 2. data' = d($SCS_DATA) * tstamp' = d($SCS_TSTAMP) * tid' = d($SCS_TID) * iv' = d($SCS_IV) * tag' = d($SCS_AUTHTAG) * 3. tag = HMAC(<data'>||<tstamp'>||<tid'>||<iv'>) * 4. If (tag == tag' && NOW - tstamp' <= session_max_age) * 5. state = Uncomp(Dec(data')) * 6. Else discard PDU * 7. Else discard PDU */ if ((ks = retr_keyset(ctx)) == NULL || decode_atoms(ctx, ks) || create_tag(ctx, ks, skip_atoms_encoding) || tags_match(ctx, tag) || tstamp_ok(ctx) || decrypt_state(ctx, ks) || optional_inflate(ctx, ks)) { reset_atoms(ats); return NULL; } *pstate_sz = ats->data_sz; return ats->data; }
static __uint _on_add_edit_tags(PCRTK_PACKET p) { ONLINE_CONFIG::reload_tags_ack *ack; RTK_CURSOR hNode, hTag, hGroup; RTK_TAG *pTag; RTK_GROUP grp; __bool bEdit; __uint tagcount, i; ack = (ONLINE_CONFIG::reload_tags_ack *)p->data; tagcount = p->data_size / sizeof(*ack); if(p->data_size % sizeof(*ack)){ return 0; } ZeroMemory(&grp, sizeof(grp)); if( !lock_rtdb(__true, 100) ){ return 0; } hNode = HNODE_LOCAL_MACHINE; hTag = hGroup = 0; host_to_node(&g_ThisNode->key, &grp.node); if(PACKET_TYPE(p) == PT_EditTag){ bEdit = __true; }else{ bEdit = __false; } for(i=0; i<tagcount; i++){ hGroup = open_group(hNode, &ack[i].tag.group); grp.key = ack[i].tag.group; if(!hGroup){ hGroup = create_group(hNode, &grp); } if(hGroup){ hTag = create_tag(hGroup, &ack[i].tag.key, &ack[i].tag.s); pTag = (RTK_TAG*)cursor_get_item(hTag); if(pTag){ *pTag = ack[i].tag; mark_expired(pTag); close_handle(hTag); if(bEdit){ // add-tag event is auto-fired fire_rtdb_event(EV_ModifyTag, pTag); } } } close_handle(hGroup); } unlock_rtdb(); return tagcount; }
Tag_modif::Tag_modif(NM::Note *n, QWidget *parent) : note(n), QDialog(parent), ui(new Ui::Tag_modif) { ui->setupUi(this); ui->label_name->setText(n->getTitle()); create_listTags(); connect(ui->button_addTag, SIGNAL(pressed()), this, SLOT(create_tag())); connect(ui->save_button, SIGNAL(pressed()), this, SLOT(saveAndQuit())); connect(ui->save_button, SIGNAL(pressed()), MainWindow::getInstance(), SLOT(createListTags())); }
int main() { int i; char str[STRING_DATA_SIZE] = {0}; plc_tag tag = create_tag(TAG_PATH); int rc; if(!tag) { fprintf(stdout,"ERROR: Unable to create tag!\n"); return 0; } /* test pre-read by writing first */ for(i=0; i<ARRAY_2_DIM_SIZE; i++) { snprintf_platform(str,sizeof(str), "string value for element %d", i); update_string(tag, i, str); } /* write the data */ rc = plc_tag_write(tag, DATA_TIMEOUT); if(rc != PLCTAG_STATUS_OK) { fprintf(stdout,"ERROR: Unable to read the data! Got error code %d: %s\n",rc, plc_tag_decode_error(rc)); return 0; } /* get the data */ rc = plc_tag_read(tag, DATA_TIMEOUT); if(rc != PLCTAG_STATUS_OK) { fprintf(stdout,"ERROR: Unable to read the data! Got error code %d: %s\n",rc, plc_tag_decode_error(rc)); return 0; } dump_strings(tag); plc_tag_destroy(tag); return 0; }
t_tag *parse_conf(int fd, char **conf, char *conf_line) { t_tag *tag_list; tag_list = NULL; while ((read(fd, conf_line, 1024)) > 0) conf = my_strscat(conf, conf_line); if (conf != NULL) { conf = my_str_to_wordtab(conf[0], "\t \n"); tag_list = get_information(conf); if (tag_list != NULL) return (tag_list); else { fprintf(stderr, "Empty conf for IRC Channels\n"); tag_list = create_tag("#default"); } free(conf_line); free_tab(conf); } return (tag_list); }
/** * \brief Encode plain cookie-value to an SCS cookie-value. * * Given the supplied \p state blob (of length \p state_sz), return the SCS * cookie value string into the \p cookie char buffer. The \p cookie must * be at least ::SCS_COOKIE_MAX bytes long and pre-allocated by the caller. * When an error occurs \c NULL is returned and the supplied \p ctx can be * inspected via ::scs_err function for failure cause. * * \param ctx An already initialized SCS context. * \param state The plain text state data that is to be put into the * SCS cookie. * \param state_sz \p state size in bytes (in case state is a * NUL-terminated C string, supply its strlen.) * \param cookie Pointer to a pre-allocated buffer of at least * ::SCS_COOKIE_MAX bytes. * * \return The encoded SCS cookie-value string on success, \c NULL in case * an error occurred. */ const char *scs_encode (scs_t *ctx, const uint8_t *state, size_t state_sz, char cookie[SCS_COOKIE_MAX]) { scs_atoms_t *ats = &ctx->atoms; scs_keyset_t *ks = &ctx->cur_keyset; int skip_atoms_encoding = 1; /* Before doing anything useful, check if keyset needs to be updated. * All crypto ops must be carried against a "fresh" -- as defined by the * current policy -- keyset. */ if (check_update_keyset(ctx)) return NULL; reset_atoms(ats); /* iv = rand() * tstamp = now() * Trans = (compression enabled) ? Deflate : Id * state' = Trans(state) * data = E_k(state') * tag = HMAC_h(b64(data) || "|" || b64(tstamp) || "|" || * b64(tid) || "|" || b64(iv)) * scs_cookie = * "b64(data) '|' b64(tstamp) '|' b64(tid) '|' b64(iv) '|' b64(tag)" */ if (get_random_iv(ctx) || get_tstamp(ctx) || optional_deflate(ctx, state, state_sz) || encrypt_state(ctx) || create_tag(ctx, ks, !skip_atoms_encoding)) { reset_atoms(ats); /* Remove any garbage. */ return NULL; } /* Given all the atoms, create the encoded cookie value. */ return do_cookie(ctx, cookie); }
int main(int ac, char **av) { t_serv serv; int fd; char **conf; char *conf_line; conf = NULL; conf_line = xmalloc(sizeof(char) * 1024); if (ac != 2) { printf("Uage : %s <Port>\n", av[0]); return (EXIT_FAILURE); } if (init_serv(&serv, av[1]) != -1) { if ((fd = open("utils/conf/conf.xml", O_RDONLY)) == -1) serv.tag = create_tag("#default"); else serv.tag = parse_conf(fd, conf, conf_line); serv_loop(&serv); } return (EXIT_SUCCESS); }
__uint _on_add_edit_tags(PCRTK_PACKET p, bool bGenerateEvents) { ONLINE_CONFIG::reload_tags_ack *ack; RTK_CURSOR hNode, hTag, hGroup; RTK_TAG *pTag; NODE_KEY nodekey; TAG_NAME name; RTK_GROUP grp; __bool bEditing; __uint tagcount, i; ack = (ONLINE_CONFIG::reload_tags_ack *)p->data; tagcount = p->data_size / sizeof(*ack); if(p->data_size % sizeof(*ack)){ return 0; } if(!tagcount){ return 0; } ZeroMemory(&grp, sizeof(grp)); if((PACKET_TYPE(p) == PT_DiscoverTags) && g_Worker){ TAG_NAME tn; memset(&tn, 0, sizeof(tn)); tn.node = ack[0].tag.node; tn.sname.group = ack[0].tag.group; g_Worker->cancel_load(&tn); } if(!lock_rtdb(__true, 100)){ return 0; } host_to_node(&p->src.host, &nodekey); hNode = create_node(&nodekey, 0); hTag = hGroup = 0; name.node = nodekey; grp.node = nodekey; if(hNode){ for(i=0; i<tagcount; i++){ hGroup = open_group(hNode, &ack[i].tag.group); grp.key = ack[i].tag.group; if(!hGroup){ hGroup = create_group(hNode, &grp); } if(hGroup){ bEditing = query_tag_g(hGroup, &ack[i].tag.key)? __true : __false; hTag = create_tag(hGroup, &ack[i].tag.key, &ack[i].tag.s); pTag = (RTK_TAG*)cursor_get_item(hTag); if(pTag){ *pTag = ack[i].tag; /* 2003/5/27, leave tag's dynamic flags as they were 2003/6/24, mark tag as newly received, but the valid flag is kept as set by server */ mark_fresh(pTag); close_handle(hTag); if(bGenerateEvents){ name.sname.group = ack[i].tag.group; name.sname.tag = ack[i].tag.key; rtk_queue_event(PT_AddTag, &name, &p->src); } if(bEditing){ fire_rtdb_event(EV_ModifyTag, pTag); } } } close_handle(hGroup); } close_handle(hNode); } unlock_rtdb(); return tagcount; }
/* basic xml parser */ static int xml_parse(request *req, tag_t *parent, char *xstr, int len) { int i; int next_ch = -1; int last_ch = -1; int this_ch = -1; int rval; int state; tag_t *tag = NULL; state = set_xstate(XST_DONE); nest++; i = 0; while(i < len) { last_ch = xstr[i-1]; this_ch = xstr[i]; next_ch = xstr[i+1]; if(state == XST_DONE) { /* done processing at this level, return processed count to previous level */ if(this_ch == '<' && next_ch == '/') return i; state = set_xstate(XST_GET_START_TAG); tag = create_tag(req, parent); } switch (state) { case XST_GET_START_TAG: if(!tag->start_name) { tag->start_name = &xstr[i]; } tag->start_len++; /* process any tag attributes */ if(!tag->attr_name) { if((this_ch == ' ') && (next_ch != '/')) tag->attr_name = &xstr[i+1]; } else { if(this_ch != '>') tag->attr_len++; } if (this_ch == '>') { if(last_ch == '?') { if(!req->prolog_tag) { req->prolog_tag = tag; state = set_xstate(XST_DONE); goto NextChar; } else return -1; } else if(!req->root_tag) { req->root_tag = tag; } if(last_ch == '/') { // empty tag state = set_xstate(XST_VALIDATE); tag->empty = 1; } else state = set_xstate(XST_GET_VALUE); } break; case XST_GET_VALUE: if (this_ch != '<') { if(!tag->value_name) tag->value_name = &xstr[i]; tag->value_len++; break; } else state = set_xstate(XST_GET_END_TAG); /* fall through is deliberate */ case XST_GET_END_TAG: if(!tag->end_name) tag->end_name = &xstr[i]; tag->end_len++; if (this_ch == '>') state = set_xstate(XST_VALIDATE); break; } if(state == XST_VALIDATE) { state = set_xstate(XST_DONE); rval = validate_tag(tag); //fprintf(stderr,"\r\After validate_tag with retval:%d\n",rval); if (rval == 0) { tag = NULL; goto NextChar; } /* tag is invalid */ else if (rval < 0) { return -1; } // tag mismatch, adjust len and process child i = i - tag->end_len; rval = xml_parse(req, tag, tag->end_name, len-i); if(rval < 0) return rval; tag->end_name = 0; // clear end tag tag->end_len = 0; nest--; state = set_xstate(XST_GET_END_TAG); i = i+rval; // advance processed offset } NextChar: i++; }; //fprintf(stderr,"\r\nAfter xml_parse\n"); return i; }
/** finds tags that have been added or removed or updated */ void update_tags( const comment_object& c )const { try { auto hot = calculate_hot(c); comment_metadata meta; if( c.json_metadata.size() ){ meta = fc::json::from_string( c.json_metadata ).as<comment_metadata>(); } set<string> lower_tags; for( const auto& tag : meta.tags ) lower_tags.insert(fc::to_lower( tag ) ); lower_tags.insert( fc::to_lower(c.category) ); /// the universal tag applies to everything safe for work or nsfw with a positive payout if( c.net_rshares >= 0 || (lower_tags.find( "spam" ) == lower_tags.end() && lower_tags.find( "nsfw" ) == lower_tags.end() && lower_tags.find( "test" ) == lower_tags.end() ) ) { lower_tags.insert( string() ); /// add it to the universal tag } meta.tags = lower_tags; /// TODO: std::move??? const auto& comment_idx = _db.get_index_type<tag_index>().indices().get<by_comment>(); auto citr = comment_idx.lower_bound( c.id ); map<string, const tag_object*> existing_tags; vector<const tag_object*> remove_queue; while( citr != comment_idx.end() && citr->comment == c.id ) { const tag_object* tag = &*citr; ++citr; if( meta.tags.find( tag->tag ) == meta.tags.end() ) { remove_queue.push_back(tag); } else { existing_tags[tag->tag] = tag; } } for( const auto& tag : meta.tags ) { auto existing = existing_tags.find(tag); if( existing == existing_tags.end() ) { create_tag( tag, c, hot ); } else { update_tag( *existing->second, c, hot ); } } for( const auto& item : remove_queue ) remove_tag(*item); if( c.parent_author.size() ) { update_tags( _db.get_comment( c.parent_author, c.parent_permlink ) ); } } FC_CAPTURE_LOG_AND_RETHROW( (c) ) }
/** finds tags that have been added or removed or updated */ void update_tags( const comment_object& c )const { try { auto hot = calculate_hot(c); comment_metadata meta; if( c.json_metadata.size() ) { try { meta = fc::json::from_string( c.json_metadata ).as<comment_metadata>(); } catch( const fc::exception& e ) { // Do nothing on malformed json_metadata } } set<string> lower_tags; for( const auto& tag : meta.tags ) lower_tags.insert(fc::to_lower( tag ) ); lower_tags.insert( fc::to_lower(c.category) ); bool safe_for_work = false; /// the universal tag applies to everything safe for work or nsfw with a positive payout if( c.net_rshares >= 0 || (lower_tags.find( "spam" ) == lower_tags.end() && lower_tags.find( "nsfw" ) == lower_tags.end() && lower_tags.find( "test" ) == lower_tags.end() ) ) { safe_for_work = true; lower_tags.insert( string() ); /// add it to the universal tag } meta.tags = lower_tags; /// TODO: std::move??? if( meta.tags.size() > 7 ) { //wlog( "ignoring post ${a} because it has ${n} tags",("a", c.author + "/"+c.permlink)("n",meta.tags.size())); if( safe_for_work ) meta.tags = set<string>({"", c.parent_permlink}); else meta.tags.clear(); } const auto& comment_idx = _db.get_index_type<tag_index>().indices().get<by_comment>(); auto citr = comment_idx.lower_bound( c.id ); map<string, const tag_object*> existing_tags; vector<const tag_object*> remove_queue; while( citr != comment_idx.end() && citr->comment == c.id ) { const tag_object* tag = &*citr; ++citr; if( meta.tags.find( tag->tag ) == meta.tags.end() ) { remove_queue.push_back(tag); } else { existing_tags[tag->tag] = tag; } } for( const auto& tag : meta.tags ) { auto existing = existing_tags.find(tag); if( existing == existing_tags.end() ) { create_tag( tag, c, hot ); } else { update_tag( *existing->second, c, hot ); } } for( const auto& item : remove_queue ) remove_tag(*item); if( c.parent_author.size() ) { update_tags( _db.get_comment( c.parent_author, c.parent_permlink ) ); } } FC_CAPTURE_LOG_AND_RETHROW( (c) ) }
int cmd_tag(int argc, const char **argv, const char *prefix) { struct strbuf buf = STRBUF_INIT; struct strbuf ref = STRBUF_INIT; unsigned char object[20], prev[20]; const char *object_ref, *tag; struct create_tag_options opt; char *cleanup_arg = NULL; int create_reflog = 0; int annotate = 0, force = 0; int cmdmode = 0, create_tag_object = 0; const char *msgfile = NULL, *keyid = NULL; struct msg_arg msg = { 0, STRBUF_INIT }; struct ref_transaction *transaction; struct strbuf err = STRBUF_INIT; struct ref_filter filter; static struct ref_sorting *sorting = NULL, **sorting_tail = &sorting; const char *format = NULL; struct option options[] = { OPT_CMDMODE('l', "list", &cmdmode, N_("list tag names"), 'l'), { OPTION_INTEGER, 'n', NULL, &filter.lines, N_("n"), N_("print <n> lines of each tag message"), PARSE_OPT_OPTARG, NULL, 1 }, OPT_CMDMODE('d', "delete", &cmdmode, N_("delete tags"), 'd'), OPT_CMDMODE('v', "verify", &cmdmode, N_("verify tags"), 'v'), OPT_GROUP(N_("Tag creation options")), OPT_BOOL('a', "annotate", &annotate, N_("annotated tag, needs a message")), OPT_CALLBACK('m', "message", &msg, N_("message"), N_("tag message"), parse_msg_arg), OPT_FILENAME('F', "file", &msgfile, N_("read message from file")), OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")), OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"), N_("how to strip spaces and #comments from message")), OPT_STRING('u', "local-user", &keyid, N_("key-id"), N_("use another key to sign the tag")), OPT__FORCE(&force, N_("replace the tag if exists")), OPT_BOOL(0, "create-reflog", &create_reflog, N_("create a reflog")), OPT_GROUP(N_("Tag listing options")), OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")), OPT_CONTAINS(&filter.with_commit, N_("print only tags that contain the commit")), OPT_WITH(&filter.with_commit, N_("print only tags that contain the commit")), OPT_MERGED(&filter, N_("print only tags that are merged")), OPT_NO_MERGED(&filter, N_("print only tags that are not merged")), OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"), N_("field name to sort on"), &parse_opt_ref_sorting), { OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"), N_("print only tags of the object"), 0, parse_opt_object_name }, OPT_STRING( 0 , "format", &format, N_("format"), N_("format to use for the output")), OPT_END() }; git_config(git_tag_config, sorting_tail); memset(&opt, 0, sizeof(opt)); memset(&filter, 0, sizeof(filter)); filter.lines = -1; argc = parse_options(argc, argv, prefix, options, git_tag_usage, 0); if (keyid) { opt.sign = 1; set_signing_key(keyid); } create_tag_object = (opt.sign || annotate || msg.given || msgfile); if (argc == 0 && !cmdmode) cmdmode = 'l'; if ((create_tag_object || force) && (cmdmode != 0)) usage_with_options(git_tag_usage, options); finalize_colopts(&colopts, -1); if (cmdmode == 'l' && filter.lines != -1) { if (explicitly_enable_column(colopts)) die(_("--column and -n are incompatible")); colopts = 0; } if (!sorting) sorting = ref_default_sorting(); if (cmdmode == 'l') { int ret; if (column_active(colopts)) { struct column_options copts; memset(&copts, 0, sizeof(copts)); copts.padding = 2; run_column_filter(colopts, &copts); } filter.name_patterns = argv; ret = list_tags(&filter, sorting, format); if (column_active(colopts)) stop_column_filter(); return ret; } if (filter.lines != -1) die(_("-n option is only allowed with -l.")); if (filter.with_commit) die(_("--contains option is only allowed with -l.")); if (filter.points_at.nr) die(_("--points-at option is only allowed with -l.")); if (filter.merge_commit) die(_("--merged and --no-merged option are only allowed with -l")); if (cmdmode == 'd') return for_each_tag_name(argv, delete_tag); if (cmdmode == 'v') return for_each_tag_name(argv, verify_tag); if (msg.given || msgfile) { if (msg.given && msgfile) die(_("only one -F or -m option is allowed.")); if (msg.given) strbuf_addbuf(&buf, &(msg.buf)); else { if (!strcmp(msgfile, "-")) { if (strbuf_read(&buf, 0, 1024) < 0) die_errno(_("cannot read '%s'"), msgfile); } else { if (strbuf_read_file(&buf, msgfile, 1024) < 0) die_errno(_("could not open or read '%s'"), msgfile); } } } tag = argv[0]; object_ref = argc == 2 ? argv[1] : "HEAD"; if (argc > 2) die(_("too many params")); if (get_sha1(object_ref, object)) die(_("Failed to resolve '%s' as a valid ref."), object_ref); if (strbuf_check_tag_ref(&ref, tag)) die(_("'%s' is not a valid tag name."), tag); if (read_ref(ref.buf, prev)) hashclr(prev); else if (!force) die(_("tag '%s' already exists"), tag); opt.message_given = msg.given || msgfile; if (!cleanup_arg || !strcmp(cleanup_arg, "strip")) opt.cleanup_mode = CLEANUP_ALL; else if (!strcmp(cleanup_arg, "verbatim")) opt.cleanup_mode = CLEANUP_NONE; else if (!strcmp(cleanup_arg, "whitespace")) opt.cleanup_mode = CLEANUP_SPACE; else die(_("Invalid cleanup mode %s"), cleanup_arg); if (create_tag_object) { if (force_sign_annotate && !annotate) opt.sign = 1; create_tag(object, tag, &buf, &opt, prev, object); } transaction = ref_transaction_begin(&err); if (!transaction || ref_transaction_update(transaction, ref.buf, object, prev, create_reflog ? REF_FORCE_CREATE_REFLOG : 0, NULL, &err) || ref_transaction_commit(transaction, &err)) die("%s", err.buf); ref_transaction_free(transaction); if (force && !is_null_sha1(prev) && hashcmp(prev, object)) printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV)); strbuf_release(&err); strbuf_release(&buf); strbuf_release(&ref); return 0; }
void write_sgeo_tags(ExifData *exif, ExifIfd ifd, SGeoTags * collection) { unsigned int i = 0; unsigned char *buf = NULL; ExifEntry *entry = NULL; ExifByteOrder order; ExifContent *content = NULL; order = exif_data_get_byte_order(exif); content = exif->ifd[ifd]; // VersionID exif_mem_write(content, SGEO_TAG_VERSIONID, EXIF_FORMAT_BYTE, collection->VersionID, sizeof(collection->VersionID), NULL); // Longitude exif_srational_write(content, SGEO_TAG_LONGITUDE, &collection->Longitude, order, &collection->ExistLongitude); // LongAccuracy exif_rational_write(content, SGEO_TAG_LONGACCURACY, &collection->LongitudeAccuracy, order, &collection->ExistLongitudeAccuracy); // Latitude exif_srational_write(content, SGEO_TAG_LATITUDE, &collection->Latitude, order, &collection->ExistLatitude); // LatAccuracy exif_rational_write(content, SGEO_TAG_LATACCURACY, &collection->LatitudeAccuracy, order, &collection->ExistLatitudeAccuracy); // Altitude exif_srational_write(content, SGEO_TAG_ALTITUDE, &collection->Altitude, order, &collection->ExistAltitude); // AltAccuracy exif_rational_write(content, SGEO_TAG_ALTACCURACY, &collection->AltitudeAccuracy, order, &collection->ExistAltitudeAccuracy); // Azimuth exif_srational_write(content, SGEO_TAG_AZIMUTH, &collection->Azimuth, order, &collection->ExistAzimuth); // AzimuthAccuracy exif_rational_write(content, SGEO_TAG_AZIMUTHACCURACY, &collection->AzimuthAccuracy, order, &collection->ExistAzimuthAccuracy); // Pitch exif_srational_write(content, SGEO_TAG_PITCH, &collection->Pitch, order, &collection->ExistPitch); // PitchAccuracy exif_rational_write(content, SGEO_TAG_PITCHACCURACY, &collection->PitchAccuracy, order, &collection->ExistPitchAccuracy); // Roll exif_srational_write(content, SGEO_TAG_ROLL, &collection->Roll, order, &collection->ExistRoll); // RollAccuracy exif_rational_write(content, SGEO_TAG_ROLLACCURACY, &collection->RollAccuracy, order, &collection->ExistRollAccuracy); // HViewAngle exif_rational_write(content, SGEO_TAG_HVIEWANGLE, &collection->HViewAngle, order, &collection->ExistHViewAngle); // HViewAngleAccuracy exif_rational_write(content, SGEO_TAG_HVIEWANGLEACCURACY, &collection->HViewAngleAccuracy, order, &collection->ExistHViewAngleAccuracy); // VViewAngle exif_rational_write(content, SGEO_TAG_VVIEWANGLE, &collection->VViewAngle, order, &collection->ExistVViewAngle); // VViewAngleAccuracy exif_rational_write(content, SGEO_TAG_VVIEWANGLEACCURACY, &collection->VViewAngleAccuracy, order, &collection->ExistVViewAngleAccuracy); // SatCount exif_mem_write(content, SGEO_TAG_SATCOUNT, EXIF_FORMAT_BYTE, &collection->SatCount, sizeof(collection->SatCount), NULL); // global time exif_mem_write(content, SGEO_TAG_GLOBAL_TIME, EXIF_FORMAT_BYTE, collection->GlobalTime, sizeof(collection->GlobalTime), NULL); // UserLongitude exif_srational_write(content, SGEO_TAG_USER_LONGITUDE, &collection->UserLongitude, order, NULL); // UserLongAccuracy exif_rational_write(content, SGEO_TAG_USER_LONGACCURACY, &collection->UserLongitudeAccuracy, order, NULL); // UserLatitude exif_srational_write(content, SGEO_TAG_USER_LATITUDE, &collection->UserLatitude, order, NULL); // UserLatAccuracy exif_rational_write(content, SGEO_TAG_USER_LATACCURACY, &collection->UserLatitudeAccuracy, order, NULL); // UserAltitude exif_srational_write(content, SGEO_TAG_USER_ALTITUDE, &collection->UserAltitude, order, NULL); // UserAltAccuracy exif_rational_write(content, SGEO_TAG_USER_ALTACCURACY, &collection->UserAltitudeAccuracy, order, NULL); // UserEarthLavel exif_srational_write(content, SGEO_TAG_USER_EARTH_LEVEL, &collection->UserEarthLevel, order, NULL); // UserAzimuth exif_srational_write(content, SGEO_TAG_USER_AZIMUTH, &collection->UserAzimuth, order, NULL); // UserAzimuthAccuracy exif_rational_write(content, SGEO_TAG_USER_AZIMUTHACCURACY, &collection->UserAzimuthAccuracy, order, NULL); // UserPitch exif_srational_write(content, SGEO_TAG_USER_PITCH, &collection->UserPitch, order, NULL); // UserPitchAccuracy exif_rational_write(content, SGEO_TAG_USER_PITCHACCURACY, &collection->UserPitchAccuracy, order, NULL); // UserRoll exif_srational_write(content, SGEO_TAG_USER_ROLL, &collection->UserRoll, order, NULL); // UserRollAccuracy exif_rational_write(content, SGEO_TAG_USER_ROLLACCURACY, &collection->UserRollAccuracy, order, NULL); // UserHViewAngle exif_rational_write(content, SGEO_TAG_USER_HVIEWANGLE, &collection->UserHViewAngle, order, NULL); // UserHViewAngleAccuracy exif_rational_write(content, SGEO_TAG_USER_HVIEWANGLEACCURACY, &collection->UserHViewAngleAccuracy, order, NULL); // UserVViewAngle exif_rational_write(content, SGEO_TAG_USER_VVIEWANGLE, &collection->UserVViewAngle, order, NULL); // UserVViewAngleAccuracy exif_rational_write(content, SGEO_TAG_USER_VVIEWANGLEACCURACY, &collection->UserVViewAngleAccuracy, order, NULL); // UserDeviceName write_unicode_string_to_exif(content, SGEO_TAG_USER_DEVICE_NAME, collection->UserDeviceName); // UserProgramName write_unicode_string_to_exif(content, SGEO_TAG_USER_PROGRAM_NAME, collection->UserProgramName); // UserUserName write_unicode_string_to_exif(content, SGEO_TAG_USER_USER_NAME, collection->UserUserName); // ResultLongitude exif_srational_write(content, SGEO_TAG_RESULT_LONGITUDE, &collection->ResultLongitude, order, NULL); // ResultLongAccuracy exif_rational_write(content, SGEO_TAG_RESULT_LONGACCURACY, &collection->ResultLongitudeAccuracy, order, NULL); // ResultLatitude exif_srational_write(content, SGEO_TAG_RESULT_LATITUDE, &collection->ResultLatitude, order, NULL); // ResultLatAccuracy exif_rational_write(content, SGEO_TAG_RESULT_LATACCURACY, &collection->ResultLatitudeAccuracy, order, NULL); // ResultAltitude exif_srational_write(content, SGEO_TAG_RESULT_ALTITUDE, &collection->ResultAltitude, order, NULL); // ResultAltAccuracy exif_rational_write(content, SGEO_TAG_RESULT_ALTACCURACY, &collection->ResultAltitudeAccuracy, order, NULL); // ResultAzimuth exif_srational_write(content, SGEO_TAG_RESULT_AZIMUTH, &collection->ResultAzimuth, order, NULL); // ResultAzimuthAccuracy exif_rational_write(content, SGEO_TAG_RESULT_AZIMUTHACCURACY, &collection->ResultAzimuthAccuracy, order, NULL); // ResultPitch exif_srational_write(content, SGEO_TAG_RESULT_PITCH, &collection->ResultPitch, order, NULL); // ResultPitchAccuracy exif_rational_write(content, SGEO_TAG_RESULT_PITCHACCURACY, &collection->ResultPitchAccuracy, order, NULL); // ResultRoll exif_srational_write(content, SGEO_TAG_RESULT_ROLL, &collection->ResultRoll, order, NULL); // ResultRollAccuracy exif_rational_write(content, SGEO_TAG_RESULT_ROLLACCURACY, &collection->ResultRollAccuracy, order, NULL); // ResultHViewAngle exif_rational_write(content, SGEO_TAG_RESULT_HVIEWANGLE, &collection->ResultHViewAngle, order, NULL); // ResultHViewAngleAccuracy exif_rational_write(content, SGEO_TAG_RESULT_HVIEWANGLEACCURACY, &collection->ResultHViewAngleAccuracy, order, NULL); // ResultVViewAngle exif_rational_write(content, SGEO_TAG_RESULT_VVIEWANGLE, &collection->ResultVViewAngle, order, NULL); // ResultVViewAngleAccuracy exif_rational_write(content, SGEO_TAG_RESULT_VVIEWANGLEACCURACY, &collection->ResultVViewAngleAccuracy, order, NULL); // GNSSType exif_long_write(content, SGEO_TAG_GNSS_TYPE, &collection->GNSSType, order, NULL); // DeviceName write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_NAME, collection->DeviceName); // DeviceIMEI write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_IMEI, collection->DeviceIMEI); // DeviceNumber write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_NUMBER, collection->DeviceNumber); // DeviceOS write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_OS, collection->DeviceOS); // DeviceOSVersion write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_OS_VERSION, collection->DeviceOSVersion); // DeviceVersion write_unicode_string_to_exif(content, SGEO_TAG_DEVICE_VERSION, collection->DeviceVersion); // DeviceDateTimeMeasure exif_mem_write(content, SGEO_TAG_DEVICE_DATE_TIME_MEASURE, EXIF_FORMAT_BYTE, collection->DeviceDateTimeMeasure, sizeof(collection->DeviceDateTimeMeasure), NULL); // ProgramName write_unicode_string_to_exif(content, SGEO_TAG_PROGRAM_NAME, collection->ProgramName); // ProgramVersion write_unicode_string_to_exif(content, SGEO_TAG_PROGRAM_VERSION, collection->ProgramVersion); // ProgramUserName write_unicode_string_to_exif(content, SGEO_TAG_PROGRAM_USER_NAME, collection->ProgramUserName); // DeviceName write_unicode_string_to_exif(content, SGEO_TAG_USER_DEVICE_NAME, collection->UserDeviceName); // ProgramName write_unicode_string_to_exif(content, SGEO_TAG_USER_PROGRAM_NAME, collection->UserProgramName); // ProgramUserName write_unicode_string_to_exif(content, SGEO_TAG_USER_USER_NAME, collection->UserUserName); // encrypted table generateEncryptData(&buf, &i, &collection->SGeoEncrypt, order); if (i > 0) { exif_long_write(content, SGEO_TAG_ENCRYPT_TYPE, &collection->SGeoEncrypt.Type, order, NULL); exif_mem_write(content, SGEO_TAG_ENCRYPT_ALGORITHM_VERSION, EXIF_FORMAT_BYTE, collection->SGeoEncrypt.AlgorithmVersion, sizeof(collection->SGeoEncrypt.AlgorithmVersion), NULL); exif_mem_write(content, SGEO_TAG_ENCRYPT_PUBLIC_KEY, EXIF_FORMAT_BYTE, collection->SGeoEncrypt.PublicKey, sizeof(collection->SGeoEncrypt.PublicKey), NULL); entry = exif_content_get_entry(content, (ExifTag)SGEO_TAG_ENCRYPT_TABLE); if (!entry) entry = create_tag(exif, ifd, (ExifTag)SGEO_TAG_ENCRYPT_TABLE, i, EXIF_FORMAT_BYTE); memcpy(entry->data, buf, i); xorCryptData(entry->data, i); free(buf); } #ifdef _SGEO_FULL // Sighting entry = exif_content_get_entry(content, (ExifTag)SGEO_TAG_SIGHTING); if (!entry && collection->UserSightingCount > 0) { entry = create_tag(exif, ifd, (ExifTag)SGEO_TAG_SIGHTING, sizeof(*collection->UserSightingData) * collection->UserSightingCount, EXIF_FORMAT_BYTE); buf = entry->data; for (i = 0; i < collection->UserSightingCount; i++) { exif_set_srational(buf, order, collection->UserSightingData[i].Angle); buf += sizeof(ExifSRational); *buf = collection->UserSightingData[i].Flags; buf++; } } #endif if (collection->ObjectsTable != NULL && collection->ObjectsTableCount > 0) exif_mem_write(content, (ExifTag)SGEO_TAG_OBJECT_TABLE, EXIF_FORMAT_BYTE, collection->ObjectsTable, sizeof(*collection->ObjectsTable) * collection->ObjectsTableCount, NULL); }