Skip to content

Commit 9ec84d6

Browse files
committed
Merge branch 'master' of https://github.com/opendap/bes
2 parents 9dfe8e9 + aebc30a commit 9ec84d6

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

modules/dmrpp_module/data/patch_dmrpp/reduce_mdf.cc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ short update_sha256_file(char* m_dmrpp_fname,char* m_h5_fname,char* m_sha256_fna
169169
}
170170

171171
return ret_value;
172-
173172
}
174173

175174
// Obtain the sha256 from the data values.
@@ -263,6 +262,9 @@ bool obtain_offset_nbytes(const vector<string>& str_vec, vector<size_t>& offsets
263262
string delim2 ="nBytes=\"";
264263
string delim3="\"";
265264

265+
vector<size_t> unfiltered_offsets;
266+
vector<size_t> unfiltered_nbytes;
267+
266268
// Pick up the line that includes chunk offset and save them to a vector.
267269
for(int i = 0; i <str_vec.size(); i++)
268270
if(str_vec[i].find(delim1)!=string::npos)
@@ -277,7 +279,7 @@ bool obtain_offset_nbytes(const vector<string>& str_vec, vector<size_t>& offsets
277279
break;
278280
}
279281
string temp_offset=chunk_info_str[i].substr(co_spos+delim1.size(),co_epos-co_spos-delim1.size());
280-
offsets.push_back(string_to_size_t(temp_offset));
282+
unfiltered_offsets.push_back(string_to_size_t(temp_offset));
281283

282284
size_t nb_spos = chunk_info_str[i].find(delim2,co_epos);
283285
size_t nb_epos = chunk_info_str[i].find(delim3,nb_spos+delim2.size());
@@ -286,10 +288,21 @@ bool obtain_offset_nbytes(const vector<string>& str_vec, vector<size_t>& offsets
286288
break;
287289
}
288290
string temp_nbyte=chunk_info_str[i].substr(nb_spos+delim2.size(),nb_epos-nb_spos-delim2.size());
289-
nbytes.push_back(string_to_size_t(temp_nbyte));
291+
unfiltered_nbytes.push_back(string_to_size_t(temp_nbyte));
290292

291293
}
292294

295+
// Remove nbyte = 0 case. This is a bug caused by build_dmrpp. Before that is fixed, we
296+
// remove this case since this fortuately doesn't affect our purpose and the patch_dmrpp program.
297+
if(true == ret) {
298+
for(int i = 0; i<unfiltered_nbytes.size();i++) {
299+
if(unfiltered_nbytes[i] != 0) {
300+
offsets.push_back(unfiltered_offsets[i]);
301+
nbytes.push_back(unfiltered_nbytes[i]);
302+
}
303+
}
304+
}
305+
293306
return ret;
294307
}
295308

0 commit comments

Comments
 (0)