winsockapi include problem

This commit is contained in:
Federico Ponchio 2004-11-28 04:12:04 +00:00
parent a8e2df5d3c
commit 290aac34d3
3 changed files with 18 additions and 6 deletions

View File

@ -4,7 +4,10 @@
//TODO move includes in cpp //TODO move includes in cpp
#ifdef WIN32 #ifdef WIN32
#ifndef _WINDOWS_
#define _WINSOCKAPI_
#include <windows.h> #include <windows.h>
#endif
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.15 2004/11/18 18:30:14 ponchio
Using baricenters... lotsa changes.
Revision 1.14 2004/10/19 16:50:27 ponchio Revision 1.14 2004/10/19 16:50:27 ponchio
Added row file access .... Added row file access ....
@ -177,14 +180,14 @@ template <class T> class VFile: public MFile {
} }
void FlushBuffer(Buffer buffer) { void FlushBuffer(Buffer buffer) {
SetPosition(buffer.key * chunk_size * sizeof(T)); SetPosition((int64)buffer.key * (int64)chunk_size * (int64)sizeof(T));
WriteBuffer((char *)(buffer.data), buffer.size * sizeof(T)); WriteBuffer((char *)(buffer.data), buffer.size * sizeof(T));
delete []buffer.data; delete []buffer.data;
} }
void Resize(unsigned int elem) { void Resize(unsigned int elem) {
Flush(); Flush();
MFile::Redim(elem * sizeof(T)); MFile::Redim((int64)elem * (int64)sizeof(T));
n_elements = elem; n_elements = elem;
} }
@ -228,7 +231,7 @@ template <class T> class VFile: public MFile {
index[buffer.key] = buffers.begin(); index[buffer.key] = buffers.begin();
last_buffer = &*buffers.begin(); last_buffer = &*buffers.begin();
SetPosition(chunk * chunk_size * sizeof(T)); SetPosition((int64)chunk * (int64)chunk_size * (int64)sizeof(T));
ReadBuffer((char *)(buffer.data), buffer.size * sizeof(T)); ReadBuffer((char *)(buffer.data), buffer.size * sizeof(T));
return *(buffer.data + offset); return *(buffer.data + offset);
@ -264,19 +267,19 @@ template <class T> class VFile: public MFile {
buffers.push_front(buffer); buffers.push_front(buffer);
index[chunk] = buffers.begin(); index[chunk] = buffers.begin();
SetPosition(chunk * chunk_size * sizeof(T)); SetPosition((int64)chunk * (int64)chunk_size * (int64)sizeof(T));
ReadBuffer((char *)(buffer.data), buffer.size * sizeof(T)); ReadBuffer((char *)(buffer.data), buffer.size * sizeof(T));
return buffer.data; return buffer.data;
} }
//non buffered read only acces. //non buffered read only acces.
T read(unsigned int element) { T read(unsigned int element) {
SetPosition(element * sizeof(T)); SetPosition((int64)element * (int64)sizeof(T));
T t; T t;
ReadBuffer(&t, sizeof(T)); ReadBuffer(&t, sizeof(T));
return t; return t;
} }
void write(unsigned int element, T &t) { void write(unsigned int element, T &t) {
SetPosition(element * sizeof(T)); SetPosition((int64)element * (int64)sizeof(T));
WriteBuffer(&t, sizeof(T)); WriteBuffer(&t, sizeof(T));
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.3 2004/10/21 13:40:16 ponchio
Debugging.
Revision 1.2 2004/10/21 12:14:02 ponchio Revision 1.2 2004/10/21 12:14:02 ponchio
Support for mfile (>4Gb) Support for mfile (>4Gb)
@ -46,7 +49,10 @@ First draft created.
****************************************************************************/ ****************************************************************************/
#ifdef WIN32 #ifdef WIN32
#ifndef _WINDOWS_
#define _WINSOCKAPI_
#include <windows.h> #include <windows.h>
#endif
#else #else
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>