[vtk-developers] Incorrect indentation by vtk_reindent_code.py

Bill Lorensen bill.lorensen at gmail.com
Sat Jul 2 13:21:48 EDT 2016


Also seems to have trouble with case statements...
--- a/IO/Export/vtkX3DExporterXMLWriter.cxx
+++ b/IO/Export/vtkX3DExporterXMLWriter.cxx
@@ -211,17 +211,17 @@ void vtkX3DExporterXMLWriter::SetField(int
attributeID, int type, vtkDataArray*
   {
   case(MFVEC3F):
     for (vtkIdType i = 0; i < a->GetNumberOfTuples(); i++)
-    {
+  {
       double* d = a->GetTuple(i);
       *this->OutputStream << this->ActTab << d[0] << " " << d[1] << "
" << d[2] << "," << this->GetNewline();
-    }
+  }
     break;
   case(MFVEC2F):
     for (vtkIdType i = 0; i < a->GetNumberOfTuples(); i++)
-    {
+  {
       double* d = a->GetTuple(i);
       *this->OutputStream << this->ActTab << d[0] << " " << d[1] <<
"," << this->GetNewline();
-    }
+  }
     break;
   default:
     *this->OutputStream << "UNKNOWN DATATYPE";
@@ -289,14 +289,14 @@ void vtkX3DExporterXMLWriter::SetField(int
attributeID, const int* values, size_
   }
   else
     while (i < size)
-    {
+  {
       *this->OutputStream << values[i] << " ";
       if (values[i] == -1)
       {
         *this->OutputStream << this->GetNewline() << this->ActTab;
       }
       i++;
-    }
+  }
   *this->OutputStream  << "\"";
 }

On Sat, Jul 2, 2016 at 12:53 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> David,
>
> vtk_reindent_code.py has trouble with for loops after if blocks that
> do not have braces.
>
> See the attached file, around lines 3269 and 3290.
>
> For example, Original:
> int vtkReebGraph::Implementation::GetNumberOfNodes()
> {
>   if(!this->NodeNumber)
>     for(vtkIdType nodeId = 1; nodeId < this->MainNodeTable.Size; nodeId++)
>       {
>       // check if node is cleared
>       if(!(this->GetNode(nodeId)->ArcUpId == ((int)-2)))
>         this->NodeNumber++;
>       }
>
>   return this->NodeNumber;
> }
>
> after vtk_reindent_code.py
> int vtkReebGraph::Implementation::GetNumberOfNodes()
> {
>   if(!this->NodeNumber)
>     for(vtkIdType nodeId = 1; nodeId < this->MainNodeTable.Size; nodeId++)
>   {
>       // check if node is cleared
>       if(!(this->GetNode(nodeId)->ArcUpId == ((int)-2)))
>         this->NodeNumber++;
>   }
>
>   return this->NodeNumber;
> }
>
>
> There are there are other files that exhibit the same behavior.
>
> Bill
>
> --
> Unpaid intern in BillsBasement at noware dot com



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtk-developers mailing list