author | Michael Krelin <hacker@klever.net> | 2009-04-11 16:31:52 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2009-04-11 16:31:52 (UTC) |
commit | 10456ef16b0ef9d2288309127c1b6f356ace3f0b (patch) (unidiff) | |
tree | 09532917a39319ada79f445f7cd2d58868f98bfe | |
parent | 2f606a6221accb289b4e7982d57b04437190fda0 (diff) | |
download | libopkele-10456ef16b0ef9d2288309127c1b6f356ace3f0b.zip libopkele-10456ef16b0ef9d2288309127c1b6f356ace3f0b.tar.gz libopkele-10456ef16b0ef9d2288309127c1b6f356ace3f0b.tar.bz2 |
make compiler a bit happier
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/discovery.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc index 26f3eed..b4ed3b6 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -492,119 +492,119 @@ namespace opkele { | |||
492 | skipping = -1; | 492 | skipping = -1; |
493 | } | 493 | } |
494 | cdata = 0; | 494 | cdata = 0; |
495 | } | 495 | } |
496 | void character_data(const XML_Char *s,int l) { | 496 | void character_data(const XML_Char *s,int l) { |
497 | if(skipping) return; | 497 | if(skipping) return; |
498 | if(cdata) cdata->append(s,l); | 498 | if(cdata) cdata->append(s,l); |
499 | } | 499 | } |
500 | 500 | ||
501 | void html_start_element(const XML_Char *n,const XML_Char **a) { | 501 | void html_start_element(const XML_Char *n,const XML_Char **a) { |
502 | if(is_element(n,"meta")) { | 502 | if(is_element(n,"meta")) { |
503 | bool heq = false; | 503 | bool heq = false; |
504 | string l; | 504 | string l; |
505 | for(;*a;a+=2) { | 505 | for(;*a;a+=2) { |
506 | if(!( strcasecmp(a[0],"http-equiv") | 506 | if(!( strcasecmp(a[0],"http-equiv") |
507 | || strcasecmp(a[1],XRDS_HEADER) )) | 507 | || strcasecmp(a[1],XRDS_HEADER) )) |
508 | heq = true; | 508 | heq = true; |
509 | else if(!strcasecmp(a[0],"content")) | 509 | else if(!strcasecmp(a[0],"content")) |
510 | l.assign(a[1]); | 510 | l.assign(a[1]); |
511 | } | 511 | } |
512 | if(heq) | 512 | if(heq) |
513 | xrds_location = l; | 513 | xrds_location = l; |
514 | }else if(is_element(n,"link")) { | 514 | }else if(is_element(n,"link")) { |
515 | string rels; | 515 | string rels; |
516 | string href; | 516 | string href; |
517 | for(;*a;a+=2) { | 517 | for(;*a;a+=2) { |
518 | if( !strcasecmp(a[0],"rel") ) { | 518 | if( !strcasecmp(a[0],"rel") ) { |
519 | rels.assign(a[1]); | 519 | rels.assign(a[1]); |
520 | }else if( !strcasecmp(a[0],"href") ) { | 520 | }else if( !strcasecmp(a[0],"href") ) { |
521 | const char *ns = a[1]; | 521 | const char *ns = a[1]; |
522 | for(;*ns && isspace(*ns);++ns) ; | 522 | for(;*ns && isspace(*ns);++ns) ; |
523 | href.assign(ns); | 523 | href.assign(ns); |
524 | string::size_type lns=href.find_last_not_of(data::_whitespace_chars); | 524 | string::size_type lns=href.find_last_not_of(data::_whitespace_chars); |
525 | href.erase(lns+1); | 525 | href.erase(lns+1); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars); | 528 | for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars); |
529 | ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) { | 529 | ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) { |
530 | string::size_type s = rels.find_first_of(data::_whitespace_chars,ns); | 530 | string::size_type s = rels.find_first_of(data::_whitespace_chars,ns); |
531 | string rel; | 531 | string rel; |
532 | if(s==string::npos) { | 532 | if(s==string::npos) { |
533 | rel.assign(rels,ns,string::npos); | 533 | rel.assign(rels,ns,string::npos); |
534 | ns = string::npos; | 534 | ns = string::npos; |
535 | }else{ | 535 | }else{ |
536 | rel.assign(rels,ns,s-ns); | 536 | rel.assign(rels,ns,s-ns); |
537 | ns = s; | 537 | ns = s; |
538 | } | 538 | } |
539 | if(rel=="openid.server") | 539 | if(rel=="openid.server") |
540 | html_openid1.uris.add(-1,xrd::uri_t(href)); | 540 | html_openid1.uris.add(-1,xrd::uri_t(href)); |
541 | else if(rel=="openid.delegate") | 541 | else if(rel=="openid.delegate") |
542 | html_openid1.local_ids.add(-1,href); | 542 | html_openid1.local_ids.add(-1,href); |
543 | else if(rel=="openid2.provider") | 543 | else if(rel=="openid2.provider") |
544 | html_openid2.uris.add(-1,xrd::uri_t(href)); | 544 | html_openid2.uris.add(-1,xrd::uri_t(href)); |
545 | else if(rel=="openid2.local_id") | 545 | else if(rel=="openid2.local_id") |
546 | html_openid2.local_ids.add(-1,href); | 546 | html_openid2.local_ids.add(-1,href); |
547 | } | 547 | } |
548 | }else if(is_element(n,"body")) { | 548 | }else if(is_element(n,"body")) { |
549 | skipping = -1; | 549 | skipping = -1; |
550 | } | 550 | } |
551 | } | 551 | } |
552 | 552 | ||
553 | void queue_endpoints(endpoint_discovery_iterator& oi, | 553 | void queue_endpoints(endpoint_discovery_iterator& oi, |
554 | const idiscovery_t &id, | 554 | const idiscovery_t &id, |
555 | const service_type_t *st) { | 555 | const service_type_t *st) { |
556 | openid_endpoint_t ep; | 556 | openid_endpoint_t ep; |
557 | ep.claimed_id = id.canonicalized_id; | 557 | ep.claimed_id = id.canonicalized_id; |
558 | for(xrd::services_t::const_iterator isvc=id.xrd.services.begin(); | 558 | for(xrd::services_t::const_iterator isvc=id.xrd.services.begin(); |
559 | isvc!=id.xrd.services.end(); ++isvc) { | 559 | isvc!=id.xrd.services.end(); ++isvc) { |
560 | const xrd::service_t svc = isvc->second; | 560 | const xrd::service_t svc = isvc->second; |
561 | if(svc.types.find(st->uri)==svc.types.end()) continue; | 561 | if(svc.types.find(st->uri)==svc.types.end()) continue; |
562 | for(xrd::uris_t::const_iterator iu=svc.uris.begin();iu!=svc.uris.end();++iu) { | 562 | for(xrd::uris_t::const_iterator iu=svc.uris.begin();iu!=svc.uris.end();++iu) { |
563 | ep.uri = iu->second.uri; | 563 | ep.uri = iu->second.uri; |
564 | if(id.xri_identity) { | 564 | if(id.xri_identity) { |
565 | if(iu->second.append=="qxri") { | 565 | if(iu->second.append=="qxri") { |
566 | ep.uri += id.normalized_id; | 566 | ep.uri += id.normalized_id; |
567 | } /* TODO: else handle other append attribute values */ | 567 | } /* TODO: else handle other append attribute values */ |
568 | } | 568 | } |
569 | if(st->forceid) { | 569 | if(st->forceid) { |
570 | ep.local_id = ep.claimed_id = st->forceid; | 570 | ep.local_id = ep.claimed_id = st->forceid; |
571 | *(oi++) = ep; | 571 | *(oi++) = ep; |
572 | }else{ | 572 | }else{ |
573 | if(svc.local_ids.empty()) { | 573 | if(svc.local_ids.empty()) { |
574 | ep.local_id = ep.claimed_id; | 574 | ep.local_id = ep.claimed_id; |
575 | *(oi++) = ep; | 575 | *(oi++) = ep; |
576 | }else{ | 576 | }else{ |
577 | for(xrd::local_ids_t::const_iterator ilid=svc.local_ids.begin(); | 577 | for(xrd::local_ids_t::const_iterator ilid=svc.local_ids.begin(); |
578 | ilid!=svc.local_ids.end(); ++ilid) { | 578 | ilid!=svc.local_ids.end(); ++ilid) { |
579 | ep.local_id = ilid->second; | 579 | ep.local_id = ilid->second; |
580 | *(oi++) = ep; | 580 | *(oi++) = ep; |
581 | } | 581 | } |
582 | } | 582 | } |
583 | } | 583 | } |
584 | } | 584 | } |
585 | } | 585 | } |
586 | } | 586 | } |
587 | 587 | ||
588 | int unknown_encoding(const XML_Char *n,XML_Encoding *i) { | 588 | int unknown_encoding(const XML_Char* /* n */,XML_Encoding *i) { |
589 | for(int ii=0;ii < sizeof(i->map)/sizeof(i->map[0]);++ii) | 589 | for(unsigned int ii=0;ii < sizeof(i->map)/sizeof(i->map[0]);++ii) |
590 | i->map[ii] = ii; | 590 | i->map[ii] = ii; |
591 | i->convert = 0; i->release = 0; | 591 | i->convert = 0; i->release = 0; |
592 | return XML_STATUS_OK; | 592 | return XML_STATUS_OK; |
593 | } | 593 | } |
594 | 594 | ||
595 | }; | 595 | }; |
596 | 596 | ||
597 | string idiscover(endpoint_discovery_iterator oi,const string& identity) { | 597 | string idiscover(endpoint_discovery_iterator oi,const string& identity) { |
598 | idigger_t idigger; | 598 | idigger_t idigger; |
599 | return idigger.discover(oi,identity); | 599 | return idigger.discover(oi,identity); |
600 | } | 600 | } |
601 | 601 | ||
602 | void yadiscover(endpoint_discovery_iterator oi,const string& yurl,const char **types,bool redirs) try { | 602 | void yadiscover(endpoint_discovery_iterator oi,const string& yurl,const char **types,bool redirs) try { |
603 | idigger_t idigger; | 603 | idigger_t idigger; |
604 | idigger.yadiscover(oi,yurl,types,redirs); | 604 | idigger.yadiscover(oi,yurl,types,redirs); |
605 | }catch(exception_curl& ec) { | 605 | }catch(exception_curl& ec) { |
606 | if(redirs || ec._error!=CURLE_TOO_MANY_REDIRECTS) | 606 | if(redirs || ec._error!=CURLE_TOO_MANY_REDIRECTS) |
607 | throw; | 607 | throw; |
608 | } | 608 | } |
609 | 609 | ||
610 | } | 610 | } |