Commit eb5dfb2b6330d666fab2c939efae4bfcd6ae7a0e

Authored by David Mayerich
1 parent abdb93f5

fixed linux compatibility issues

stim/envi/bsq.h
... ... @@ -157,7 +157,7 @@ public:
157 157 return false;
158 158 }
159 159  
160   - file.seekg(n * sizeof(T) + header, std::ios::beg); //point to the certain pixel
  160 + file.seekg(n * sizeof(T) + binary<T>::header, std::ios::beg); //point to the certain pixel
161 161 for (unsigned i = 0; i < Z(); i++)
162 162 {
163 163 file.read((char *)(p + i), sizeof(T));
... ... @@ -793,7 +793,7 @@ public:
793 793 if(mask[xy] != 0) P++;
794 794 }
795 795 }
796   -
  796 +
797 797 T* band_image = (T*) malloc( XY * sizeof(T)); //allocate space for a single band
798 798  
799 799 unsigned long long i; //pixel index into the sifted array
... ... @@ -808,7 +808,7 @@ public:
808 808 }
809 809 }
810 810 }
811   -
  811 +
812 812 return true;
813 813 }
814 814  
... ...
stim/parser/arguments.h
... ... @@ -357,9 +357,9 @@ namespace stim{
357 357 if(si != -1 && a == sections[si].index)
358 358 {
359 359 if(ansi)
360   - ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<std::string("w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[1;31m") + sections[si].name<<"w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[0m"<<std::endl;
  360 + ss<<std::endl<<std::left<<std::setw(col_width)<<std::string("w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[1;31m") + sections[si].name<<"w(col_width)<<std::string("\033[1;31m") + sections[si].name<<"\033[0m"<<std::endl;33[0m"<<std::endl;
361 361 else
362   - ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<sections[si].name<<std::endl;
  362 + ss<<std::endl<<std::left<<std::setw(col_width)<<sections[si].name<<std::endl;
363 363 si++;
364 364 if(si == (int)sections.size()) si = -1;
365 365 }
... ...
stim/parser/filename.h
... ... @@ -69,7 +69,7 @@ protected:
69 69 loc = unix_div(loc);
70 70  
71 71 //determine the drive (if Windows)
72   - drive = "";
  72 + drive = "";
73 73 #ifdef _WIN32
74 74 //if the second character is a colon, the character right before it is the drive
75 75 if(loc[1] == ':'){
... ... @@ -153,7 +153,7 @@ public:
153 153 }
154 154  
155 155 //*****************************************************************************************************************
156   - // output is the directory and the prefix and the extension of the files, which are looking for in that directory.
  156 + // output is the directory and the prefix and the extension of the files, which are looking for in that directory.
157 157 std::string dir_fname(){
158 158 std::stringstream ss;
159 159  
... ... @@ -166,7 +166,7 @@ public:
166 166 ss<<STIM_FILENAME_DIV;
167 167 }
168 168  
169   -
  169 +
170 170 for(unsigned int d = 0; d < path.size(); d++)
171 171 ss<<path[d]<<STIM_FILENAME_DIV;
172 172 ss<<get_name();
... ... @@ -174,7 +174,7 @@ public:
174 174 return ss.str();
175 175  
176 176 }
177   -
  177 +
178 178 // output is the directory and the name of the file which are found in that given directory
179 179 std::string f_name(std::string file_name){
180 180 std::stringstream ss;
... ... @@ -201,10 +201,10 @@ public:
201 201  
202 202 }
203 203  
204   -
  204 + std::vector<stim::filename> get_list(){
205 205 #ifdef _WIN32
206 206 //get a list of files matching the current template
207   - std::vector<stim::filename> get_list(){
  207 +
208 208  
209 209 //stim::filename file_path;
210 210 stim::filename filepath(dir_fname());
... ... @@ -212,12 +212,12 @@ public:
212 212 HANDLE hFind = INVALID_HANDLE_VALUE;
213 213 WIN32_FIND_DATAA FindFileData;
214 214 std::vector<stim::filename> file_list;
215   -
  215 +
216 216 hFind = FindFirstFileA((filepath.str().c_str()), &FindFileData);
217 217  
218 218 if (hFind == INVALID_HANDLE_VALUE) {
219 219 printf ("Invalid file handle. Error is %u.\n", GetLastError());
220   - }
  220 + }
221 221 else {
222 222 std::string file_name = FindFileData.cFileName; //get the file name
223 223 std::string file_path = dir();
... ... @@ -233,9 +233,11 @@ public:
233 233 FindClose(hFind);
234 234 }
235 235 return file_list;
236   -
237   - }
  236 +#else
  237 + std::cout<<"File lists aren't currently supported on Unix/Linux systems."<<std::endl;
  238 + exit(1);
238 239 #endif
  240 + }
239 241 //**************************************************************************************************
240 242  
241 243 //gets the current working directory
... ...