Commit 7ae3bbc9 authored by Ken Martin's avatar Ken Martin
Browse files

merges from the main tree

parent 50d8c3a8
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "vtkUnsignedLongArray.h" #include "vtkUnsignedLongArray.h"
#include "vtkUnsignedShortArray.h" #include "vtkUnsignedShortArray.h"
vtkCxxRevisionMacro(vtkDataWriter, "1.103"); vtkCxxRevisionMacro(vtkDataWriter, "1.103.6.1");
vtkStandardNewMacro(vtkDataWriter); vtkStandardNewMacro(vtkDataWriter);
// this undef is required on the hp. vtkMutexLock ends up including // this undef is required on the hp. vtkMutexLock ends up including
...@@ -674,7 +674,7 @@ int vtkDataWriter::WriteScalarData(ostream *fp, vtkDataArray *scalars, int num) ...@@ -674,7 +674,7 @@ int vtkDataWriter::WriteScalarData(ostream *fp, vtkDataArray *scalars, int num)
// weird symbols. // weird symbols.
if (!this->ScalarsName) if (!this->ScalarsName)
{ {
if (scalars->GetName()) if (scalars->GetName() && strlen(scalars->GetName()))
{ {
scalarsName = new char[ strlen(scalars->GetName()) * 4 + 1]; scalarsName = new char[ strlen(scalars->GetName()) * 4 + 1];
this->EncodeArrayName(scalarsName, scalars->GetName()); this->EncodeArrayName(scalarsName, scalars->GetName());
...@@ -786,7 +786,7 @@ int vtkDataWriter::WriteVectorData(ostream *fp, vtkDataArray *vectors, int num) ...@@ -786,7 +786,7 @@ int vtkDataWriter::WriteVectorData(ostream *fp, vtkDataArray *vectors, int num)
// weird symbols. // weird symbols.
if (!this->VectorsName) if (!this->VectorsName)
{ {
if (vectors->GetName()) if (vectors->GetName() && strlen(vectors->GetName()))
{ {
vectorsName = new char[ strlen(vectors->GetName()) * 4 + 1]; vectorsName = new char[ strlen(vectors->GetName()) * 4 + 1];
this->EncodeArrayName(vectorsName, vectors->GetName()); this->EncodeArrayName(vectorsName, vectors->GetName());
...@@ -819,7 +819,7 @@ int vtkDataWriter::WriteNormalData(ostream *fp, vtkDataArray *normals, int num) ...@@ -819,7 +819,7 @@ int vtkDataWriter::WriteNormalData(ostream *fp, vtkDataArray *normals, int num)
// weird symbols. // weird symbols.
if (!this->NormalsName) if (!this->NormalsName)
{ {
if (normals->GetName()) if (normals->GetName() && strlen(normals->GetName()) )
{ {
normalsName = new char[ strlen(normals->GetName()) * 4 + 1]; normalsName = new char[ strlen(normals->GetName()) * 4 + 1];
this->EncodeArrayName(normalsName, normals->GetName()); this->EncodeArrayName(normalsName, normals->GetName());
...@@ -854,7 +854,7 @@ int vtkDataWriter::WriteTCoordData(ostream *fp, vtkDataArray *tcoords, int num) ...@@ -854,7 +854,7 @@ int vtkDataWriter::WriteTCoordData(ostream *fp, vtkDataArray *tcoords, int num)
// weird symbols. // weird symbols.
if (!this->TCoordsName) if (!this->TCoordsName)
{ {
if (tcoords->GetName()) if (tcoords->GetName() && strlen(tcoords->GetName()))
{ {
tcoordsName = new char[ strlen(tcoords->GetName()) * 4 + 1]; tcoordsName = new char[ strlen(tcoords->GetName()) * 4 + 1];
this->EncodeArrayName(tcoordsName, tcoords->GetName()); this->EncodeArrayName(tcoordsName, tcoords->GetName());
...@@ -890,7 +890,7 @@ int vtkDataWriter::WriteTensorData(ostream *fp, vtkDataArray *tensors, int num) ...@@ -890,7 +890,7 @@ int vtkDataWriter::WriteTensorData(ostream *fp, vtkDataArray *tensors, int num)
// weird symbols. // weird symbols.
if (!this->TensorsName) if (!this->TensorsName)
{ {
if (tensors->GetName()) if (tensors->GetName() && strlen(tensors->GetName()))
{ {
tensorsName = new char[ strlen(tensors->GetName()) * 4 + 1]; tensorsName = new char[ strlen(tensors->GetName()) * 4 + 1];
this->EncodeArrayName(tensorsName, tensors->GetName()); this->EncodeArrayName(tensorsName, tensors->GetName());
...@@ -973,8 +973,16 @@ int vtkDataWriter::WriteFieldData(ostream *fp, vtkFieldData *f) ...@@ -973,8 +973,16 @@ int vtkDataWriter::WriteFieldData(ostream *fp, vtkFieldData *f)
// Buffer size is size of array name times four because // Buffer size is size of array name times four because
// in theory there could be array name consisting of only // in theory there could be array name consisting of only
// weird symbols. // weird symbols.
char *buffer = new char[ strlen(array->GetName()) * 4 + 1]; char* buffer;
if(strlen(array->GetName()) == 0)
{
buffer = strcpy(new char[strlen("unknown")+1], "unknown");
}
else
{
buffer = new char[ strlen(array->GetName()) * 4 + 1];
this->EncodeArrayName(buffer, array->GetName()); this->EncodeArrayName(buffer, array->GetName());
}
sprintf(format, "%s %d %d %s\n", buffer, numComp, numTuples, sprintf(format, "%s %d %d %s\n", buffer, numComp, numTuples,
"%s"); "%s");
this->WriteArray(fp, array->GetDataType(), array, format, numTuples, this->WriteArray(fp, array->GetDataType(), array, format, numTuples,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment