libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd cvd/diskbuffer2.h cvd_src/Win32/win32.cpp


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd cvd/diskbuffer2.h cvd_src/Win32/win32.cpp
Date: Wed, 16 Dec 2009 16:22:50 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      09/12/16 16:22:50

Modified files:
        cvd            : diskbuffer2.h 
        cvd_src/Win32  : win32.cpp 

Log message:
        fixed bug in Diskbuffer2
        globlist in Win32 supports directories now

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/diskbuffer2.h?cvsroot=libcvd&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/Win32/win32.cpp?cvsroot=libcvd&r1=1.3&r2=1.4

Patches:
Index: cvd/diskbuffer2.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/diskbuffer2.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- cvd/diskbuffer2.h   2 Dec 2008 17:30:39 -0000       1.17
+++ cvd/diskbuffer2.h   16 Dec 2009 16:22:49 -0000      1.18
@@ -150,7 +150,7 @@
 
                Image<T> foo;
                std::ifstream im;
-               im.open(names[0].c_str());
+               im.open(names[0].c_str(), std::ios::in|std::ios::binary);
 
                if(!im.good())
                        throw Exceptions::DiskBuffer2::BadFile(names[0], errno);

Index: cvd_src/Win32/win32.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/Win32/win32.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cvd_src/Win32/win32.cpp     12 Jul 2009 16:24:22 -0000      1.3
+++ cvd_src/Win32/win32.cpp     16 Dec 2009 16:22:49 -0000      1.4
@@ -4,7 +4,9 @@
 #include <string>
 #include <vector>
 #include <algorithm>
+#include <cassert>
 #include <io.h>
+#include <stdlib.h>
 
 #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
   #define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
@@ -62,6 +64,18 @@
 
 } // namespace Internal
 
+// returns path component from a general path string
+static std::string get_path( const std::string & p){
+       char drive[_MAX_DRIVE];
+       char dir[_MAX_DIR];
+       char out[1024];
+
+       errno_t ret = _splitpath_s(p.c_str(), drive, _MAX_DRIVE, dir, _MAX_DIR, 
NULL, 0, NULL, 0);
+       assert(0 == ret);
+       _makepath(out, drive, dir, NULL, NULL);
+       return std::string(out);
+}
+
 // simple implementation of globlist after MSDN example for _findfirst
 std::vector<std::string> globlist(const std::string& gl)
 {
@@ -70,10 +84,13 @@
        struct _finddatai64_t c_file;
        intptr_t hFile;
 
+       // get the path component to stick it to the front again
+       const std::string path = get_path(gl);
+
        // Find first file in current directory 
        if( (hFile = _findfirsti64( gl.c_str(), &c_file )) != -1L ){
                do {
-                       ret.push_back(c_file.name);
+                       ret.push_back(path + c_file.name);
                } while( _findnexti64( hFile, &c_file ) == 0 );
                _findclose( hFile );
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]