summaryrefslogtreecommitdiffabout
path: root/lib
authorMichael Krelin <hacker@klever.net>2008-06-27 21:00:41 (UTC)
committer Michael Krelin <hacker@klever.net>2008-06-27 21:00:41 (UTC)
commit362678728b8232c9490e14ba14ff323d9a92d6be (patch) (side-by-side diff)
tree105675f96fff87916b2fdea8b51ad9fe98c5531d /lib
parenta344edbdddeac51524001faa10d06f85cfdb041c (diff)
downloadlibopkele-362678728b8232c9490e14ba14ff323d9a92d6be.zip
libopkele-362678728b8232c9490e14ba14ff323d9a92d6be.tar.gz
libopkele-362678728b8232c9490e14ba14ff323d9a92d6be.tar.bz2
made gcc 4.3 a bit happier
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/discovery.cc4
-rw-r--r--lib/message.cc2
-rw-r--r--lib/prequeue_rp.cc4
-rw-r--r--lib/secret.cc2
-rw-r--r--lib/util.cc6
5 files changed, 9 insertions, 9 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc
index d1989ec..984e308 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -330,25 +330,25 @@ namespace opkele {
}
size_t header(void *p,size_t s,size_t nm) {
size_t bytes = s*nm;
const char *h = (const char*)p;
const char *colon = (const char*)memchr(p,':',bytes);
const char *space = (const char*)memchr(p,' ',bytes);
if(space && ( (!colon) || space<colon ) ) {
xrds_location.clear(); http_content_type.clear();
}else if(colon) {
const char *hv = ++colon;
size_t hnl = colon-h;
int rb;
- for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb);
+ for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb) ;
while(rb>0 && isspace(hv[rb-1])) --rb;
if(rb) {
if( (hnl>=sizeof(XRDS_HEADER))
&& !strncasecmp(h,XRDS_HEADER":",
sizeof(XRDS_HEADER)) ) {
xrds_location.assign(hv,rb);
}else if( (hnl>=sizeof(CT_HEADER))
&& !strncasecmp(h,CT_HEADER":",
sizeof(CT_HEADER)) ) {
const char *sc = (const char*)memchr(
hv,';',rb);
http_content_type.assign(hv,sc?(sc-hv):rb);
@@ -491,25 +491,25 @@ namespace opkele {
l.assign(a[1]);
}
if(heq)
xrds_location = l;
}else if(is_element(n,"link")) {
string rels;
string href;
for(;*a;a+=2) {
if( !strcasecmp(a[0],"rel") ) {
rels.assign(a[1]);
}else if( !strcasecmp(a[0],"href") ) {
const char *ns = a[1];
- for(;*ns && isspace(*ns);++ns);
+ for(;*ns && isspace(*ns);++ns) ;
href.assign(ns);
string::size_type lns=href.find_last_not_of(data::_whitespace_chars);
href.erase(lns+1);
}
}
for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars);
ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) {
string::size_type s = rels.find_first_of(data::_whitespace_chars,ns);
string rel;
if(s==string::npos) {
rel.assign(rels,ns,string::npos);
ns = string::npos;
diff --git a/lib/message.cc b/lib/message.cc
index 524946a..c1f8088 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -149,25 +149,25 @@ namespace opkele {
}catch(failed_lookup&) {
return pfx;
}
}
string basic_openid_message::allocate_ns(const string& uri,const char *pfx) {
if(!has_field("ns"))
return pfx;
if(has_ns(uri))
throw bad_input(OPKELE_CP_ "OpenID message already contains namespace");
string rv = pfx;
if(has_field("ns."+rv)) {
string::reference c=rv[rv.length()];
- for(c='a';c<='z' && has_field("ns."+rv);++c);
+ for(c='a';c<='z' && has_field("ns."+rv);++c) ;
if(c=='z')
throw exception(OPKELE_CP_ "Failed to allocate namespace");
}
set_field("ns."+rv,uri);
return rv;
}
bool openid_message_t::has_field(const string& n) const {
return find(n)!=end();
}
const string& openid_message_t::get_field(const string& n) const {
const_iterator i=find(n);
diff --git a/lib/prequeue_rp.cc b/lib/prequeue_rp.cc
index e499d08..886efae 100644
--- a/lib/prequeue_rp.cc
+++ b/lib/prequeue_rp.cc
@@ -33,27 +33,27 @@ namespace opkele {
|| oep.local_id==IDURI_SELECT20 )
throw bad_input(OPKELE_CP_ "claimed_id is an OP-Id");
if(oep.local_id==id)
throw __OP_verifier_good_input(OPKELE_CP_ "Found corresponding endpoint");
}
return *this;
}
OP_verifier& operator++() { return *this; }
OP_verifier& operator++(int) { return *this; }
};
- void prequeue_RP::verify_OP(const string& OP,const string& claimed_id,const string& id) const {
+ void prequeue_RP::verify_OP(const string& OP,const string& _claimed_id,const string& id) const {
try {
- discover(OP_verifier(OP,id),claimed_id);
+ discover(OP_verifier(OP,id),_claimed_id);
throw id_res_unauthorized(OPKELE_CP_
"OP is not authorized to make an assertion regarding the identity");
}catch(__OP_verifier_good_input& ovgi) {
}
}
class endpoint_queuer : public iterator<output_iterator_tag,openid_endpoint_t,void> {
public:
prequeue_RP& rp;
endpoint_queuer(prequeue_RP& r) : rp(r) { }
diff --git a/lib/secret.cc b/lib/secret.cc
index d538890..3f1e39c 100644
--- a/lib/secret.cc
+++ b/lib/secret.cc
@@ -1,25 +1,25 @@
#include <algorithm>
#include <functional>
#include <opkele/types.h>
#include <opkele/exception.h>
#include <opkele/util.h>
namespace opkele {
using namespace std;
template<class __a1,class __a2,class __r>
struct bitwise_xor : public binary_function<__a1,__a2,__r> {
__r operator() (const __a1& a1,const __a2& a2) const {
- return a1^a2;
+ return (__r)(a1^a2);
}
};
void secret_t::enxor_to_base64(const unsigned char *key_d,string& rv) const {
vector<unsigned char> tmp;
transform(
begin(), end(),
key_d,
back_insert_iterator<vector<unsigned char> >(tmp),
bitwise_xor<unsigned char,unsigned char,unsigned char>() );
rv = util::encode_base64(&(tmp.front()),tmp.size());
}
diff --git a/lib/util.cc b/lib/util.cc
index b702291..d979502 100644
--- a/lib/util.cc
+++ b/lib/util.cc
@@ -202,25 +202,25 @@ namespace opkele {
*(ii++) = ' '; break;
case '%':
++i;
static char tmp[3] = {0,0,0};
if(i==ie)
throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string");
tmp[0] = *(i++);
if(i==ie)
throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string");
tmp[1] = *i;
if(!(isxdigit(tmp[0]) && isxdigit(tmp[1])))
throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string");
- *(ii++) = strtol(tmp,0,16);
+ *(ii++) = (char)strtol(tmp,0,16);
break;
default:
*(ii++) = *i; break;
}
}
return rv;
}
string attr_escape(const string& str) {
static const char *unsafechars = "<>&\n\"'";
string rv;
string::size_type p=0;
@@ -339,28 +339,28 @@ namespace opkele {
n = unsafe;
}
char c = uri[n++];
if(c=='%') {
if((n+1)>=ul)
throw bad_input(OPKELE_CP_ "Unexpected end of URI encountered while parsing percent-encoded character");
tmp[0] = uri[n++];
tmp[1] = uri[n++];
if(!( isxdigit(tmp[0]) && isxdigit(tmp[1]) ))
throw bad_input(OPKELE_CP_ "Invalid percent-encoded character in URI being normalized");
int cc = strtol(tmp,0,16);
if( isalpha(cc) || isdigit(cc) || strchr("._~-",cc) )
- pseg += cc;
+ pseg += (char)cc;
else{
pseg += '%';
- pseg += toupper(tmp[0]); pseg += toupper(tmp[1]);
+ pseg += (char)toupper(tmp[0]); pseg += (char)toupper(tmp[1]);
}
}else if(qf) {
rv += pseg; rv += c;
pseg.clear();
}else if(n>=ul || strchr("?/#",c)) {
if(pseg.empty() || pseg==".") {
}else if(pseg=="..") {
if(psegs.size()>1) {
rv.resize(psegs.top()); psegs.pop();
}
}else{
psegs.push(rv.length());