+ added XMLWRITER_MAXTAGSIZE 15
This commit is contained in:
rob tillaart 2015-05-23 19:26:38 +02:00
parent 3c3cd5259e
commit acb65aea4d
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
//
// FILE: XMLWriter.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.04
// VERSION: 0.1.05
// DATE: 2013-11-06
// PURPOSE: Simple XML library
//
@ -11,6 +11,7 @@
// 0.1.02 - 2013-11-07 +setIndentSize(), corrected history, +escape support
// 0.1.03 - 2015-03-07 refactored - footprint + interface
// 0.1.04 - 2015-05-21 refactored - reduce RAM -> used F() macro etc.
// 0.1.05 - 2015-05-23 added XMLWRITER_MAXTAGSIZE 15 (to support KML coordinates tag)
//
// Released to the public domain
//
@ -54,7 +55,7 @@ void XMLWriter::tagOpen(char* tag, bool newline)
void XMLWriter::tagOpen(char* tag, char* name, bool newline)
{
// TODO STACK GUARD
strncpy(tagStack[_idx++], tag, 10);
strncpy(tagStack[_idx++], tag, XMLWRITER_MAXTAGSIZE);
tagStart(tag);
if (name[0] != 0) tagField("name", name);
tagEnd(newline, NOSLASH);

View File

@ -3,7 +3,7 @@
//
// FILE: XMLWriter.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.04
// VERSION: 0.1.05
// DATE: 2013-11-06
// PURPOSE: Simple XML writer library
//
@ -13,7 +13,7 @@
#include "Arduino.h"
// no pre 1.0 support!
#define XMLWRITER_VERSION "0.1.04"
#define XMLWRITER_VERSION "0.1.05"
// for comment()
#define MULTILINE true
@ -30,6 +30,7 @@
// deepness of XML tree 5..10
// needed for stack of tagStack
#define XMLWRITER_MAXLEVEL 5
#define XMLWRITER_MAXTAGSIZE 15
// reduce footprint by not using all
// possible datatypes
@ -108,7 +109,7 @@ private:
// stack - used to remember the current tagname to create
// automatic the right close tag.
uint8_t _idx;
char tagStack[XMLWRITER_MAXLEVEL][11];
char tagStack[XMLWRITER_MAXLEVEL][XMLWRITER_MAXTAGSIZE+1];
};
#endif