mingw: fix compile errors with linenoise and fstream
This commit is contained in:
		@@ -139,8 +139,10 @@ namespace ix
 | 
				
			|||||||
        std::streamoff size = file.tellg();
 | 
					        std::streamoff size = file.tellg();
 | 
				
			||||||
        file.seekg(0, file.beg);
 | 
					        file.seekg(0, file.beg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memblock.resize((size_t) size);
 | 
					        memblock.reserve((size_t) size);
 | 
				
			||||||
        file.read((char*) &memblock.front(), static_cast<std::streamsize>(size));
 | 
					        memblock.insert(memblock.begin(),
 | 
				
			||||||
 | 
					                        std::istream_iterator<char>(file),
 | 
				
			||||||
 | 
					                        std::istream_iterator<char>());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return memblock;
 | 
					        return memblock;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								third_party/cpp-linenoise/linenoise.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								third_party/cpp-linenoise/linenoise.cpp
									
									
									
									
										vendored
									
									
								
							@@ -1639,7 +1639,10 @@ bool enableRawMode(int fd) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        /* Init windows console handles only once */
 | 
					        /* Init windows console handles only once */
 | 
				
			||||||
        hOut = GetStdHandle(STD_OUTPUT_HANDLE);
 | 
					        hOut = GetStdHandle(STD_OUTPUT_HANDLE);
 | 
				
			||||||
        if (hOut==INVALID_HANDLE_VALUE) goto fatal;
 | 
					        if (hOut==INVALID_HANDLE_VALUE) {
 | 
				
			||||||
 | 
					            errno = ENOTTY;
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DWORD consolemodeOut;
 | 
					    DWORD consolemodeOut;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								ws/ws.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ws/ws.cpp
									
									
									
									
									
								
							@@ -55,16 +55,18 @@ namespace
 | 
				
			|||||||
    std::pair<bool, std::vector<uint8_t>> load(const std::string& path)
 | 
					    std::pair<bool, std::vector<uint8_t>> load(const std::string& path)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        std::vector<uint8_t> memblock;
 | 
					        std::vector<uint8_t> memblock;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        std::ifstream file(path);
 | 
					        std::ifstream file(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!file.is_open()) return std::make_pair(false, memblock);
 | 
					        if (!file.is_open()) return std::make_pair(false, memblock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        file.seekg(0, file.end);
 | 
					        file.seekg(0, file.end);
 | 
				
			||||||
        std::streamoff size = file.tellg();
 | 
					        std::streamoff size = file.tellg();
 | 
				
			||||||
        file.seekg(0, file.beg);
 | 
					        file.seekg(0, file.beg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memblock.resize((size_t) size);
 | 
					        memblock.reserve((size_t) size);
 | 
				
			||||||
        file.read((char*) &memblock.front(), static_cast<std::streamsize>(size));
 | 
					        memblock.insert(memblock.begin(),
 | 
				
			||||||
 | 
					                        std::istream_iterator<char>(file),
 | 
				
			||||||
 | 
					                        std::istream_iterator<char>());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return std::make_pair(true, memblock);
 | 
					        return std::make_pair(true, memblock);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -86,9 +88,10 @@ namespace
 | 
				
			|||||||
        std::streamoff size = file.tellg();
 | 
					        std::streamoff size = file.tellg();
 | 
				
			||||||
        file.seekg(0, file.beg);
 | 
					        file.seekg(0, file.beg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memblock.resize(size);
 | 
					        memblock.reserve((size_t) size);
 | 
				
			||||||
 | 
					        memblock.insert(memblock.begin(),
 | 
				
			||||||
        file.read((char*) &memblock.front(), static_cast<std::streamsize>(size));
 | 
					                        std::istream_iterator<char>(file),
 | 
				
			||||||
 | 
					                        std::istream_iterator<char>());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::string bytes(memblock.begin(), memblock.end());
 | 
					        std::string bytes(memblock.begin(), memblock.end());
 | 
				
			||||||
        return bytes;
 | 
					        return bytes;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user