From 53dfd48f59aaae277063b7aca838ddca40ac4a62 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 2 Jun 2021 07:14:32 +0900 Subject: [PATCH] Correct usage of istringstream (#1670) Previously this looped one more time than necessary due to the eof check: https://isocpp.org/wiki/faq/input-output#istream-and-eof Remove now redundant empty check. --- src/curl.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index 79a64bc..4fcb416 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -424,12 +424,8 @@ bool S3fsCurl::InitMimeType(const std::string& strFile) std::istringstream tmp(line); std::string mimeType; tmp >> mimeType; - while(tmp){ - std::string ext; - tmp >> ext; - if(ext.empty()){ - continue; - } + std::string ext; + while(tmp >> ext){ S3fsCurl::mimeTypes[ext] = mimeType; } }