void dng_memory_stream::DoSetLength (uint64 length)
	{
	
	while (length > fPageCount * (uint64) fPageSize)
		{
		
		if (fPageCount == fPagesAllocated)
			{
			
			uint32 newSize = Max_uint32 (fPagesAllocated + 32,
										 fPagesAllocated * 2);
			
			dng_memory_block **list = (dng_memory_block **)
									  malloc (newSize * sizeof (dng_memory_block *));
			
			if (!list)
				{
				
				ThrowMemoryFull ();
				
				}
			
			if (fPageCount)
				{
				
				DoCopyBytes (fPageList,
							 list,
							 fPageCount * (uint32) sizeof (dng_memory_block *));
				
				}
				
			if (fPageList)
				{
				
				free (fPageList);
				
				}
				
			fPageList = list;
			
			fPagesAllocated = newSize;
			
			}
			
		fPageList [fPageCount] = fAllocator.Allocate (fPageSize);
		
		fPageCount++;
		
		}
		
	fMemoryStreamLength = length;
	
	}
void dng_string_list::Allocate (uint32 minSize)
	{
	
	if (fAllocated < minSize)
		{
		
		uint32 newSize = Max_uint32 (minSize, fAllocated * 2);
		
		dng_string **list = (dng_string **)
							malloc (newSize * sizeof (dng_string *));
		
		if (!list)
			{
			
			ThrowMemoryFull ();
			
			}
		
		if (fCount)
			{
			
			DoCopyBytes (fList, list, fCount * sizeof (dng_string *));
			
			}
			
		if (fList)
			{
			
			free (fList);
			
			}
			
		fList = list;
		
		fAllocated = newSize;
		
		}
	
	}