Subversion Repository Public Repository

Divide-Dependencies

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of NVIDIA CORPORATION nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.

#include "PxSimpleTypes.h"
#include "NvParameters.h"
#include "nvparameterized/NvParameterizedTraits.h"

#include "NvTraitsInternal.h"

#include "XmlDeserializer.h"

#define XML_WARNING(_format, ...) \
	NV_PARAM_TRAITS_WARNING(mTraits, "XML serializer: " _format, ##__VA_ARGS__)



namespace NvParameterized
{

/*!
Get number of elements in array
*/
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define PX_ARRAY_SIZE(_array) (sizeof(ArraySizeHelper(_array)))

	static uint32_t ReadVersion(const physx::shdfnd::FastXml::AttributePairs& attr)
	{
		const char *versionText = attr.get("version");

		// If there's no version, assume version is 0.0
		if( !versionText )
			return 0;

		//XML stores versions in "x.y"-format
		//FIXME: strtoul is unsafe

		const char *dot = strchr(versionText, '.');
		uint32_t minor = dot ? strtoul(dot + 1, 0, 10) : 0;

		uint32_t major = strtoul(versionText, 0, 10);

		return (major << 16) + minor;
	}

	static PX_INLINE bool isWhiteSpace(char c)
	{
		return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == ',';
	}

	static PX_INLINE const char * skipWhiteSpace(const char *scan)
	{
		while ( isWhiteSpace(*scan) && *scan ) scan++;
		return *scan ? scan : 0;
	}

	static PX_FORCE_INLINE const char * skipNonWhiteSpace(const char* scan)
	{
		while ( !isWhiteSpace(*scan) && *scan ) scan++;
		return *scan ? scan : 0;
	}

	bool XmlDeserializer::verifyObject(Interface *obj, const physx::shdfnd::FastXml::AttributePairs& attr)
	{
		if( ReadVersion(attr) != obj->version() )
		{
			XML_WARNING("unknown error");
			DEBUG_ALWAYS_ASSERT();
			mError = Serializer::ERROR_UNKNOWN;
			return false;
		}

		char *checksum = (char *)attr.get("checksum");
		if( checksum && !DoIgnoreChecksum(*obj) )
		{
			uint32_t objBits;
			const uint32_t *objChecksum = obj->checksum(objBits);

			uint32_t bits = 0;

			char *cur = checksum, *next = 0;
			bool sameBits = true;
			for(uint32_t i = 0; ; ++i, cur = next)
			{
				uint32_t val = (uint32_t)strtoul(cur, &next, 0); //FIXME: strtoul is not safe
				if( cur == next )
					break;

				bits += 32;
				if( bits > objBits || val != objChecksum[i] )
				{
					NV_PARAM_TRAITS_WARNING(
						mTraits,
						"Schema checksum is different for object of class %s and version %u, "
							"asset may be corrupted",
						obj->className(),
						(unsigned)obj->version()
						);
					sameBits = false;
					break;
				}
			}

			if( objBits != bits && sameBits )
			{
				NV_PARAM_TRAITS_WARNING(
					mTraits,
					"Schema checksum is different for object of class %s and version %u, "
						"asset may be corrupted",
					obj->className(),
					(unsigned)obj->version()
					);
			}
		} //if( checksum )

		return true;
	}

	bool XmlDeserializer::initAddressString(char *dest, uint32_t len, const char *name)
	{
		char *end = dest + len;

		for (uint32_t i = 0; i < tos().getIndex(); i++)
		{
			FieldInfo &field = tos().getFieldInfo(i);

			const char *n = field.name;
			FieldType type = field.type;

			if( SKIP == type )
				continue;

			while ( n && *n && dest < end )
				*dest++ = *n++;

			if ( ARRAY == type )
			{
				char temp[512];
				physx::shdfnd::snprintf(temp, 512, "[%d]", field.idx);

				if( dest + ::strlen(temp) >= end )
				{
					XML_WARNING("buffer overflow");
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
					return false;
				}

				const char *scan = temp;
				while ( *scan && dest < end )
				{
					*dest++ = *scan++;
				}
			}
			else
			{
				if( dest + 1 >= end )
				{
					XML_WARNING("buffer overflow");
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
					return false;
				}

				*dest++ = '.';
			}
		}

		while ( name && *name && dest < end )
		{
			*dest++ = *name++;
		}

		*dest = 0;
		//printf("Fully qualified name: %s\n", scratch );

		return true;
	}

	bool XmlDeserializer::processClose(const char *tag,uint32_t depth,bool &isError)
	{
		isError = true; //By default if we return with false it's due to error

		if( strcmp(tag, "NxParameters") == 0 ||
			strcmp(tag, "NvParameters") == 0)
		{
			mInRootElement = false;

			// in xml there's only 1 root element allowed,
			// so we want to stop after the first NvParameters
			isError = false;
			return false;
		}

		static const char *validTags[] = {
			"struct",
			"value",
			"array"
		};

		for(uint32_t i = 0; i < PX_ARRAY_SIZE(validTags); ++i)
		{
			if( 0 != ::strcmp(validTags[i], tag) )
				continue;

#	ifndef NDEBUG
			uint32_t idx = tos().getIndex();
			DEBUG_ASSERT( idx > 0 );

			static FieldType validTypes[] = {
				STRUCT,
				VALUE,
				ARRAY
			};

			// Make gcc happy
			const FieldType* tmp = &validTypes[0];
			PX_UNUSED(tmp);

			FieldType type = tos().getFieldInfo(idx - 1).type;
			PX_UNUSED(type);
			DEBUG_ASSERT( type == SKIP || type == validTypes[i] );
#	endif

			if( !popField() )
				return false;

			if (depth == 1 && mRootIndex > MAX_ROOT_OBJ)
			{
				DEBUG_ASSERT(i == 1);
				mObjects[0].getObject()->destroy();
			}

			return tos().getIndex() ? depth != 0 : popObj();
		}

		return false;
	}

	bool XmlDeserializer::processElement(
		const char *elementName,
		const char *elementData,
		const physx::shdfnd::FastXml::AttributePairs& attr,
		int32_t /*lineno*/)
	{
		//Force DOCTYPE
		if( !mHasDoctype )
		{
			XML_WARNING("DOCTYPE is missing");
			DEBUG_ALWAYS_ASSERT();
			mError = Serializer::ERROR_MISSING_DOCTYPE;
			return false;
		}

		if( strcmp(elementName, "NxParameters")  == 0 ||
			strcmp(elementName, "NvParameters")  == 0)
		{
			if( mObjIndex )
			{
				XML_WARNING("NvParameters must be root element");
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_MISSING_ROOT_ELEMENT;
				return false;
			}

			if( mInRootElement )
			{
				XML_WARNING("More than one root element encountered");
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_INVALID_NESTING;
				return false;
			}

			uint32_t ver = ReadVersion(attr);
			if( ver != mVer )
			{
				XML_WARNING("unknown version of APX file format: %u", (unsigned)ver);
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_INVALID_FILE_VERSION;
				return false;
			}

			const char* numObjects = attr.get("numObjects");
			if (numObjects != NULL)
			{
				PX_ASSERT(atoi(numObjects) >= 0);
				const uint32_t num = static_cast<uint32_t>(atoi(numObjects));
				if (num > MAX_ROOT_OBJ)
				{
					XML_WARNING("APX file has more than %d root objects, only %d will be read", num, MAX_ROOT_OBJ);
				}
			}


			++mRootTags;
			mInRootElement = true;

			return true;
		}

		if( mRootTags > 0 && !mInRootElement )
		{
			XML_WARNING("element %s not under root element", elementName);
			DEBUG_ALWAYS_ASSERT();
			mError = Serializer::ERROR_MISSING_ROOT_ELEMENT;
			return false;
		}

		if ( strcmp(elementName, "struct") == 0 )
		{
			const char *name = attr.get("name");

			if( !mObjIndex )
			{
				XML_WARNING("struct-element %s not under value-element", name);
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_INVALID_NESTING;
				return false;
			}

			pushField(name, STRUCT);
		}
		else if ( strcmp(elementName, "value") == 0 )
		{
			if( !mObjIndex ) //Root object?
			{
				const char *className = attr.get("className");

				uint32_t version = ReadVersion(attr);

				Interface *obj = mTraits->createNvParameterized(className, version);
				if( !obj )
				{
					XML_WARNING("failed to create object of type %s and version %u", className, (unsigned)version);
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_OBJECT_CREATION_FAILED;
					return false;
				}

				const char *objectName = attr.get("objectName");
				if( objectName )
					obj->setName(objectName);

				if (mRootIndex < MAX_ROOT_OBJ)
				{
					mRootObjs[mRootIndex] = obj;
				}
				mRootIndex++;

				pushObj(obj);
				pushField("", SKIP); //Root <value> should not be used in initAddressString

				return true;
			}

			const char *name = attr.get("name");

			char scratch[2048];
			if( !initAddressString(scratch, sizeof(scratch), name) )
			{
				return false;
			}

			pushField(name, VALUE);

			Interface *obj = tos().getObject();
			if( !obj )
			{
				XML_WARNING("unknown error");
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_UNKNOWN;
				return false;
			}

			Handle handle(*obj, scratch);
			if( !handle.isValid() )
			{
				XML_WARNING("%s: invalid path", scratch);
				DEBUG_ALWAYS_ASSERT();
//				mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
				return true;
			}

			const char *type = attr.get("type");
			const char *expectedType = typeToStr(handle.parameterDefinition()->type());
			if ( type && 0 != physx::shdfnd::stricmp(type, expectedType) )
			{
				XML_WARNING("%s: invalid type %s (expected %s)", scratch, type, expectedType);
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_INVALID_ATTR;
				return false;
			}

			const char *included = attr.get("included");
			if ( included )
			{
				bool isIncludedRef = 0 != atoi(included);
				if( isIncludedRef != handle.parameterDefinition()->isIncludedRef() )
				{
					XML_WARNING("%s: unexpected included-attribute", scratch);
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_INVALID_ATTR;
					return false;
				}

				const char *className = attr.get("className");
				if( !className )
				{
					if( attr.get("classNames") )
					{
						// Ref is NULL

						Interface *oldObj = 0;
						if( NvParameterized::ERROR_NONE != handle.getParamRef(oldObj) )
							return false;
						if( oldObj )
							oldObj->destroy();

						handle.setParamRef(0);

						return true;
					}
					else
					{
						XML_WARNING("%s: missing both className and classNames attribute", scratch);
						DEBUG_ALWAYS_ASSERT();
						mError = Serializer::ERROR_INVALID_ATTR;
						return false;
					}
				}

				uint32_t version = ReadVersion(attr);

				Interface *refObj = 0;
				if( isIncludedRef )
					refObj = mTraits->createNvParameterized(className, version);
				else
				{
					void *buf = mTraits->alloc(sizeof(NvParameters));
					refObj = PX_PLACEMENT_NEW(buf, NvParameters)(mTraits);

					refObj->setClassName(className);
				}

				if( !refObj )
				{
					XML_WARNING("%s: failed to create object of type %s and version %u", scratch, className, (unsigned)version);
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_OBJECT_CREATION_FAILED;
					return false;
				}

				if( refObj && (-1 == handle.parameterDefinition()->refVariantValIndex(refObj->className())) )
				{
					char longName[256];
					handle.getLongName(longName, sizeof(longName));
					NV_PARAM_TRAITS_WARNING(
						mTraits,
						"%s: setting reference of invalid class %s",
						longName,
						refObj->className()
						);
				}

				if( NvParameterized::ERROR_NONE != handle.setParamRef(refObj) )
				{
					XML_WARNING("%s: failed to set reference of type %s", scratch, className);
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_INVALID_REFERENCE;
					return false;
				}

				const char *objectName = attr.get("objectName");
				if( objectName && refObj )
					refObj->setName(objectName);

				if( isIncludedRef )
					pushObj(refObj);
				else if ( elementData && refObj )
					refObj->setName(elementData);
			}
			else
			{
				if ( elementData == 0 )
					elementData = "";

				const char *isNull = attr.get("null");
				if( isNull && 0 != atoi(isNull) )
				{
					//Only strings and enums may be NULL so it's safe to call setParamString

					DataType t = handle.parameterDefinition()->type();
					PX_UNUSED(t);
					DEBUG_ASSERT( TYPE_STRING == t || TYPE_ENUM == t );

					handle.setParamString(0);
				}
				else
				{
					if( NvParameterized::ERROR_NONE != handle.strToValue(elementData, 0) )
					{
						XML_WARNING("%s: failed to convert string to value: %10s", scratch, elementData);
						DEBUG_ALWAYS_ASSERT();
						mError = Serializer::ERROR_STRING2VAL_FAILED;
						return false;
					}
				}
			} //if ( included )
		}
		else if ( strcmp(elementName, "array") == 0 )
		{
			const char *name = attr.get("name");

			if( !mObjIndex )
			{
				XML_WARNING("array-element %s not under value-element", name);
				DEBUG_ALWAYS_ASSERT();
				mError = Serializer::ERROR_INVALID_NESTING;
				return false;
			}

			int32_t arraySize = 0;
			if ( const char *sz = attr.get("size") )
			{
				PX_ASSERT(atoi(sz) >= 0);
				arraySize = (int32_t)atoi(sz);
			}

			if ( arraySize > 0 )
			{
				Interface *obj = tos().getObject();
				if( !obj )
				{
					XML_WARNING("unknown error");
					DEBUG_ALWAYS_ASSERT();
					mError = Serializer::ERROR_UNKNOWN;
					return false;
				}

				char scratch[2048];
				if( !initAddressString(scratch, sizeof(scratch), name) )
				{
					return false;
				}

				Handle handle(*obj, scratch);
				if( !handle.isValid() )
				{

					mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
					XML_WARNING("%s: invalid path", scratch);
					DEBUG_ALWAYS_ASSERT();

					return false;
				}

				if( !handle.parameterDefinition()->arraySizeIsFixed() )
					if( NvParameterized::ERROR_NONE != handle.resizeArray(arraySize) )
					{
						XML_WARNING("%s: failed to resize array", scratch);
						DEBUG_ALWAYS_ASSERT();
						mError = Serializer::ERROR_INVALID_ARRAY;
						return false;
					}
					if ( elementData )
					{
						const char *scan = elementData;

						handle.set(0);
						const Definition *paramDef = handle.parameterDefinition();
						handle.popIndex();


						if ( paramDef->type() == TYPE_STRUCT )
						{
							// read the structElements field
							const char* structElements = attr.get("structElements");

							int32_t* simpleStructRedirect = getSimpleStructRedirect(static_cast<uint32_t>(paramDef->numChildren()));
							uint32_t numRedirects = 0;
							while (structElements && *structElements)
							{
								char fieldName[64];
								char type[16];

								size_t count = 0;
								while(*structElements != 0 && *structElements != ',' && *structElements != '(')
									fieldName[count++] = *structElements++;
								if( count >= sizeof(fieldName) )
								{
									DEBUG_ALWAYS_ASSERT();
									mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
									return false;
								}
								fieldName[count] = 0;

								if (*structElements == '(')
								{
									structElements++;
									count = 0;
									while(*structElements != 0 && *structElements != ',' && *structElements != ')')
										type[count++] = *structElements++;
									if( count >= sizeof(type) )
									{
										DEBUG_ALWAYS_ASSERT();
										mError = Serializer::ERROR_INTERNAL_BUFFER_OVERFLOW;
										return false;
									}
									type[count] = 0;

								}
								if (*structElements == ')')
									structElements++;
								if (*structElements == ',')
									structElements++;

								const Definition* childDef = paramDef->child(fieldName, simpleStructRedirect[numRedirects]);
								const char* trueType = childDef ? typeToStr(childDef->type()) : 0;
								if (childDef && ::strcmp(trueType, type) != 0)
								{
									XML_WARNING(
										"%s[].%s: unexpected type: %s (must be %s)",
										scratch, fieldName, type, trueType ? trueType : "");
									DEBUG_ALWAYS_ASSERT();
									mError = Serializer::ERROR_INVALID_DATA_TYPE;
									return false;
								}

								// -2 means to reed the data but not storing it
								// -1 means to not read the data as it was not serialized'
								// i = [0 .. n] means to read the data and store it in child i
								if (childDef == NULL)
								{
									simpleStructRedirect[numRedirects] = -2;

									// Fail fast
									XML_WARNING("%s[]: unexpected structure field: %s", scratch, fieldName);
									DEBUG_ALWAYS_ASSERT();
									mError = Serializer::ERROR_INVALID_PARAM_HANDLE;
									return false;
								}

								numRedirects++;
							}

							const int32_t numChildren = paramDef->numChildren();
							for(int32_t i = 0; i < arraySize; ++i)
							{
								handle.set(i);
								for( int32_t j=0; j<numChildren; j++ )
								{
									if (simpleStructRedirect[j] < 0)
									{
										if (simpleStructRedirect[j] < -1)
										{
											// read the data anyways
											scan = skipWhiteSpace(scan);
											if (scan != NULL)
												scan = skipNonWhiteSpace(scan);
										}
										continue;
									}

									scan = skipWhiteSpace(scan);
									if ( !scan ) break;

									handle.set(simpleStructRedirect[j]);

									if( NvParameterized::ERROR_NONE != handle.strToValue(scan, &scan) )
									{
										XML_WARNING("%s: failed to convert string to value: %10s...", scan);
										DEBUG_ALWAYS_ASSERT();
										mError = Serializer::ERROR_STRING2VAL_FAILED;
										return false;
									}

									handle.popIndex();
									if ( !scan ) break;
								}
								handle.popIndex();
								if ( !scan ) break;
							}
						}
						else
						{
							// LRR: wall clock time is the same for this simple loop as the previous
							//      "unrolled" version
							for (int32_t i = 0; i<arraySize; i++)
							{
								handle.set(i);
								if( NvParameterized::ERROR_NONE != handle.strToValue(scan, &scan) )
								{
									XML_WARNING("%s: failed to convert string to value: %10s", scratch, scan);
									DEBUG_ALWAYS_ASSERT();
									mError = Serializer::ERROR_STRING2VAL_FAILED;
									return false;
								}
								handle.popIndex();
							}
						}
					} //if( elementData )
			} //if ( arraySize > 0 )

			pushField(name, ARRAY);
		}
		else
		{
			XML_WARNING("unknown element %s", elementName);
			DEBUG_ALWAYS_ASSERT();
			mError = Serializer::ERROR_UNKNOWN_XML_TAG;
			return false;
		}

		return true;
	}

	int32_t* XmlDeserializer::getSimpleStructRedirect(uint32_t size)
	{
		if (mSimpleStructRedirectSize < size)
		{
			if (mSimpleStructRedirect != NULL)
				mTraits->free(mSimpleStructRedirect);

			if (size < 16)
				size = 16; // just to not allocate all these small things more than once

			mSimpleStructRedirect = (int32_t*)mTraits->alloc(sizeof(int32_t) * size);
			mSimpleStructRedirectSize = size;
		}

		memset(mSimpleStructRedirect, -1, sizeof(int32_t) * size);
		return mSimpleStructRedirect;
	}

}

Commits for Divide-Dependencies/physx/APEX_1.4/NvParameterized/src/XmlDeserializer.cpp

Diff revisions: vs.
Revision Author Commited Message
105 IonutCava picture IonutCava Tue 16 Apr, 2019 19:55:41 +0000

Forgot to actually add physx