Logo Search packages:      
Sourcecode: djvulibre version File versions

GUTF8String GURL::decode_reserved ( const GUTF8String url  )  [static]

Decodes reserved characters from the URL. See also: {encode_reserved}().

Definition at line 1034 of file GURL.cpp.

References GBaseString::is_valid(), and GBaseString::length().

Referenced by fname(), hash_argument(), and UTF8Filename().

{
  const char *url=gurl;
  char *res;
  GPBuffer<char> gres(res,gurl.length()+1);
  char *r=res;
  for(const char * ptr=url;*ptr;++ptr,++r)
  {
    if (*ptr!=percent)
    {
      r[0]=*ptr;
    }else
    {
      int c1,c2;
      if ( ((c1=hexval(ptr[1]))>=0)
        && ((c2=hexval(ptr[2]))>=0) )
      {
        r[0]=(c1<<4)|c2;
        ptr+=2;
      } else
      {
        r[0]=*ptr;
      }
    }
  }
  r[0]=0;
  GUTF8String retval(res);
  if(!retval.is_valid())
  {
    retval=GNativeString(res);
  }
  return retval;
}


Generated by  Doxygen 1.6.0   Back to index