[MOAB-dev] r2622 - MOAB/trunk
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Tue Feb 3 09:27:01 CST 2009
Author: janehu
Date: 2009-02-03 09:27:01 -0600 (Tue, 03 Feb 2009)
New Revision: 2622
Modified:
MOAB/trunk/ReadNCDF.cpp
Log:
Added check to make sure tokens vector has enough length.
Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp 2009-02-02 20:11:52 UTC (rev 2621)
+++ MOAB/trunk/ReadNCDF.cpp 2009-02-03 15:27:01 UTC (rev 2622)
@@ -24,7 +24,6 @@
#include <time.h>
#include <string>
#include <assert.h>
-#include <list>
#include <stdio.h>
#include "MBCN.hpp"
@@ -1954,7 +1953,7 @@
{
//1. check for time step to find the match time
int time_step = 1;
- if(!tokens[1].empty())
+ if(tokens.size() > 1 && !tokens[1].empty())
{
const char* time_s = tokens[1].c_str();
char* endptr;
@@ -1970,8 +1969,8 @@
}
//2. check for the operations, they can be copy or sum.
- const char *op;
- if(!tokens[2].empty())
+ const char *op = "" ;
+ if(tokens.size() > 2 && !tokens[2].empty())
op = tokens[2].c_str();
if(!(!strcmp(op, "copy") || !strcmp( op ,"sum")))
@@ -2042,7 +2041,8 @@
return MB_FAILURE;
}
- for(int j = 1; ; j++)//j is the number of nodes to be sequentially matched
+ for(int j = 1;j <= numberNodes_loading ; j++)
+ //j is the number of nodes to be sequentially matched
if(ptr2[node_index2+j] != ptr1[node_num +j])
{
num_of_nodes = j;
More information about the moab-dev
mailing list