Commit 6d1e8ce4 authored by Purves, Murray's avatar Purves, Murray
Browse files

Replacing numeric with named constants

parent b497b89d
......@@ -133,7 +133,8 @@ bool ARLDataStream::write_record_header(const ARLRecordHeader& rheader)
std::stoi(rheader.cgrid.c_str()), rheader.kvar.c_str(), rheader.nexp,
rheader.prec, rheader.var1);
p->stream->writeString(std::string(recordHeader), 50);
p->stream->writeString(std::string(recordHeader),
ARLDataStream::PImpl::recordHeaderLength);
radix_line(" header as string:\n " << recordHeader);
......@@ -192,7 +193,8 @@ bool ARLDataStream::write_index_header(const ARLRecordHeader& rheader,
radix_line(" Size of each record = " << p->recordSize);
size_t MAX_HEADER_LENGTH = 10000;
char indexHeaderMain[108], indexHeaderVars[MAX_HEADER_LENGTH];
char indexHeaderMain[ARLDataStream::PImpl::indexHeaderLength],
indexHeaderVars[MAX_HEADER_LENGTH];
int pos = 0;
// Write the variable description part of the header
......@@ -217,7 +219,7 @@ bool ARLDataStream::write_index_header(const ARLRecordHeader& rheader,
}
// Construct the main part of the header (inc. size calculation)
int headerLength = 108 + pos;
int headerLength = ARLDataStream::PImpl::indexHeaderLength + pos;
sprintf(indexHeaderMain,
"%4s%3d%2d%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7."
"2f%3d%3d%3d%2d%4d",
......@@ -228,7 +230,8 @@ bool ARLDataStream::write_index_header(const ARLRecordHeader& rheader,
iheader.ny, iheader.nz, iheader.z_flag, headerLength);
// Write the two elements of the header
p->stream->writeString(std::string(indexHeaderMain), 108);
p->stream->writeString(std::string(indexHeaderMain),
ARLDataStream::PImpl::indexHeaderLength);
p->stream->writeString(std::string(indexHeaderVars), pos);
// Skip enough bytes to get to the next index header
......
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