From eb273c67144b8e1690737756bddc8e008e89f784 Mon Sep 17 00:00:00 2001 From: ishmal Date: Thu, 29 Mar 2007 17:10:50 +0000 Subject: [PATCH] make glib dep configurable again --- src/dom/charclass.h | 2 +- src/dom/cssparser.cpp | 2 +- src/dom/cssparser.h | 11 ++-- src/dom/io/domstream.h | 2 +- src/dom/io/gzipstream.cpp | 2 +- src/dom/io/gzipstream.h | 2 +- src/dom/jsdombind.cpp | 2 +- src/dom/jsdombind.h | 16 ++++-- src/dom/jsengine.cpp | 2 +- src/dom/jsengine.h | 16 ++++-- src/dom/lsimpl.cpp | 2 +- src/dom/lsimpl.h | 10 ++-- src/dom/mingwenv.bat | 2 +- src/dom/svg/svgparser.h | 11 ++-- src/dom/uri.cpp | 106 +++++++++++++++++++++++++++++++++++++- src/dom/uri.h | 23 ++++++--- src/dom/util/ziptool.cpp | 27 ++++++++-- src/dom/util/ziptool.h | 28 +++++++--- src/dom/xmlreader.h | 12 +++-- src/dom/xpathparser.cpp | 2 +- src/dom/xpathparser.h | 15 ++++-- 21 files changed, 235 insertions(+), 60 deletions(-) diff --git a/src/dom/charclass.h b/src/dom/charclass.h index 1f39c7e8d..adf18dd09 100644 --- a/src/dom/charclass.h +++ b/src/dom/charclass.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/cssparser.cpp b/src/dom/cssparser.cpp index 8f245c06d..d6aaac13d 100644 --- a/src/dom/cssparser.cpp +++ b/src/dom/cssparser.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/cssparser.h b/src/dom/cssparser.h index 816936dc3..f03b243da 100644 --- a/src/dom/cssparser.h +++ b/src/dom/cssparser.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,7 +29,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "dom.h" @@ -72,7 +71,7 @@ public: virtual bool parseFile(const DOMString &str); -protected: +private: DOMString parsebuf; long parselen; @@ -82,7 +81,11 @@ protected: /** * */ - void error(char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * Get the character at the given location in the buffer. diff --git a/src/dom/io/domstream.h b/src/dom/io/domstream.h index 2ffeef4e3..273782b67 100644 --- a/src/dom/io/domstream.h +++ b/src/dom/io/domstream.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/io/gzipstream.cpp b/src/dom/io/gzipstream.cpp index f634acbe7..9ac24dc75 100644 --- a/src/dom/io/gzipstream.cpp +++ b/src/dom/io/gzipstream.cpp @@ -8,7 +8,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/io/gzipstream.h b/src/dom/io/gzipstream.h index 4af5ada2b..ea0807f32 100644 --- a/src/dom/io/gzipstream.h +++ b/src/dom/io/gzipstream.h @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/jsdombind.cpp b/src/dom/jsdombind.cpp index d38722636..2bb9d23c8 100644 --- a/src/dom/jsdombind.cpp +++ b/src/dom/jsdombind.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/jsdombind.h b/src/dom/jsdombind.h index 33a71816a..eb2f54659 100644 --- a/src/dom/jsdombind.h +++ b/src/dom/jsdombind.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,8 +29,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "jsengine.h" @@ -127,12 +125,20 @@ private: /** * Ouput a printf-formatted error message */ - void error(char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * Ouput a printf-formatted error message */ - void trace(char *fmt, ...) G_GNUC_PRINTF(2,3); + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; JSRuntime *rt; diff --git a/src/dom/jsengine.cpp b/src/dom/jsengine.cpp index 38b856c3c..680d5a671 100644 --- a/src/dom/jsengine.cpp +++ b/src/dom/jsengine.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/jsengine.h b/src/dom/jsengine.h index f47a7a4c7..b7bbe2bc1 100644 --- a/src/dom/jsengine.h +++ b/src/dom/jsengine.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,8 +29,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "dom.h" #include "js/jsapi.h" @@ -134,12 +132,20 @@ private: /** * Ouput a printf-formatted error message */ - void error(char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * Ouput a printf-formatted error message */ - void trace(char *fmt, ...) G_GNUC_PRINTF(2,3); + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; JSRuntime *rt; diff --git a/src/dom/lsimpl.cpp b/src/dom/lsimpl.cpp index 8848a42e4..84d12ddfb 100644 --- a/src/dom/lsimpl.cpp +++ b/src/dom/lsimpl.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/lsimpl.h b/src/dom/lsimpl.h index d73998e13..0dd0dc62c 100644 --- a/src/dom/lsimpl.h +++ b/src/dom/lsimpl.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,8 +29,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "domimpl.h" #include "events.h" #include "traversal.h" @@ -238,7 +236,11 @@ private: void spaces(); - void po(char *fmt, ...) G_GNUC_PRINTF(2,3); + void po(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; void pos(const DOMString &str); diff --git a/src/dom/mingwenv.bat b/src/dom/mingwenv.bat index f9ec1e7c5..996566e7b 100644 --- a/src/dom/mingwenv.bat +++ b/src/dom/mingwenv.bat @@ -1,2 +1,2 @@ -set PATH=c:\mingw4\bin;%PATH% +set PATH=c:\mingw\bin;%PATH% set RM=del diff --git a/src/dom/svg/svgparser.h b/src/dom/svg/svgparser.h index 307b44e01..548077dd5 100644 --- a/src/dom/svg/svgparser.h +++ b/src/dom/svg/svgparser.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,7 +30,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "svgimpl.h" @@ -77,7 +76,7 @@ public: -protected: +private: /** * Get the next character in the parse buf, 0 if out @@ -123,7 +122,11 @@ protected: /** * */ - void error(char *format, ...) G_GNUC_PRINTF(2,3); + void error(char *format, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; diff --git a/src/dom/uri.cpp b/src/dom/uri.cpp index 9b1102b61..af808f40d 100644 --- a/src/dom/uri.cpp +++ b/src/dom/uri.cpp @@ -501,6 +501,83 @@ int URI::match(int p0, char *key) //# http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#components //######################################################################### +int URI::parseHex(int p0, int &result) +{ + int p = p0; + int val = 0; + + //# Upper 4 + XMLCh ch = peek(p); + if (ch >= '0' && ch <= '9') + val += (ch - '0'); + else if (ch >= 'a' && ch <= 'f') + val += (10 + ch - 'a'); + else if (ch >= 'A' && ch <= 'F') + val += (10 + ch - 'A'); + else + { + error("parseHex : unexpected character : %c", ch); + return -1; + } + p++; + val <<= 4; + + //# Lower 4 + ch = peek(p); + if (ch >= '0' && ch <= '9') + val += (ch - '0'); + else if (ch >= 'a' && ch <= 'f') + val += (10 + ch - 'a'); + else if (ch >= 'A' && ch <= 'F') + val += (10 + ch - 'A'); + else + { + error("parseHex : unexpected character : %c", ch); + return -1; + } + result = val; + return p; +} + + + +int URI::parseEntity(int p0, int &result) +{ + int p = p0; + XMLCh ch = peek(p); + if (ch != '&') + return p0; + p++; + if (!match(p, "#x")) + { + error("parseEntity: expected '#x'"); + return -1; + } + p += 2; + int val; + p = parseHex(p, val); + if (p<0) + return -1; + result = val; + return p; +} + +int URI::parseAsciiEntity(int p0, int &result) +{ + int p = p0; + XMLCh ch = peek(p); + if (ch != '%') + return p0; + p++; + int val; + p = parseHex(p, val); + if (p<0) + return -1; + result = val; + return p; +} + + int URI::parseScheme(int p0) { int p = p0; @@ -577,8 +654,33 @@ int URI::parseHierarchicalPart(int p0) ch = peek(p); if (ch == '?' || ch == '#') break; - path.push_back((XMLCh)ch); - p++; + else if (ch == '&') //IRI entity + { + int val; + p2 = parseEntity(p, val); + if (p2 - #include "dom.h" @@ -198,15 +196,28 @@ private: DOMString fragment; - void error(const char *fmt, ...) G_GNUC_PRINTF(2,3); - - void trace(const char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(const char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; + void trace(const char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; int peek(int p); int match(int p, char *key); + int parseHex(int p, int &result); + + int parseEntity(int p, int &result); + + int parseAsciiEntity(int p, int &result); + int parseScheme(int p); int parseHierarchicalPart(int p0); diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp index 7dbd07be5..fc4c7bad4 100644 --- a/src/dom/util/ziptool.cpp +++ b/src/dom/util/ziptool.cpp @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -231,12 +231,20 @@ private: /** * */ - void error(char *fmt, ...); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * */ - void trace(char *fmt, ...); + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * @@ -836,8 +844,17 @@ public: private: //debug messages - void error(char *fmt, ...); - void trace(char *fmt, ...); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; + + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; bool compressWindow(); diff --git a/src/dom/util/ziptool.h b/src/dom/util/ziptool.h index 120fe568a..f8cf01cc8 100644 --- a/src/dom/util/ziptool.h +++ b/src/dom/util/ziptool.h @@ -15,7 +15,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,7 +32,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include #include @@ -204,8 +203,17 @@ private: std::string fileName; //debug messages - void error(char *fmt, ...) G_GNUC_PRINTF(2,3); - void trace(char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; + + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; unsigned long crc; @@ -470,8 +478,16 @@ public: private: //debug messages - void error(char *fmt, ...) G_GNUC_PRINTF(2,3); - void trace(char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; + void trace(char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; //# Private writing methods diff --git a/src/dom/xmlreader.h b/src/dom/xmlreader.h index f616fd1e1..16ab883a0 100644 --- a/src/dom/xmlreader.h +++ b/src/dom/xmlreader.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,8 +30,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "dom.h" namespace org @@ -79,9 +77,13 @@ public: org::w3c::dom::DocumentPtr parseFile(char *fileName); -protected: +private: - void error(char *format, ...) G_GNUC_PRINTF(2,3); + void error(char *format, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; int get(int ch); int peek(int ch); diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp index d299973f9..916158ec2 100644 --- a/src/dom/xpathparser.cpp +++ b/src/dom/xpathparser.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2006 Bob Jamison + * Copyright (C) 2006-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h index 7a5b7cb55..2a604aa61 100644 --- a/src/dom/xpathparser.h +++ b/src/dom/xpathparser.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -416,7 +415,11 @@ private: /** * */ - void trace(const char *fmt, ...) G_GNUC_PRINTF(2,3); + void trace(const char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; /** * @@ -426,7 +429,11 @@ private: /** * */ - void error(const char *fmt, ...) G_GNUC_PRINTF(2,3); + void error(const char *fmt, ...) + #ifdef G_GNUC_PRINTF + G_GNUC_PRINTF(2, 3) + #endif + ; //################################# //# LEXICAL SCANNING -- 2.30.2