r248: msvc changes
[ctsim.git] / libctsim / array2dfile.cpp
index 2999470e871e85af572312a63f941e796ab9ae0a..e35a14982056cbb5f414b8fb73402ebe58a1c4a8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.cpp,v 1.14 2000/12/04 19:50:57 kevin Exp $
+**  $Id: array2dfile.cpp,v 1.16 2000/12/06 15:17:51 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
 ******************************************************************************/
 
 #include "array2dfile.h"
-#include <ctime>
-#include <sstream>
-
+#include <ctime>\r
+#ifdef MSVC\r
+typedef long off_t;\r
+#endif
 
 using namespace std;
 
@@ -108,9 +109,10 @@ Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int&
 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;
 }
 
@@ -392,7 +394,7 @@ Array2dFile::headerWrite (frnetorderstream& fs)
   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);
   
@@ -480,12 +482,12 @@ Array2dFile::labelsRead (frnetorderstream& fs)
        
        kuint16 strLength;
        fs.readInt16 (strLength);
-       char* labelStr = new char [strLength+1];
-       fs.read (labelStr, strLength);
-       labelStr[strLength] = 0;
+       char* pszLabelStr = new char [strLength+1];
+       fs.read (pszLabelStr, strLength);
+       pszLabelStr[strLength] = 0;
 
-       Array2dFileLabel* pLabel = new Array2dFileLabel(labelType, labelStr, calcTime);
-       delete labelStr;\r
+       Array2dFileLabel* pLabel = new Array2dFileLabel (labelType, pszLabelStr, calcTime);
+       delete pszLabelStr;\r
 \r
        pLabel->setDateTime (year, month, day, hour, minute, second);
        m_labels.push_back (pLabel);\r