Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66017 - trunk/boost/asio/impl
From: chris_at_[hidden]
Date: 2010-10-16 08:23:58


Author: chris_kohlhoff
Date: 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
New Revision: 66017
URL: http://svn.boost.org/trac/boost/changeset/66017

Log:
Ensure handler arguments are passed as lvalues. Refs #4744.

Text files modified:
   trunk/boost/asio/impl/read.hpp | 6 ++--
   trunk/boost/asio/impl/read_at.hpp | 6 ++--
   trunk/boost/asio/impl/read_until.hpp | 44 ++++++++++++++++++++++++++++++++-------
   trunk/boost/asio/impl/write.hpp | 6 ++--
   trunk/boost/asio/impl/write_at.hpp | 6 ++--
   5 files changed, 48 insertions(+), 20 deletions(-)

Modified: trunk/boost/asio/impl/read.hpp
==============================================================================
--- trunk/boost/asio/impl/read.hpp (original)
+++ trunk/boost/asio/impl/read.hpp 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
@@ -160,7 +160,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -212,7 +212,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -317,7 +317,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 

Modified: trunk/boost/asio/impl/read_at.hpp
==============================================================================
--- trunk/boost/asio/impl/read_at.hpp (original)
+++ trunk/boost/asio/impl/read_at.hpp 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
@@ -173,7 +173,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -226,7 +226,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -338,7 +338,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 

Modified: trunk/boost/asio/impl/read_until.hpp
==============================================================================
--- trunk/boost/asio/impl/read_until.hpp (original)
+++ trunk/boost/asio/impl/read_until.hpp 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
@@ -392,8 +392,15 @@
             break;
         }
 
- handler_(search_position_ == not_found ? error::not_found : ec,
- ec || search_position_ == not_found ? 0 : search_position_);
+ const boost::system::error_code result_ec =
+ (search_position_ == not_found)
+ ? error::not_found : ec;
+
+ const std::size_t result_n =
+ (ec || search_position_ == not_found)
+ ? 0 : search_position_;
+
+ handler_(result_ec, result_n);
       }
     }
 
@@ -529,8 +536,15 @@
             break;
         }
 
- handler_(search_position_ == not_found ? error::not_found : ec,
- ec || search_position_ == not_found ? 0 : search_position_);
+ const boost::system::error_code result_ec =
+ (search_position_ == not_found)
+ ? error::not_found : ec;
+
+ const std::size_t result_n =
+ (ec || search_position_ == not_found)
+ ? 0 : search_position_;
+
+ handler_(result_ec, result_n);
       }
     }
 
@@ -671,8 +685,15 @@
             break;
         }
 
- handler_(search_position_ == not_found ? error::not_found : ec,
- ec || search_position_ == not_found ? 0 : search_position_);
+ const boost::system::error_code result_ec =
+ (search_position_ == not_found)
+ ? error::not_found : ec;
+
+ const std::size_t result_n =
+ (ec || search_position_ == not_found)
+ ? 0 : search_position_;
+
+ handler_(result_ec, result_n);
       }
     }
 
@@ -811,8 +832,15 @@
             break;
         }
 
- handler_(search_position_ == not_found ? error::not_found : ec,
- ec || search_position_ == not_found ? 0 : search_position_);
+ const boost::system::error_code result_ec =
+ (search_position_ == not_found)
+ ? error::not_found : ec;
+
+ const std::size_t result_n =
+ (ec || search_position_ == not_found)
+ ? 0 : search_position_;
+
+ handler_(result_ec, result_n);
       }
     }
 

Modified: trunk/boost/asio/impl/write.hpp
==============================================================================
--- trunk/boost/asio/impl/write.hpp (original)
+++ trunk/boost/asio/impl/write.hpp 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
@@ -146,7 +146,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -198,7 +198,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -249,7 +249,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 

Modified: trunk/boost/asio/impl/write_at.hpp
==============================================================================
--- trunk/boost/asio/impl/write_at.hpp (original)
+++ trunk/boost/asio/impl/write_at.hpp 2010-10-16 08:23:56 EDT (Sat, 16 Oct 2010)
@@ -157,7 +157,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -211,7 +211,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 
@@ -264,7 +264,7 @@
             break;
         }
 
- handler_(ec, static_cast<const std::size_t>(total_transferred_));
+ handler_(ec, static_cast<const std::size_t&>(total_transferred_));
       }
     }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk