Chameleon

Chameleon Commit Details

Date:2015-09-22 03:14:29 (4 years 1 month ago)
Author:ErmaC
Commit:2761
Parents: 2760
Message:Merge fix bug in xml parses where keys like <integer ID=_ would break. These were improperly treated as strings and duplicated. Subsequent <integer IDREF keys would also retrieve the incorrect value. (credits to meklort)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/stringTable.c
M/branches/ErmaC/Enoch/i386/libsaio/xml.c
M/branches/ErmaC/Enoch/i386/libsaio/xml.h

File differences

branches/ErmaC/Enoch/i386/libsaio/xml.c
3838
3939
4040
41
4142
4243
4344
......
6566
6667
6768
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
6890
6991
7092
......
7799
78100
79101
102
103
104
105
106
107
108
109
110
111
112
113
80114
81115
82116
......
133167
134168
135169
136
137170
138171
139
140172
141173
142174
......
167199
168200
169201
170
171202
172203
173204
......
517548
518549
519550
520
551
521552
522553
523554
......
540571
541572
542573
543
574
544575
545576
546577
......
636667
637668
638669
639
640670
641671
642672
......
693723
694724
695725
696
697726
698727
699728
......
742771
743772
744773
745
746774
747775
748776
......
779807
780808
781809
782
783810
784811
785812
......
886913
887914
888915
889
890916
891917
892918
......
926952
927953
928954
929
930955
931956
932957
......
960985
961986
962987
963
964988
965989
966990
......
9851009
9861010
9871011
988
9891012
9901013
9911014
......
10351058
10361059
10371060
1038
10391061
10401062
10411063
......
10671089
10681090
10691091
1070
10711092
10721093
10731094
......
11051126
11061127
11071128
1108
11091129
11101130
11111131
......
11361156
11371157
11381158
1139
11401159
11411160
11421161
......
11511170
11521171
11531172
1154
11551173
11561174
11571175
......
11921210
11931211
11941212
1195
11961213
11971214
11981215
......
12311248
12321249
12331250
1234
12351251
12361252
12371253
#endif
string_ref *ref_strings = NULL;
string_ref *ref_integer = NULL;
/// TODO: remove below
static char *buffer_start = NULL;
ref_strings = new_ref;
}
void SaveRefInteger(int integer, int id)
{
//printf("Adding Ref Integer %d (%s)\n", id, integer);
string_ref *tmp = ref_integer;
while(tmp)
{
if(tmp->id == id)
{
tmp->string = (char*)integer;
return;
}
tmp = tmp->next;
}
string_ref *new_ref = malloc(sizeof(string_ref));
new_ref->string = (char*)integer;
new_ref->id = id;
new_ref->next = ref_integer;
ref_integer = new_ref;
}
char *GetRefString(int id)
{
string_ref *tmp = ref_strings;
return "Unknown";
}
int GetRefInteger(int id)
{
string_ref *tmp = ref_integer;
while(tmp)
{
if(tmp->id == id) return (int)tmp->string;
tmp = tmp->next;
}
//verbose("Unable to locate Ref String %d\n", id);
return 0;
}
struct Module {
struct Module *nextModule;
longwillLoad;
static void FreeSymbol(char *string);
#endif
//==========================================================================
// XMLGetProperty
TagPtr XMLGetProperty(TagPtr dict, const char *key)
{
TagPtr tagList, tag;
//==========================================================================
// XMLGetProperty
TagPtr XMLGetKey( TagPtr dict, int id )
{
TagPtr tagList, tag;
}
length = ParseTagInteger(buffer + pos, tag);
SaveRefString((*tag)->string, id);
SaveRefInteger((int)(*tag)->string, id);
}
else if(!strncmp(tagName + strlen(kXMLTagInteger " "), kXMLStringIDRef, strlen(kXMLStringIDRef)))
{
return -1;
}
}
int integer = (int)GetRefString(id);
int integer = GetRefInteger(id);
TagPtr tmpTag = NewTag();
if (tmpTag == 0)
//==========================================================================
// ParseTagList
static long ParseTagList( char *buffer, TagPtr *tag, long type, long empty )
{
longpos = 0;
//==========================================================================
// ParseTagKey
static long ParseTagKey( char *buffer, TagPtr *tag )
{
longlength = 0;
//==========================================================================
// ParseTagString
static long ParseTagString( char *buffer, TagPtr *tag )
{
longlength = 0;
//==========================================================================
// ParseTagInteger
static long ParseTagInteger( char *buffer, TagPtr *tag )
{
long length, integer;
//==========================================================================
// ParseTagData
static long ParseTagData( char *buffer, TagPtr *tag )
{
intactuallen = 0;
//==========================================================================
// ParseTagDate
static long ParseTagDate( char *buffer, TagPtr *tag )
{
longlength = 0;
//==========================================================================
// ParseTagBoolean
long ParseTagBoolean( char *buffer, TagPtr *tag, long type )
{
TagPtr tmpTag;
//==========================================================================
// GetNextTag
static long GetNextTag( char *buffer, char **tag, long *start )
{
longcnt;
// Modifies 'buffer' to add a '\0' at the end of the tag matching 'tag'.
// Returns the length of the data found, counting the end tag,
// or -1 if the end tag was not found.
static long FixDataMatchingTag( char *buffer, char *tag )
{
longlength;
//==========================================================================
// NewTag
#define kTagsPerBlock (0x1000)
static TagPtr gTagsFree= NULL;
//==========================================================================
// XMLFreeTag
void XMLFreeTag( TagPtr tag )
{
#if DOFREE
//==========================================================================
// Symbol object.
struct Symbol
{
long refCount;
//==========================================================================
// NewSymbol
static char *NewSymbol( char *string )
{
static SymbolPtr lastGuy = 0;
//==========================================================================
// FreeSymbol
#if DOFREE
static void FreeSymbol( char *string )
{
//==========================================================================
// FindSymbol
static SymbolPtr FindSymbol( char *string, SymbolPtr *prevSymbol )
{
SymbolPtr symbol, prev;
branches/ErmaC/Enoch/i386/libsaio/xml.h
8383
8484
8585
86
86
8787
8888
8989
9090
91
91
9292
9393
9494
......
102102
103103
104104
105
105
106106
107107
108108
bool XMLIsType(TagPtr dict, enum xmltype type);
bool XMLCastBoolean( TagPtr dict );
char* XMLCastString( TagPtr dict );
char *XMLCastString( TagPtr dict );
long XMLCastStringOffset(TagPtr dict);
int XMLCastInteger ( TagPtr dict );
TagPtr XMLCastDict ( TagPtr dict );
TagPtr XMLCastArray( TagPtr dict );
char* XMLCastData( TagPtr dict, int *length );
char *XMLCastData( TagPtr dict, int *length );
bool XMLIsBoolean(TagPtr entry);
bool XMLIsString (TagPtr entry);
long XMLParseNextTag(char *buffer, TagPtr *tag);
void XMLFreeTag(TagPtr tag);
char* XMLDecode(const char *in);
char *XMLDecode(const char *in);
//==========================================================================
// XMLParseFile
// Expects to see one dictionary in the XML file.
branches/ErmaC/Enoch/i386/libsaio/stringTable.c
356356
357357
358358
359
360359
361360
362361
363
364362
365363
366364
return value;
}
/* Returns TRUE if a value was found, FALSE otherwise.
* The boolean value of the key is stored in 'val'.
*/
bool getBoolForKey(const char *key, bool *result_val, config_file_t *config)
{
const char *key_val;

Archive Download the corresponding diff file

Revision: 2761