diff data/fileio/MatrixFile.cpp @ 936:0c1d6de8f44b

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:51:16 +0100
parents 59e7fe1b1003
children ce82bcdc95d0
line wrap: on
line diff
--- a/data/fileio/MatrixFile.cpp	Tue Jun 03 11:05:49 2014 +0100
+++ b/data/fileio/MatrixFile.cpp	Wed Jun 18 13:51:16 2014 +0100
@@ -52,7 +52,7 @@
 static size_t openCount = 0;
 
 MatrixFile::MatrixFile(QString fileBase, Mode mode,
-                       size_t cellSize, size_t width, size_t height) :
+                       int cellSize, int width, int height) :
     m_fd(-1),
     m_mode(mode),
     m_flags(0),
@@ -60,7 +60,7 @@
     m_cellSize(cellSize),
     m_width(width),
     m_height(height),
-    m_headerSize(2 * sizeof(size_t)),
+    m_headerSize(2 * sizeof(int)),
     m_setColumns(0),
     m_autoClose(false),
     m_readyToReadColumn(-1)
@@ -125,8 +125,8 @@
     if (newFile) {
         initialise(); // write header and "unwritten" column tags
     } else {
-        size_t header[2];
-        if (::read(m_fd, header, 2 * sizeof(size_t)) < 0) {
+        int header[2];
+        if (::read(m_fd, header, 2 * sizeof(int)) < 0) {
             ::perror("MatrixFile::MatrixFile: read failed");
             cerr << "ERROR: MatrixFile::MatrixFile: "
                       << "Failed to read header (fd " << m_fd << ", file \""
@@ -222,10 +222,10 @@
         throw FileOperationFailed(m_fileName, "lseek");
     }
 
-    size_t header[2];
+    int header[2];
     header[0] = m_width;
     header[1] = m_height;
-    if (::write(m_fd, header, 2 * sizeof(size_t)) != 2 * sizeof(size_t)) {
+    if (::write(m_fd, header, 2 * sizeof(int)) != 2 * sizeof(int)) {
         ::perror("ERROR: MatrixFile::initialise: Failed to write header");
         throw FileOperationFailed(m_fileName, "write");
     }
@@ -263,7 +263,7 @@
 }
 
 void
-MatrixFile::getColumnAt(size_t x, void *data)
+MatrixFile::getColumnAt(int x, void *data)
 {
     assert(m_mode == ReadOnly);
     
@@ -276,7 +276,7 @@
     ssize_t r = -1;
 
     if (m_readyToReadColumn < 0 ||
-        size_t(m_readyToReadColumn) != x) {
+        m_readyToReadColumn != x) {
 
         unsigned char set = 0;
         if (!seekTo(x)) {
@@ -303,14 +303,14 @@
 }
 
 bool
-MatrixFile::haveSetColumnAt(size_t x) const
+MatrixFile::haveSetColumnAt(int x) const
 {
     if (m_mode == WriteOnly) {
         return m_setColumns->get(x);
     }
 
     if (m_readyToReadColumn >= 0 &&
-        size_t(m_readyToReadColumn) == x) return true;
+        int(m_readyToReadColumn) == x) return true;
     
     Profiler profiler("MatrixFile::haveSetColumnAt");
 
@@ -338,7 +338,7 @@
 }
 
 void
-MatrixFile::setColumnAt(size_t x, const void *data)
+MatrixFile::setColumnAt(int x, const void *data)
 {
     assert(m_mode == WriteOnly);
     if (m_fd < 0) return; // closed
@@ -408,7 +408,7 @@
 }
 
 bool
-MatrixFile::seekTo(size_t x) const
+MatrixFile::seekTo(int x) const
 {
     if (m_fd < 0) {
         cerr << "ERROR: MatrixFile::seekTo: File not open" << endl;