Giter Club home page Giter Club logo

ezxml's People

Contributors

lxfontes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ezxml's Issues

Cannot remove attributes

When passing NULL to ezxml_set_attr I am getting a segfault, even though in file itself it says that passing NULL would remove tag.

Hope to hear from you soon,

Thanks in advance.

Compilation Warning([ezxml.c.]/ [line 813]): comparison between signed and unsigned integer expression [-Wsign-compare]

Summary

Compilation warning arise in ezxml.c for gcc-7 compiler to compare between signed integer(-1) and unsigned variable (root->len) within function void ezxml_free(ezxml_t xml).

It raises an -Wsign-compare warning in gcc-7.

Steps to reproduce

The environment is under CentOS Linux release 7.9.2009 (Core), with gcc (GCC) 7.3.0.

Compilation rules were defined as below, with ezxml.h located in ${PROJECT_BINARY_DIR} and ezxml.c in the same directory with CMakeList.txt. ( same with #6 )

project(APP C)
include_directories(${PROJECT_BINARY_DIR})

# source files
set(CLI_SRC ezxml.c)

add_executable(APP ${CLI_SRC})
...

What is the current bug(warning) behavior?

gcc shows warning as below:

[ 85%] Building C object cli/CMakeFiles/ezxml.c.o
/home/cli/ezxml.c: In function 'ezxml_free':
/home/cli/ezxml.c:813:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (root->len == -1) free(root->m);
                       ^

Possible fixes

My suggestion would be add a type conversion such as

if (root->len == (unsigned int)-1) free(root->m); // malloced xml data

Instead of

if (root->len == -1) free(root->m); // malloced xml data

Labels

/label ~bug ~reproduced ~needs-investigation

Compilation Warning([ezxml.c.]/ [line 364]): operation on 's' may be undefined [-Wsequence-point]

Summary

Compilation warning arise in ezxml.c for gcc compiler to parse an inline expression of condition which breaks a while loop.

The code snippet triggering the warning took place in line 364, inside function ezxml_internal_dtd(), which aims to parse default attributes such as .

Steps to reproduce

The environment is under CentOS Linux release 7.9.2009 (Core), with gcc (GCC) 7.3.0.

Compilation rules were defined ias below, with ezxml.h located in ${PROJECT_BINARY_DIR} and ezxml.c in the same directory with CMakeList.txt.

project(APP C)
include_directories(${PROJECT_BINARY_DIR})

# source files
set(CLI_SRC ezxml.c)

add_executable(APP ${CLI_SRC})
...

What is the current bug(warning) behavior?

gcc shows warning as below:

[ 85%] Building C object cli/CMakeFiles/ezxml.c.o
/home/cli/ezxml.c: In function 'ezxml_internal_dtd':
/home/cli/ezxml.c:364:26: warning: operation on 's' may be undefined [-Wsequence-point]
             while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') {
                          ^

Possible fixes

My suggestion would be removing the inline condition expression, and adopting an multi-line expression instead.

Such as

while (*n != '>') {
                ++s;
                if (*(n = s + strspn(s, EZXML_WS)) == 0) { break; }
                ...

Labels

/label ~bug ~reproduced ~needs-investigation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.