projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r250: *** empty log message ***
[ctsim.git]
/
libctsim
/
array2dfile.cpp
diff --git
a/libctsim/array2dfile.cpp
b/libctsim/array2dfile.cpp
index 2999470e871e85af572312a63f941e796ab9ae0a..36adfbaa0017fb1447322e1a32bcbfbf2c773ce1 100644
(file)
--- a/
libctsim/array2dfile.cpp
+++ b/
libctsim/array2dfile.cpp
@@
-9,7
+9,7
@@
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: array2dfile.cpp,v 1.1
4 2000/12/04 19:50:57
kevin Exp $
+** $Id: array2dfile.cpp,v 1.1
7 2000/12/14 20:59:30
kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
@@
-26,9
+26,10
@@
******************************************************************************/
#include "array2dfile.h"
******************************************************************************/
#include "array2dfile.h"
-#include <ctime>
-#include <sstream>
-
+#include <ctime>
\r
+#ifdef MSVC
\r
+typedef long off_t;
\r
+#endif
using namespace std;
using namespace std;
@@
-108,9
+109,10
@@
Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int&
const string&
Array2dFileLabel::getDateString (void) const
{
const string&
Array2dFileLabel::getDateString (void) const
{
- ostringstream oss;
- oss << static_cast<int>(m_month + 1) <<"/"<< static_cast<int>(m_day) <<"/"<< static_cast<int>(m_year + 1900) << " " << static_cast<int>(m_hour) <<":"<< static_cast<int>(m_minute) <<":"<< static_cast<int>(m_second);
- m_strDate = oss.str();
+ char szDate [128];
\r
+ snprintf (szDate, sizeof(szDate), "%2d/%02d/%4d %02d:%02d:%02d",
\r
+ m_month + 1, m_day, m_year + 1900, m_hour, m_minute, m_second);
+ m_strDate = szDate;
return m_strDate;
}
return m_strDate;
}
@@
-392,7
+394,7
@@
Array2dFile::headerWrite (frnetorderstream& fs)
fs.writeFloat64 (m_offsetPV);
fs.writeFloat64 (m_scalePV);
fs.writeFloat64 (m_offsetPV);
fs.writeFloat64 (m_scalePV);
- m_headersize =
fs.tellp(
);
+ m_headersize =
static_cast<kuint16>(fs.tellp()
);
fs.seekp (0);
fs.writeInt16 (m_headersize);
fs.seekp (0);
fs.writeInt16 (m_headersize);
@@
-480,12
+482,12
@@
Array2dFile::labelsRead (frnetorderstream& fs)
kuint16 strLength;
fs.readInt16 (strLength);
kuint16 strLength;
fs.readInt16 (strLength);
- char*
l
abelStr = new char [strLength+1];
- fs.read (
l
abelStr, strLength);
-
l
abelStr[strLength] = 0;
+ char*
pszL
abelStr = new char [strLength+1];
+ fs.read (
pszL
abelStr, strLength);
+
pszL
abelStr[strLength] = 0;
- Array2dFileLabel* pLabel = new Array2dFileLabel
(labelType, l
abelStr, calcTime);
- delete
l
abelStr;
\r
+ Array2dFileLabel* pLabel = new Array2dFileLabel
(labelType, pszL
abelStr, calcTime);
+ delete
pszL
abelStr;
\r
\r
pLabel->setDateTime (year, month, day, hour, minute, second);
m_labels.push_back (pLabel);
\r
\r
pLabel->setDateTime (year, month, day, hour, minute, second);
m_labels.push_back (pLabel);
\r
@@
-553,9
+555,11
@@
Array2dFile::labelAdd (const Array2dFileLabel& label)
}
void
}
void
-Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const
idStr
)
+Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const
pszId
)
{
{
- string id = idStr;
+ string id;
+ if (idStr)
+ id = pszId;
for (unsigned int i = 0; i < copyFile.getNumLabels(); i++) {
Array2dFileLabel l (copyFile.labelGet (i));
string lstr = l.getLabelString();
for (unsigned int i = 0; i < copyFile.getNumLabels(); i++) {
Array2dFileLabel l (copyFile.labelGet (i));
string lstr = l.getLabelString();