From a8acbaa8a1b1b709702989b50f35eb146845030b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Jan 2014 18:17:00 +0800 Subject: [PATCH] Do not use ranged for in windows code. It's not supported in VS2010, and VS2010 is still being used widely. --- src/win/pty.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/win/pty.cc b/src/win/pty.cc index e07b29d..bb7d1c8 100644 --- a/src/win/pty.cc +++ b/src/win/pty.cc @@ -60,7 +60,8 @@ const wchar_t* to_wstring(const String::Utf8Value& str) } static winpty_t *get_pipe_handle(int handle) { - for(winpty_t *ptyHandle : ptyHandles) { + for(size_t i = 0; i < ptyHandles.size(); ++i) { + winpty_t *ptyHandle = ptyHandles[i]; int current = (int)ptyHandle->controlPipe; if(current == handle) { return ptyHandle; @@ -70,7 +71,8 @@ static winpty_t *get_pipe_handle(int handle) { } static bool remove_pipe_handle(int handle) { - for(winpty_t *ptyHandle : ptyHandles) { + for(size_t i = 0; i < ptyHandles.size(); ++i) { + winpty_t *ptyHandle = ptyHandles[i]; if((int)ptyHandle->controlPipe == handle) { delete ptyHandle; ptyHandle = nullptr;