Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ packages/

# vcpkg generated
vcpkg_installed/

# run-tests log
error.log
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,24 @@ $ make TARGET=zoul clean all

In order to `make` the documentation you need to install [doxygen](https://www.doxygen.nl/).

Use one of the following commands to install `doxygen`:
Use one of the following commands to install `doxygen` and Valgrind for `run-tests` in
`tests/external/valgrind-checks`:

### macOS

This doesn't work great so a `run-tests-macos-arm` was added that calls `leaks`.

```sh
$ brew install doxygen
$ brew tap LouisBrunner/valgrind
$ brew install --HEAD LouisBrunner/valgrind/valgrind
```

### Linux (Ubuntu/Debian)

```sh
$ apt-get install doxygen
$ sudo apt-get install doxygen
$ sudo apt-get install valgrind
```

### Windows
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = *.txt

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand Down
5 changes: 1 addition & 4 deletions include/EXISerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ errorCode endElement(EXIStream* strm);
* of the attribute. It should be used to determine which function for data handling
* to be used for its content. Otherwise - VALUE_TYPE_NONE_CLASS
* @return Error handling code
* @todo Consider handling the lexicographical sorting of attributes by exip encoding utilities?
*/
errorCode attribute(EXIStream* strm, QName qname, bool isSchemaType, EXITypeClass* valueType);

Expand Down Expand Up @@ -224,7 +223,6 @@ errorCode qnameData(EXIStream* strm, QName qname);
*
* @param[in, out] strm EXI stream object
* @return Error handling code
* @todo define the parameters!
*/
errorCode processingInstruction(EXIStream* strm);

Expand All @@ -247,7 +245,6 @@ errorCode namespaceDeclaration(EXIStream* strm, const String ns, const String pr
*
* @param[in, out] strm EXI stream object
* @return Error handling code
* @todo define the parameters!
*/
errorCode selfContained(EXIStream* strm);

Expand Down Expand Up @@ -321,7 +318,7 @@ errorCode flushEXIData(EXIStream* strm, char* outBuf, unsigned int bufSize, unsi
* To be used by code generation tools such as static XML bindings
* and when efficiency is of high importance
*
* @param[in, out] strm EXI stream
* @param[in, out] strm EXI stream object
* @param[in] ec EXI event code of the production
* @param[in] qname used only for SE(*), AT(*), SE(uri:*), AT(uri:*) and when
* a new prefix should be serialized in SE(QName) and AT(QName); NULL otherwise
Expand Down
1 change: 0 additions & 1 deletion src/contentIO/src/EXISerializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "stringManipulate.h"
#include "streamEncode.h"
#include "initSchemaInstance.h"
#include "ioUtil.h"
#include "streamEncode.h"

/**
Expand Down
62 changes: 31 additions & 31 deletions src/contentIO/src/bodyDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

#include "bodyDecode.h"
#include "procTypes.h"
#include "sTables.h"
#include "memManagement.h"
#include "ioUtil.h"
#include "streamDecode.h"
#include "grammars.h"
Expand All @@ -31,10 +31,10 @@ static errorCode decodeQNameValue(EXIStream* strm, ContentHandler* handler, Smal
errorCode processNextProduction(EXIStream* strm, SmallIndex* nonTermID_out, ContentHandler* handler, void* app_data)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned int bitCount;
unsigned long tmp_bits_val = 0;
GrammarRule* currentRule;
Index prodCount;
unsigned int bitCount = 0;
unsigned int tmp_bits_val = 0;
GrammarRule* currentRule = NULL;
Index prodCount = 0;
SmallIndex currNonTermID = strm->gStack->currNonTermID;

// TODO: GR_CONTENT_2 is only needed when schema deviations are allowed.
Expand Down Expand Up @@ -165,7 +165,7 @@ static errorCode stateMachineProdDecode(EXIStream* strm, GrammarRule* currentRul
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned int prodCnt = 0;
unsigned long tmp_bits_val = 0;
unsigned int tmp_bits_val = 0;

if(IS_BUILT_IN_ELEM(strm->gStack->grammar->props))
{
Expand All @@ -177,7 +177,7 @@ static errorCode stateMachineProdDecode(EXIStream* strm, GrammarRule* currentRul
* The state depends on the input event code from the stream and the
* available productions at level 2.
* (Note this is the state for level 2 productions) */
unsigned long state = 0;
unsigned int state = 0;

/* The state mask stores the availability of the productions on level 2.
* They are encoded ordered:
Expand Down Expand Up @@ -424,7 +424,7 @@ static errorCode stateMachineProdDecode(EXIStream* strm, GrammarRule* currentRul
else
{
// Schema-informed element/type grammar
QName qname;
QName qname = {0};

if(WITH_STRICT(strm->header.opts.enumOpt))
{
Expand All @@ -435,7 +435,7 @@ static errorCode stateMachineProdDecode(EXIStream* strm, GrammarRule* currentRul
{
/* There are 2 possible states to exit the state machine: AT(xsi:type) and AT(xsi:nil)
* (Note this is the state for level 2 productions) */
unsigned long state = 1;
unsigned int state = 1;
bool nil;

*nonTermID_out = GR_START_TAG_CONTENT;
Expand Down Expand Up @@ -518,7 +518,7 @@ static errorCode stateMachineProdDecode(EXIStream* strm, GrammarRule* currentRul
* Availability for EE is encoded in position 0,
* availability for AT(xsi:type) is encoded in position 1,
* and so on. */
bool state_mask[11] = {false, false, false, false, false, false, false, false, false, false, false};
bool state_mask[11] = {0}; // all false
unsigned int i;
// Create a copy of the content grammar if and only if there are AT
// productions that point to the content grammar rule OR the content index is 0.
Expand Down Expand Up @@ -743,7 +743,7 @@ errorCode decodeQName(EXIStream* strm, QName* qname, QNameID* qnameID)
errorCode decodeUri(EXIStream* strm, SmallIndex* uriId)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned long tmp_val_buf = 0;
unsigned int tmp_val_buf = 0;
unsigned char uriBits = getBitsNumber(strm->schema->uriTable.count);

TRY(decodeNBitUnsignedInteger(strm, uriBits, &tmp_val_buf));
Expand Down Expand Up @@ -774,7 +774,7 @@ errorCode decodeLn(EXIStream* strm, Index uriId, Index* lnId)

if(tmpVar == 0) // local-name table hit
{
unsigned long l_lnId;
unsigned int l_lnId;
unsigned char lnBits = getBitsNumber((unsigned int)(strm->schema->uriTable.uri[uriId].lnTable.count - 1));
DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">local-name table hit\n"));
TRY(decodeNBitUnsignedInteger(strm, lnBits, &l_lnId));
Expand Down Expand Up @@ -806,7 +806,7 @@ errorCode decodePfxQname(EXIStream* strm, QName* qname, SmallIndex uriId)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned char prefixBits = 0;
unsigned long prefixID = 0;
unsigned int prefixID = 0;

qname->prefix = NULL;

Expand Down Expand Up @@ -834,7 +834,7 @@ errorCode decodePfxQname(EXIStream* strm, QName* qname, SmallIndex uriId)
errorCode decodePfx(EXIStream* strm, SmallIndex uriId, SmallIndex* pfxId)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned long tmp_val_buf = 0;
unsigned int tmp_val_buf = 0;
unsigned char prfxBits = getBitsNumber(strm->schema->uriTable.uri[uriId].pfxTable.count);

TRY(decodeNBitUnsignedInteger(strm, prfxBits, &tmp_val_buf));
Expand Down Expand Up @@ -866,7 +866,7 @@ errorCode decodeStringValue(EXIStream* strm, QNameID qnameID, String* value)
if(tmpVar == 0) // "local" value partition table hit
{
#if VALUE_CROSSTABLE_USE
unsigned long vxEntryId = 0;
unsigned int vxEntryId = 0;
unsigned char vxBits;
VxTable* vxTable;

Expand All @@ -883,7 +883,7 @@ errorCode decodeStringValue(EXIStream* strm, QNameID qnameID, String* value)
}
else if(tmpVar == 1)// global value partition table hit
{
unsigned long valueEntryID = 0;
unsigned int valueEntryID = 0;
unsigned char valueBits;

valueBits = getBitsNumber(strm->valueTable.count - 1);
Expand Down Expand Up @@ -1047,8 +1047,8 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
break;
case VALUE_TYPE_SMALL_INTEGER:
{
unsigned long uintVal;
int64_t base;
unsigned int uintVal;
int base;
int64_t upLimit;

if(typeId >= strm->schema->simpleTypeTable.count)
Expand Down Expand Up @@ -1112,8 +1112,8 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
break;
case VALUE_TYPE_BINARY:
{
Index nbytes;
char *binary_val;
Index nbytes = 0;
char *binary_val = NULL;
//DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">Binary value\n"));
TRY(decodeBinary(strm, &binary_val, &nbytes));

Expand Down Expand Up @@ -1192,9 +1192,9 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
break;
case VALUE_TYPE_LIST:
{
UnsignedInteger itemCount;
Index itemTypeId;
unsigned int i;
UnsignedInteger itemCount = 0;
Index itemTypeId = 0;
unsigned int i = 0;

TRY(decodeUnsignedInteger(strm, &itemCount));

Expand Down Expand Up @@ -1222,7 +1222,7 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
break;
default: // VALUE_TYPE_STRING || VALUE_TYPE_NONE || VALUE_TYPE_UNTYPED
{
String value;
String value = {0};
bool freeable = false;

/* ENUMERATION CHECK */
Expand All @@ -1231,7 +1231,7 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
// There is enumeration defined
EnumDefinition eDefSearch;
EnumDefinition* eDefFound;
unsigned long indx;
unsigned int indx;

eDefSearch.typeId = typeId;
eDefFound = bsearch(&eDefSearch, strm->schema->enumTable.enumDef, strm->schema->enumTable.count, sizeof(EnumDefinition), compareEnumDefs);
Expand Down Expand Up @@ -1266,8 +1266,8 @@ errorCode decodeValueItem(EXIStream* strm, Index typeId, ContentHandler* handler
errorCode decodeNSEvent(EXIStream* strm, ContentHandler* handler, SmallIndex* nonTermID_out, void* app_data)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
SmallIndex ns_uriId;
SmallIndex pfxId;
SmallIndex ns_uriId = 0;
SmallIndex pfxId = 0;
bool bool_val = false;

DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">NS event:\n"));
Expand All @@ -1289,7 +1289,7 @@ errorCode decodeSEWildcardEvent(EXIStream* strm, ContentHandler* handler, SmallI
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
EXIGrammar* elemGrammar = NULL;
QName qname;
QName qname = {0};
QNameID qnameId = {URI_MAX, LN_MAX};

DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">SE(*) event\n"));
Expand Down Expand Up @@ -1423,7 +1423,7 @@ errorCode decodeSEWildcardEvent(EXIStream* strm, ContentHandler* handler, SmallI
errorCode decodeATWildcardEvent(EXIStream* strm, ContentHandler* handler, SmallIndex* nonTermID_out, void* app_data)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
QName qname;
QName qname = {0};
QNameID qnameId = {URI_MAX, LN_MAX};

DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">AT(*) event\n"));
Expand Down Expand Up @@ -1455,8 +1455,8 @@ static errorCode decodeQNameValue(EXIStream* strm, ContentHandler* handler, Smal
{
// TODO: Add the case when Preserve.lexicalValues option value is true - instead of Qname decode it as String
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
QName qname;
QNameID qnameId;
QName qname = {0};
QNameID qnameId = {URI_MAX, LN_MAX};
EXIGrammar* newGrammar = NULL;

TRY(decodeQName(strm, &qname, &qnameId));
Expand Down
7 changes: 1 addition & 6 deletions src/contentIO/src/headerDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
*/

#include "headerDecode.h"
#include "streamDecode.h"
#include "streamRead.h"
#include "contentHandler.h"
#include "memManagement.h"
#include "bodyDecode.h"
#include "grammars.h"
#include "EXIParser.h"
#include "sTables.h"
#include "stringManipulate.h"
#include "initSchemaInstance.h"

/** This is the statically generated EXIP schema definition for the EXI Options document*/
extern const EXIPSchema ops_schema;
Expand Down Expand Up @@ -53,7 +48,7 @@ struct ops_AppData
errorCode decodeHeader(EXIStream* strm, bool outOfBandOpts)
{
errorCode tmp_err_code = EXIP_UNEXPECTED_ERROR;
unsigned long bits_val = 0;
unsigned int bits_val = 0;
bool boolVal = false;

DEBUG_MSG(INFO, DEBUG_CONTENT_IO, (">Start EXI header decoding\n"));
Expand Down
2 changes: 1 addition & 1 deletion src/streamIO/include/streamDecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @param[out] int_val resulting n-bit unsigned integer value
* @return Error handling code
*/
errorCode decodeNBitUnsignedInteger(EXIStream* strm, unsigned char n, unsigned long* int_val);
errorCode decodeNBitUnsignedInteger(EXIStream* strm, unsigned char n, unsigned int* int_val);

/**
* @brief Decode EXI Boolean
Expand Down
2 changes: 1 addition & 1 deletion src/streamIO/include/streamEncode.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @param[in] int_val n-bit unsigned integer value
* @return Error handling code
*/
errorCode encodeNBitUnsignedInteger(EXIStream* strm, unsigned char n, unsigned long int_val);
errorCode encodeNBitUnsignedInteger(EXIStream* strm, unsigned char n, unsigned int int_val);

/**
* @brief Encode EXI Boolean
Expand Down
2 changes: 1 addition & 1 deletion src/streamIO/include/streamRead.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ errorCode readNextBit(EXIStream* strm, bool* bit_val);
* @param[out] bits_val resulting bits value
* @return Error handling code
*/
errorCode readBits(EXIStream* strm, unsigned char n, unsigned long* bits_val);
errorCode readBits(EXIStream* strm, unsigned char n, unsigned int* bits_val);

#endif /* STREAMREADER_H_ */
2 changes: 1 addition & 1 deletion src/streamIO/include/streamWrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ errorCode writeNextBit(EXIStream* strm, bool bit_val);
* @param[in] nbits number of bits
* @param[in] bits_val resulting bits value
*/
errorCode writeNBits(EXIStream* strm, unsigned char nbits, unsigned long bits_val);
errorCode writeNBits(EXIStream* strm, unsigned char nbits, unsigned int bits_val);

#endif /* STREAMWRITE_H_ */
Loading