[neon/backports-focal/libgwenhywfar/Neon/release] /: New upstream version 5.6.0
Micha Lenk
null at kde.org
Mon Sep 27 15:37:12 BST 2021
Git commit d4f60df4fc97e2e3a365f808868396da681611c4 by Micha Lenk.
Committed on 21/02/2021 at 21:32.
Pushed by jriddell into branch 'Neon/release'.
New upstream version 5.6.0
M +5 -5 configure
M +5 -5 configure.ac
M +1 -1 gwenhywfar.spec
M +9 -9 src/gui/cgui.c
M +9 -9 src/gui/cgui_p.h
M +1 -1 src/os/windows/errorstring.c
M +4 -3 src/os/windows/gwenthread.c
M +0 -2 src/os/windows/threadlocaldata.c
M +7 -0 src/parser/xml.h
M +73 -23 src/parser/xmlctx.c
M +4 -4 src/ressource.rc
M +4 -4 src/version.h
M +29 -5 src/xmlcmd/xmlcmd_gxml_todb.c
M +64 -0 test/gwentest.c
https://invent.kde.org/neon/backports-focal/libgwenhywfar/commit/d4f60df4fc97e2e3a365f808868396da681611c4
diff --git a/configure b/configure
index 1b4ee34..7d99bb3 100755
--- a/configure
+++ b/configure
@@ -2917,8 +2917,8 @@ ac_config_headers="$ac_config_headers config.h"
# versions
#
GWENHYWFAR_VERSION_MAJOR=5
-GWENHYWFAR_VERSION_MINOR=5
-GWENHYWFAR_VERSION_PATCHLEVEL=1
+GWENHYWFAR_VERSION_MINOR=6
+GWENHYWFAR_VERSION_PATCHLEVEL=0
GWENHYWFAR_VERSION_BUILD=0
GWENHYWFAR_VERSION_TAG="stable"
@@ -2928,9 +2928,9 @@ GWENHYWFAR_VERSION_TAG="stable"
#
# SO version for Gwenhywfar
#
-GWENHYWFAR_SO_CURRENT="84"
-GWENHYWFAR_SO_AGE="5"
-GWENHYWFAR_SO_REVISION="1"
+GWENHYWFAR_SO_CURRENT="85"
+GWENHYWFAR_SO_AGE="6"
+GWENHYWFAR_SO_REVISION="0"
GWENHYWFAR_SO_EFFECTIVE="`echo \$(($GWENHYWFAR_SO_CURRENT-$GWENHYWFAR_SO_AGE))`"
diff --git a/configure.ac b/configure.ac
index a830072..23a0ba5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,8 +28,8 @@ AC_CONFIG_HEADERS([config.h])
# versions
#
GWENHYWFAR_VERSION_MAJOR=5
-GWENHYWFAR_VERSION_MINOR=5
-GWENHYWFAR_VERSION_PATCHLEVEL=1
+GWENHYWFAR_VERSION_MINOR=6
+GWENHYWFAR_VERSION_PATCHLEVEL=0
GWENHYWFAR_VERSION_BUILD=0
dnl "stable", "rcX", "betaX", "cvs"
GWENHYWFAR_VERSION_TAG="stable"
@@ -40,9 +40,9 @@ GWENHYWFAR_VERSION_TAG="stable"
#
# SO version for Gwenhywfar
#
-GWENHYWFAR_SO_CURRENT="84"
-GWENHYWFAR_SO_AGE="5"
-GWENHYWFAR_SO_REVISION="1"
+GWENHYWFAR_SO_CURRENT="85"
+GWENHYWFAR_SO_AGE="6"
+GWENHYWFAR_SO_REVISION="0"
GWENHYWFAR_SO_EFFECTIVE="`echo \$(($GWENHYWFAR_SO_CURRENT-$GWENHYWFAR_SO_AGE))`"
diff --git a/gwenhywfar.spec b/gwenhywfar.spec
index 6ecd22b..e27cd33 100644
--- a/gwenhywfar.spec
+++ b/gwenhywfar.spec
@@ -3,7 +3,7 @@
%define name gwenhywfar
-%define version 5.5.1
+%define version 5.6.0
%define rpm_cxxflags \"-O2 -march=i486 -mcpu=i586\"
%define rpm_cflags \"-O2 -march=i486 -mcpu=i586\"
diff --git a/src/gui/cgui.c b/src/gui/cgui.c
index 2d23937..475a9f4 100644
--- a/src/gui/cgui.c
+++ b/src/gui/cgui.c
@@ -375,7 +375,7 @@ int GWEN_Gui_CGui__input(GWEN_UNUSED GWEN_GUI *gui,
-int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
uint32_t flags,
const char *title,
const char *text,
@@ -455,7 +455,7 @@ int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
-int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
uint32_t flags,
const char *title,
const char *text,
@@ -534,7 +534,7 @@ int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
-uint32_t GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui,
+uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui,
GWEN_UNUSED uint32_t flags,
const char *title,
const char *text,
@@ -560,7 +560,7 @@ uint32_t GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui,
-void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
+void GWENHYWFAR_CB GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
{
GWEN_GUI_CGUI *cgui;
@@ -573,7 +573,7 @@ void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
-uint32_t GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui,
+uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui,
uint32_t progressFlags,
const char *title,
const char *text,
@@ -622,7 +622,7 @@ GWEN_GUI_CPROGRESS *GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id)
-int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui,
uint32_t id,
uint64_t progress)
{
@@ -645,7 +645,7 @@ int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui,
-int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
{
GWEN_GUI_CGUI *cgui;
GWEN_GUI_CPROGRESS *cp;
@@ -665,7 +665,7 @@ int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
-int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui,
uint32_t id,
GWEN_LOGGER_LEVEL level,
const char *text)
@@ -689,7 +689,7 @@ int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui,
-int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
{
GWEN_GUI_CGUI *cgui;
GWEN_GUI_CPROGRESS *cp;
diff --git a/src/gui/cgui_p.h b/src/gui/cgui_p.h
index e1097ef..a1eafeb 100644
--- a/src/gui/cgui_p.h
+++ b/src/gui/cgui_p.h
@@ -52,7 +52,7 @@ int GWEN_Gui_CGui__input(GWEN_GUI *gui,
GWEN_GUI_CPROGRESS *GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id);
-int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
uint32_t flags,
const char *title,
const char *text,
@@ -61,7 +61,7 @@ int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui,
const char *b3,
uint32_t guiid);
-int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
uint32_t flags,
const char *title,
const char *text,
@@ -70,33 +70,33 @@ int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui,
int maxLen,
uint32_t guiid);
-uint32_t GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui,
+uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui,
uint32_t flags,
const char *title,
const char *text,
uint32_t guiid);
-void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, uint32_t id);
+void GWENHYWFAR_CB GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, uint32_t id);
-uint32_t GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui,
+uint32_t GWENHYWFAR_CB GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui,
uint32_t progressFlags,
const char *title,
const char *text,
uint64_t total,
uint32_t guiid);
-int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui,
uint32_t id,
uint64_t progress);
-int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total);
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total);
-int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui,
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui,
uint32_t id,
GWEN_LOGGER_LEVEL level,
const char *text);
-int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id);
+int GWENHYWFAR_CB GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id);
#endif
diff --git a/src/os/windows/errorstring.c b/src/os/windows/errorstring.c
index 358f8fa..7529177 100644
--- a/src/os/windows/errorstring.c
+++ b/src/os/windows/errorstring.c
@@ -29,9 +29,9 @@
#include "errorstring.h"
+#include <winsock2.h>
#include <windows.h>
#include <winerror.h>
-#include <winsock2.h>
diff --git a/src/os/windows/gwenthread.c b/src/os/windows/gwenthread.c
index b1d81ab..8fca927 100644
--- a/src/os/windows/gwenthread.c
+++ b/src/os/windows/gwenthread.c
@@ -161,13 +161,14 @@ DWORD WINAPI _threadRun_cb(LPVOID lpParam)
thr=(GWEN_THREAD*) lpParam;
assert(thr);
- if (thr->runFn)
+ if (thr->runFn) {
thr->runFn(thr);
- else {
+ } else {
DBG_ERROR(GWEN_LOGDOMAIN, "No run function set in thread");
+ return 1;
}
- return NULL;
+ return 0;
}
diff --git a/src/os/windows/threadlocaldata.c b/src/os/windows/threadlocaldata.c
index 797a2ec..f5b8e90 100644
--- a/src/os/windows/threadlocaldata.c
+++ b/src/os/windows/threadlocaldata.c
@@ -76,8 +76,6 @@ void GWEN_ThreadLocalData_free(GWEN_THREADLOCAL_DATA *threadLocalData)
int GWEN_ThreadLocalData_SetData(GWEN_THREADLOCAL_DATA *threadLocalData, void *pointer)
{
- int rv;
-
if (!TlsSetValue(threadLocalData->dwTlsIndex, (LPVOID) pointer)) {
DWORD lastError;
diff --git a/src/parser/xml.h b/src/parser/xml.h
index 2691424..ee009c7 100644
--- a/src/parser/xml.h
+++ b/src/parser/xml.h
@@ -104,6 +104,13 @@ extern "C" {
#define GWEN_XML_FLAGS_HANDLE_NAMESPACES 0x0200
+/**
+ * Handle input as kind of SGML data.
+ * This means that elements with text data are handled as if they had a closing
+ * element (e.g. "<DESC>Text" is handles like "<DESC>Text</DESC>").
+ */
+#define GWEN_XML_FLAGS_SGML 0x0400
+
/**
* combination of other flags resembling the default flags
*/
diff --git a/src/parser/xmlctx.c b/src/parser/xmlctx.c
index d0aadb9..fb7306a 100644
--- a/src/parser/xmlctx.c
+++ b/src/parser/xmlctx.c
@@ -1,9 +1,6 @@
/***************************************************************************
- $RCSfile$
- -------------------
- cvs : $Id: xsd.c 656 2004-12-22 17:02:05Z aquamaniac $
begin : Sat Jun 28 2003
- copyright : (C) 2003 by Martin Preuss
+ copyright : (C) 2021 by Martin Preuss
email : martin at libchipcard.de
***************************************************************************
@@ -48,6 +45,23 @@ GWEN_INHERIT_FUNCTIONS(GWEN_XML_CONTEXT)
+/* ------------------------------------------------------------------------------------------------
+ * forward declarations
+ * ------------------------------------------------------------------------------------------------
+ */
+
+
+static GWEN_XMLNODE *_findTagForClosingTagAndcloseAndMoveSubTags(GWEN_XML_CONTEXT *ctx, GWEN_XMLNODE *currNode, const char *tagName);
+static void _moveSubTagsUpOneLevel(GWEN_XMLNODE *currNode);
+
+
+
+/* ------------------------------------------------------------------------------------------------
+ * implementations
+ * ------------------------------------------------------------------------------------------------
+ */
+
+
GWEN_XML_CONTEXT *GWEN_XmlCtx_new(uint32_t flags)
{
@@ -427,29 +441,15 @@ int GWEN_XmlCtxStore_StartTag(GWEN_XML_CONTEXT *ctx, const char *tagName)
}
if (strcasecmp(s, tagName)!=0) {
+ /* current closing tag doesn't match currently open tag, check further */
if (!(GWEN_XmlCtx_GetFlags(ctx) & GWEN_XML_FLAGS_TOLERANT_ENDTAGS)) {
- DBG_INFO(GWEN_LOGDOMAIN,
- "Endtag does not match curent tag (%s != %s)", s, tagName);
+ DBG_INFO(GWEN_LOGDOMAIN, "Endtag does not match curent tag (%s != %s)", s, tagName);
return GWEN_ERROR_BAD_DATA;
}
else {
- newNode=currNode;
-
- while ((newNode=GWEN_XMLNode_GetParent(newNode))) {
- GWEN_XmlCtx_DecDepth(ctx);
- s=GWEN_XMLNode_GetData(newNode);
- if (strcasecmp(s, tagName)==0)
- break;
- }
- if (newNode)
- newNode=GWEN_XMLNode_GetParent(newNode);
- if (newNode) {
- GWEN_XmlCtx_SetCurrentNode(ctx, newNode);
- GWEN_XmlCtx_DecDepth(ctx);
- }
- else {
- DBG_INFO(GWEN_LOGDOMAIN, "No matching parent node for [%s]",
- tagName);
+ newNode=_findTagForClosingTagAndcloseAndMoveSubTags(ctx, currNode, tagName);
+ if (newNode==NULL) {
+ DBG_INFO(GWEN_LOGDOMAIN, "here");
return GWEN_ERROR_BAD_DATA;
}
}
@@ -480,6 +480,56 @@ int GWEN_XmlCtxStore_StartTag(GWEN_XML_CONTEXT *ctx, const char *tagName)
+GWEN_XMLNODE *_findTagForClosingTagAndcloseAndMoveSubTags(GWEN_XML_CONTEXT *ctx, GWEN_XMLNODE *currNode, const char *tagName)
+{
+ GWEN_XMLNODE *newNode;
+
+ newNode=currNode;
+
+ if (GWEN_XmlCtx_GetFlags(ctx) & GWEN_XML_FLAGS_SGML)
+ _moveSubTagsUpOneLevel(currNode);
+
+ while ((newNode=GWEN_XMLNode_GetParent(newNode))) {
+ const char *s;
+
+ GWEN_XmlCtx_DecDepth(ctx);
+ s=GWEN_XMLNode_GetData(newNode);
+ if (strcasecmp(s, tagName)==0)
+ break;
+ if (GWEN_XmlCtx_GetFlags(ctx) & GWEN_XML_FLAGS_SGML)
+ _moveSubTagsUpOneLevel(newNode);
+ }
+ if (newNode)
+ newNode=GWEN_XMLNode_GetParent(newNode);
+ if (newNode) {
+ GWEN_XmlCtx_SetCurrentNode(ctx, newNode);
+ GWEN_XmlCtx_DecDepth(ctx);
+ return newNode;
+ }
+ else {
+ DBG_INFO(GWEN_LOGDOMAIN, "No matching parent node for [%s]", tagName);
+ return NULL;
+ }
+}
+
+
+
+void _moveSubTagsUpOneLevel(GWEN_XMLNODE *currNode)
+{
+ GWEN_XMLNODE *childNode;
+ GWEN_XMLNODE *parentNode;
+
+ parentNode=GWEN_XMLNode_GetParent(currNode);
+ if (parentNode) {
+ while( (childNode=GWEN_XMLNode_GetFirstTag(currNode)) ) {
+ GWEN_XMLNode_UnlinkChild(currNode, childNode);
+ GWEN_XMLNode_AddChild(parentNode, childNode);
+ }
+ }
+}
+
+
+
int GWEN_XmlCtxStore_EndTag(GWEN_XML_CONTEXT *ctx, int closing)
{
GWEN_XMLNODE *currNode;
diff --git a/src/ressource.rc b/src/ressource.rc
index 9740e51..315bbae 100644
--- a/src/ressource.rc
+++ b/src/ressource.rc
@@ -43,8 +43,8 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
// Version
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 5, 5, 1, 0
- PRODUCTVERSION 5, 5, 1, 0
+ FILEVERSION 5, 6, 0, 0
+ PRODUCTVERSION 5, 6, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L // Windows NT
@@ -58,14 +58,14 @@ BEGIN
//VALUE "Comments", "\0"
VALUE "CompanyName", " Aquamaniac\0"
VALUE "FileDescription", "Multi purpose library\0"
- VALUE "FileVersion", "v5.5.1\0"
+ VALUE "FileVersion", "v5.6.0\0"
VALUE "InternalName", "Gwenhywfar\0"
VALUE "LegalCopyright", "Copyright � 2003 by Martin Preuss\0"
VALUE "LegalTrademarks", "Aquamaniac\0"
VALUE "OriginalFilename", "GWENHYWFAR32.DLL\0"
//VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Gwenhywfar\0"
- VALUE "ProductVersion", "v5.5.1stable-0\0"
+ VALUE "ProductVersion", "v5.6.0stable-0\0"
VALUE "Author", "Martin Preuss\0"
VALUE "Email", "martin at libchipcard.de\0"
VALUE "Homepage", "http://gwenhywfar.sf.net/\0"
diff --git a/src/version.h b/src/version.h
index 9325a58..3e643d6 100644
--- a/src/version.h
+++ b/src/version.h
@@ -31,12 +31,12 @@
#define GWEN_VERSION_MAJOR 5
#define GWENHYWFAR_VERSION_MAJOR 5
-#define GWENHYWFAR_VERSION_MINOR 5
-#define GWENHYWFAR_VERSION_PATCHLEVEL 1
+#define GWENHYWFAR_VERSION_MINOR 6
+#define GWENHYWFAR_VERSION_PATCHLEVEL 0
#define GWENHYWFAR_VERSION_BUILD 0
#define GWENHYWFAR_VERSION_TAG "stable"
-#define GWENHYWFAR_VERSION_FULL_STRING "5.5.1stable-0"
-#define GWENHYWFAR_VERSION_STRING "5.5.1"
+#define GWENHYWFAR_VERSION_FULL_STRING "5.6.0stable-0"
+#define GWENHYWFAR_VERSION_STRING "5.6.0"
#define GWENHYWFAR_SO_EFFECTIVE 79
#define GWENHYWFAR_SO_EFFECTIVE_STR "79"
diff --git a/src/xmlcmd/xmlcmd_gxml_todb.c b/src/xmlcmd/xmlcmd_gxml_todb.c
index 6fab046..d7c8e43 100644
--- a/src/xmlcmd/xmlcmd_gxml_todb.c
+++ b/src/xmlcmd/xmlcmd_gxml_todb.c
@@ -235,7 +235,7 @@ int _convertAndSetCharValue(GWEN_UNUSED GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xm
tmpl=GWEN_XMLNode_GetProperty(xmlNode, "template", "YYYYMMDD");
if (!(tmpl && *tmpl)) {
- DBG_ERROR(GWEN_LOGDOMAIN, "Empty template in \"SetCharValue\"");
+ DBG_ERROR(GWEN_LOGDOMAIN, "Empty date template in \"SetCharValue\"");
GWEN_Buffer_free(resultBuf);
GWEN_Buffer_free(vbuf);
return GWEN_ERROR_INVALID;
@@ -247,6 +247,29 @@ int _convertAndSetCharValue(GWEN_UNUSED GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xm
GWEN_Date_free(dt);
}
}
+ else if (strcasecmp(typ, "time")==0) {
+ const char *tmpl;
+ GWEN_TIME *ti=NULL;
+
+ tmpl=GWEN_XMLNode_GetProperty(xmlNode, "template", "YYYYMMDDhhmmss");
+ if (!(tmpl && *tmpl)) {
+ DBG_ERROR(GWEN_LOGDOMAIN, "Empty time template in \"SetCharValue\"");
+ GWEN_Buffer_free(resultBuf);
+ GWEN_Buffer_free(vbuf);
+ return GWEN_ERROR_INVALID;
+ }
+
+ ti=GWEN_Time_fromString(value, tmpl);
+ if (ti) {
+ GWEN_Time_toString(ti, "YYYYMMDDhhmmss", vbuf);
+ GWEN_Time_free(ti);
+ }
+ else {
+ DBG_INFO(GWEN_LOGDOMAIN, "Invalid timespec \"%s\" according to template \"%s\"",
+ value?value:"<empty>", tmpl);
+ return GWEN_ERROR_INVALID;
+ }
+ }
if (strcasecmp(mode, "add")==0) {
/* just exchange the buffer */
@@ -317,7 +340,7 @@ int _handleXmlEnter(GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xmlNode)
n=GWEN_XMLNode_GetNodeByXPath(GWEN_XmlCommanderGwenXml_GetCurrentDocNode(cmd), path, GWEN_PATH_FLAGS_PATHMUSTEXIST);
if (n==NULL) {
- DBG_ERROR(GWEN_LOGDOMAIN, "Path \"%s\" does not exist", path);
+ DBG_ERROR(GWEN_LOGDOMAIN, "XmlEnter: Path \"%s\" does not exist", path);
return GWEN_ERROR_INVALID;
}
@@ -351,10 +374,11 @@ int _handleXmlForEvery(GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xmlNode)
n=GWEN_XMLNode_FindFirstTag(GWEN_XmlCommanderGwenXml_GetCurrentDocNode(cmd), path, NULL, NULL);
if (n==NULL) {
- DBG_ERROR(GWEN_LOGDOMAIN, "Path \"%s\" not found", path);
+ DBG_INFO(GWEN_LOGDOMAIN, "XmlForEvery: Path \"%s\" not found, not entering", path);
/* GWEN_XMLNode_Dump(cmd->currentDocNode, 2); */
}
while (n) {
+ DBG_INFO(GWEN_LOGDOMAIN, "XmlForEvery: Entering path \"%s\"", path);
/* enter given document node */
GWEN_XmlCommanderGwenXml_EnterDocNode(cmd, n);
@@ -624,7 +648,7 @@ int _handleXmlIfHasCharData(GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xmlNode)
}
}
else {
- DBG_INFO(GWEN_LOGDOMAIN, "No value for path \"%s\"", path);
+ DBG_INFO(GWEN_LOGDOMAIN, "XmlIfHasCharData: No value for path \"%s\"", path);
}
return 0;
@@ -681,7 +705,7 @@ int _handleXmlIfPathExists(GWEN_XMLCOMMANDER *cmd, GWEN_XMLNODE *xmlNode)
}
}
else {
- DBG_INFO(GWEN_LOGDOMAIN, "Path \"%s\" does not exist", path);
+ DBG_INFO(GWEN_LOGDOMAIN, "XmlIfPathExists: Path \"%s\" does not exist", path);
}
return 0;
diff --git a/test/gwentest.c b/test/gwentest.c
index 0789570..0f19674 100644
--- a/test/gwentest.c
+++ b/test/gwentest.c
@@ -866,6 +866,66 @@ int testXML6(int argc, char **argv)
+int testXML7(int argc, char **argv)
+{
+ GWEN_XMLNODE *n;
+
+ if (argc<3) {
+ fprintf(stderr, "Name of testfile needed.\n");
+ return 1;
+ }
+ n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "root");
+ GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Debug);
+ GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevel_Verbous);
+ if (GWEN_XML_ReadFile(n, argv[2],
+ GWEN_XML_FLAGS_DEFAULT |
+ GWEN_XML_FLAGS_HANDLE_HEADERS |
+ GWEN_XML_FLAGS_TOLERANT_ENDTAGS |
+ GWEN_XML_FLAGS_HANDLE_OPEN_HTMLTAGS |
+ GWEN_XML_FLAGS_SGML)) {
+ fprintf(stderr, "Error reading XML file.\n");
+ return 1;
+ }
+ fprintf(stderr, "XML file:\n");
+ GWEN_XMLNode_Dump(n, 2);
+ GWEN_XMLNode_free(n);
+
+ return 0;
+}
+
+
+
+int testXML8(int argc, char **argv)
+{
+ GWEN_XMLNODE *n;
+
+ if (argc<3) {
+ fprintf(stderr, "Name of testfile needed.\n");
+ return 1;
+ }
+ n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "root");
+ GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Debug);
+ GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevel_Verbous);
+ if (GWEN_XML_ReadFile(n, argv[2],
+ GWEN_XML_FLAGS_TOLERANT_ENDTAGS |
+ GWEN_XML_FLAGS_HANDLE_OPEN_HTMLTAGS |
+ GWEN_XML_FLAGS_SGML |
+ GWEN_XML_FLAGS_DEFAULT)) {
+ fprintf(stderr, "Error reading XML file.\n");
+ return 1;
+ }
+ fprintf(stderr, "XML file:\n");
+ GWEN_XMLNode_Dump(n, 2);
+ if (GWEN_XMLNode_WriteFile(n, "xml.out", GWEN_XML_FLAGS_SIMPLE)) {
+ fprintf(stderr, "Could not write file xml.out\n");
+ return 2;
+ }
+ GWEN_XMLNode_free(n);
+ return 0;
+}
+
+
+
int testMsg(void)
{
GWEN_XMLNODE *n;
@@ -6391,6 +6451,10 @@ int main(int argc, char **argv)
rv=testXML5();
else if (strcasecmp(argv[1], "xml6")==0)
rv=testXML6(argc, argv);
+ else if (strcasecmp(argv[1], "xml7")==0)
+ rv=testXML7(argc, argv);
+ else if (strcasecmp(argv[1], "xml8")==0)
+ rv=testXML8(argc, argv);
else if (strcasecmp(argv[1], "sn")==0)
rv=testSnprintf();
else if (strcasecmp(argv[1], "process")==0)
More information about the Neon-commits
mailing list