Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.6.2 #8

Merged
merged 9 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/iksemel_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
if: failure()
run: |
cat /home/runner/work/iksemel/iksemel/build/meson-logs/meson-log.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iksemel_gnutls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if: failure()
run: |
cat /home/runner/work/iksemel/iksemel/build/meson-logs/meson-log.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iksemel_openssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if: failure()
run: |
cat /home/runner/work/iksemel/iksemel/build/meson-logs/meson-log.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/iksemel_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: failure()
run: |
cat /home/runner/work/iksemel/iksemel/build/meson-logs/meson-log.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Logs
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2024-08-12 Zaryob
* uchar.h independent utf-8 decoding.

2020-06-12 Zaryob
* All building structure chaned with meson build tools.

Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

[![Travis Status](https://travis-ci.org/Zaryob/iksemel.svg?branch=master)](https://travis-ci.org/Zaryob/iksemel) ![Language](https://img.shields.io/badge/language-c-blue.svg) ![License](https://img.shields.io/badge/license-LGPL2-purple.svg) [![Document](https://img.shields.io/badge/document-gh--pages-blue)](https://zaryob.github.io/iksemels)

iksemel 1.6.1
iksemel 1.6.2

http://code.google.com/p/iksemel

Owner:
Copyright (c) 2000-2011 Gurer Ozen <meduketto at gmail.com>
Owner:
Copyright (c) 2000-2011 Gurer Ozen <meduketto at gmail.com>

Changes and adaptations:
Copyright (c) 2016-2022 Suleyman Poyraz <zaryob.dev at gmail.com>
Changes and maintenance:
Copyright (c) 2016-2024 Suleyman Poyraz <zaryob.dev at gmail.com>

Introduction:
-------------
Expand All @@ -36,23 +36,25 @@ Compiling & Install:
--------------------

If you got the source from CVS, type

```bash
meson build

```
for creating configuration script and files.

Then type

```bash
ninja -C build

```
now library is compiled. You can test it with

```bash
ninja test -C build

```
and install it with

(become root if necessary)
```bash
ninja install -C build
```

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "iksemel"
version = "1.6.1"
version = "1.6.2"
authors = [
{ name="Suleyman Poyraz", email="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion python/test/attibutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import iksemel as iks

doc_xml = "<lala b='' c='42'/>"
doc_xml = "<lala b=\"\" c=\"42\"/>"

doc = iks.newDocument("lala")
doc.setAttribute("a", "lala")
Expand Down
4 changes: 2 additions & 2 deletions python/test/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
doc_xml = """
<test>
<a><b><c/></b></a>
<item foo='lala'>
<item foo="lala">
<tuktuk>blah &amp; bleh</tuktuk>
<nanuk/>
</item>
Expand Down Expand Up @@ -58,7 +58,7 @@
b.setAttribute("lal", "foo")
b = doc.insertNode(b)
b.setAttribute("lal", "foofff")
assert(doc.toString() == "<a><b lal='foofff'/></a>")
assert(doc.toString() == "<a><b lal=\"foofff\"/></a>")

# now with append, prepend and insertNode

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from distutils.core import setup, Extension
from distutils.command.install import install

version = '1.6.1'
version = '1.6.2'

distfiles = """
README
Expand Down
24 changes: 15 additions & 9 deletions src/dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,32 @@ struct dom_data {
static int
tagHook (struct dom_data *data, char *name, char **atts, int type)
{
iks *x;
iks* x;

if (IKS_OPEN == type || IKS_SINGLE == type) {
if (data->current) {
x = iks_insert (data->current, name);
} else {
ikstack *s;
s = iks_stack_new (data->chunk_size, data->chunk_size);
x = iks_new_within (name, s);
x = iks_insert(data->current, name);
}
else {
ikstack* s;
s = iks_stack_new(data->chunk_size, data->chunk_size);
x = iks_new_within(name, s);
if (!x) {
iks_stack_delete (s);
return IKS_NOMEM;
}
}
if (atts) {
int i=0;
int i = 0;
while (atts[i]) {
iks_insert_attrib (x, atts[i], atts[i+1]);
iks_insert_attrib(x, atts[i], atts[i + 1]);
i += 2;
}
}
data->current = x;
}
if (IKS_CLOSE == type || IKS_SINGLE == type) {
x = iks_parent (data->current);
x = iks_parent(data->current);
if (iks_strcmp(iks_name(data->current), name) != 0)
return IKS_BADXML;
if (x)
Expand Down Expand Up @@ -141,6 +146,7 @@ iks_load (const char *fname, iks **xptr)
int e;
e = iks_parse (prs, buf, len, done);
if (IKS_OK != e) {
iks_parser_delete (prs);
ret = e;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/iks.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,9 @@ iks_string (ikstack *s, iks *x)
*t++ = ' ';
t = my_strcat (t, IKS_ATTRIB_NAME (y), 0);
*t++ = '=';
*t++ = '\'';
*t++ = '"';
t = escape (t, IKS_ATTRIB_VALUE (y), strlen (IKS_ATTRIB_VALUE (y)));
*t++ = '\'';
*t++ = '"';
y = y->next;
}
if (IKS_TAG_CHILDREN (x)) {
Expand Down
7 changes: 5 additions & 2 deletions src/sax.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ sax_core (iksparser *prs, char *buf, int len)
char **tmp;
if (prs->attcur == 0) tmp = NULL; else tmp = prs->atts;
err = prs->tagHook (prs->user_data, prs->tag_name, tmp, prs->tagtype);
if (IKS_OK != err) return err;
if (IKS_OK != err) {
iks_free(prs->atts);
return err;
}
}
prs->stack_pos = 0;
stack_old = -1;
Expand Down Expand Up @@ -374,7 +377,7 @@ sax_core (iksparser *prs, char *buf, int len)
if (!tmp) return IKS_NOMEM;
memset (tmp, 0, sizeof(char *) * 2 * prs->attmax);
memcpy (tmp, prs->atts, sizeof(char *) * prs->attcur);
free (prs->atts);
iks_free(prs->atts);
prs->atts = tmp;
}
}
Expand Down
11 changes: 9 additions & 2 deletions test/tst-dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ document (char *xml)
break;
case IKS_NOMEM:
PR_TEST;
iks_parser_delete(p);
puts ("Not enough memory.");
exit (1);
case IKS_BADXML:
PR_TEST;
printf ("Invalid xml at byte %ld in\n[%s]\n", iks_nr_bytes (p), xml);
iks_parser_delete(p);
exit (1);
case IKS_HOOK:
PR_TEST;
Expand All @@ -44,6 +46,10 @@ document (char *xml)
iks_parser_delete (p);
}

void finalize() {
if (my_x) iks_delete(my_x);
}

void
tag (char *name, ...)
{
Expand Down Expand Up @@ -140,8 +146,8 @@ string (char *xml)
}

static char buf[] =
"<presence id='JCOM_11' to='[email protected]' type='available'><status>"
"&quot; &lt;online&amp;dangerous&gt; &quot;</status>meow<a><b c='d'/>"
"<presence id=\"JCOM_11\" to=\"[email protected]\" type=\"available\"><status>"
"&quot; &lt;online&amp;dangerous&gt; &quot;</status>meow<a><b c=\"d\"/>"
"</a><test/></presence>";

int main (int argc, char *argv[])
Expand All @@ -160,5 +166,6 @@ int main (int argc, char *argv[])
tag ("test", 0);
string (buf);

finalize();
return 0;
}
4 changes: 2 additions & 2 deletions test/tst-iks.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
int main (int argc, char *argv[])
{
static char xml[] =
"<iq type='result' to='[email protected]'><query xmlns='jabber:iq:version'>"
"<name>TestClient</name><os>SuxOS 2000</os><version><stable solidity='rock'/>"
"<iq type=\"result\" to=\"[email protected]\"><query xmlns=\"jabber:iq:version\">"
"<name>TestClient</name><os>SuxOS 2000</os><version><stable solidity=\"rock\"/>"
"1.2.0 patchlevel 2</version></query></iq>";
static char xml2[] =
"<Ni><C/>lala<br/><A/>Hello World<B/></Ni>";
Expand Down
11 changes: 10 additions & 1 deletion test/tst-sax.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,15 @@ test_size (int blocksize)
case IKS_OK:
break;
case IKS_NOMEM:
iks_parser_delete(prs);
exit (1);
case IKS_BADXML:
PRINT_TEST;
printf ("Invalid xml at byte %ld in\n[%s]\n", iks_nr_bytes (prs), tester.doc);
iks_parser_delete(prs);
exit (1);
case IKS_HOOK:
iks_parser_delete(prs);
exit (1);
}
i += blocksize;
Expand Down Expand Up @@ -266,13 +269,19 @@ test_bad (int badbyte)
case IKS_OK:
break;
case IKS_NOMEM:
iks_parser_delete(p);
exit (1);
case IKS_BADXML:
if (iks_nr_bytes (p) == badbyte) return;
if (iks_nr_bytes (p) == badbyte) {
iks_parser_delete(p);
return;
}
break;
case IKS_HOOK:
iks_parser_delete(p);
exit (1);
}
iks_parser_delete(p);
printf ("Sax test %d:\n", tester.nr_tests);
printf ("Expected bad byte %d, got %ld in\n[%s]\n", badbyte, iks_nr_bytes (p), tester.doc);
exit (1);
Expand Down
Loading