------------------------------------------------------------------------------
| 433 | |
| 434 | //------------------------------------------------------------------------------ |
| 435 | vtkTypeBool vtkStringArray::Resize(vtkIdType sz) |
| 436 | { |
| 437 | ValueType* newArray; |
| 438 | vtkIdType newSize = sz * this->NumberOfComponents; |
| 439 | |
| 440 | if (newSize == this->Size) |
| 441 | { |
| 442 | return 1; |
| 443 | } |
| 444 | |
| 445 | if (newSize <= 0) |
| 446 | { |
| 447 | this->Initialize(); |
| 448 | return 1; |
| 449 | } |
| 450 | |
| 451 | newArray = new ValueType[newSize]; |
| 452 | if (!newArray) |
| 453 | { |
| 454 | vtkErrorMacro(<< "Cannot allocate memory\n"); |
| 455 | return 0; |
| 456 | } |
| 457 | |
| 458 | if (this->Array) |
| 459 | { |
| 460 | vtkIdType numCopy = (newSize < this->Size ? newSize : this->Size); |
| 461 | |
| 462 | for (vtkIdType i = 0; i < numCopy; ++i) |
| 463 | { |
| 464 | newArray[i] = this->Array[i]; |
| 465 | } |
| 466 | |
| 467 | if (this->DeleteFunction) |
| 468 | { |
| 469 | this->DeleteFunction = DefaultDeleteFunction; |
| 470 | this->DeleteFunction(this->Array); |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | if (newSize < this->Size) |
| 475 | { |
| 476 | this->MaxId = newSize - 1; |
| 477 | } |
| 478 | this->Size = newSize; |
| 479 | this->Array = newArray; |
| 480 | this->DeleteFunction = DefaultDeleteFunction; |
| 481 | this->DataChanged(); |
| 482 | return 1; |
| 483 | } |
| 484 | |
| 485 | //------------------------------------------------------------------------------ |
| 486 | vtkStringArray::ValueType* vtkStringArray::WritePointer(vtkIdType id, vtkIdType number) |
nothing calls this directly
no test coverage detected