Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support for unknown encoding in expat wrapper

Signed-off-by: Michael Krelin <hacker@klever.net>
  • Loading branch information...
commit 47bf5ab634dc5cc3bd5d71894b2d6681f7a83024 1 parent a07665e
@hacker authored
Showing with 12 additions and 0 deletions.
  1. +3 −0  include/opkele/expat.h
  2. +9 −0 lib/expat.cc
View
3  include/opkele/expat.h
@@ -26,6 +26,9 @@ namespace opkele {
return XML_Parse(_x,s,len,final);
}
+ virtual int unknown_encoding(const XML_Char * /* n */,XML_Encoding * /* i */) { return XML_STATUS_ERROR; }
+ void set_unknown_encoding_handler();
+
virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { }
virtual void end_element(const XML_Char * /* n */) { }
void set_element_handler();
View
9 lib/expat.cc
@@ -92,6 +92,15 @@ namespace opkele {
XML_SetNamespaceDeclHandler(_x,_start_namespace_decl,_end_namespace_decl);
}
+ static int _unknown_encoding(void *ehd,const XML_Char *n,XML_Encoding *i) {
+ return ((expat_t*)ehd)->unknown_encoding(n,i);
+ }
+
+ void expat_t::set_unknown_encoding_handler() {
+ assert(_x);
+ XML_SetUnknownEncodingHandler(_x,_unknown_encoding,this);
+ }
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.