Fix off by 1 error in DqnString::Expand()
This commit is contained in:
		
							parent
							
								
									dc22ba2a02
								
							
						
					
					
						commit
						0bc8a48dbd
					
				
							
								
								
									
										25
									
								
								build.bat
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								build.bat
									
									
									
									
									
								
							| @ -5,8 +5,29 @@ | ||||
| set ProjectName=dqn_unit_test | ||||
| set CompileEntryPoint=..\dqn_unit_test.cpp | ||||
| 
 | ||||
| REM Build tags file | ||||
| ctags -R | ||||
| REM Build tags file if you have ctags in path | ||||
| where /q ctags | ||||
| if %errorlevel%==0 ( | ||||
| REM When parsing a C++ member function definition (e.g. "className::function"), | ||||
| REM ctags cannot determine whether the scope specifier is a class name or | ||||
| REM a namespace specifier and always lists it as a class name in the scope | ||||
| REM portion of the extension fields. Also, if a C++ function is defined outside | ||||
| REM of the class declaration (the usual case), the access specification (i.e. | ||||
| REM public, protected, or private) and implementation information (e.g. virtual, | ||||
| REM pure virtual) contained in the function declaration are not known when the | ||||
| REM tag is generated for the function definition. -c++-kinds=+p fixes that | ||||
| 
 | ||||
| REM The --fields=+iaS option: | ||||
| REM    a   Access (or export) of class members | ||||
| REM    i   Inheritance information | ||||
| REM    S   Signature of routine (e.g. prototype or parameter list) | ||||
| REM | ||||
| REM The --extra=+q option: | ||||
| REM    By default, ctags only generates tags for separate identifiers found in | ||||
| REM    the source files. With --extras=+q option, then ctags will also generate | ||||
| REM    a second, class-qualified tag for each class member | ||||
| 	ctags -R --c++-kinds=+p --fields=+iaS --extras=+q | ||||
| ) | ||||
| 
 | ||||
| REM Check if build tool is on path | ||||
| REM >nul, 2>nul will remove the output text from the where command | ||||
|  | ||||
							
								
								
									
										4
									
								
								dqn.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dqn.h
									
									
									
									
									
								
							| @ -1099,7 +1099,7 @@ T *DqnArray<T>::Insert(T const item, isize index) | ||||
| 	this->data[index] = item; | ||||
| 	T *result         = this->data + index; | ||||
| 
 | ||||
| 	DQN_ASSERT(this->count < this->max); | ||||
| 	DQN_ASSERT(this->count <= this->max); | ||||
| 	return result; | ||||
| } | ||||
| 
 | ||||
| @ -6395,7 +6395,7 @@ bool DqnString::Expand(i32 newMax) | ||||
| 	usize allocSize = sizeof(*(this->str)) * (newMax + 1); | ||||
| 	char *result     = nullptr; | ||||
| 
 | ||||
| 	if (this->str) result = (char *)this->memAPI->Realloc(this->str, this->max, allocSize); | ||||
| 	if (this->str) result = (char *)this->memAPI->Realloc(this->str, (this->max + 1), allocSize); | ||||
| 	else           result = (char *)this->memAPI->Alloc(allocSize, Dqn::ZeroClear::False); | ||||
| 
 | ||||
| 	if (result) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user