switch to copy semantics
authorVolker Birk <vb@pep-project.org>
Mon, 14 Nov 2016 12:28:07 +0100
changeset 21425aaaf97917f
parent 213 d32175cbbdbe
child 215 033aa489f9d6
switch to copy semantics
GateKeeper.cpp
GateKeeper.h
     1.1 --- a/GateKeeper.cpp	Mon Nov 14 12:14:43 2016 +0100
     1.2 +++ b/GateKeeper.cpp	Mon Nov 14 12:28:07 2016 +0100
     1.3 @@ -345,9 +345,9 @@
     1.4          return result;
     1.5      }
     1.6  
     1.7 -    GateKeeper::product_list& GateKeeper::registered_products()
     1.8 +    GateKeeper::product_list GateKeeper::registered_products()
     1.9      {
    1.10 -        static product_list products;
    1.11 +        product_list products;
    1.12  
    1.13          // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724872(v=vs.85).aspx
    1.14          TCHAR value_name[16384];
    1.15 @@ -355,8 +355,6 @@
    1.16          TCHAR value[L_MAX_URL_LENGTH + 1];
    1.17          DWORD value_size;
    1.18  
    1.19 -        products.clear();
    1.20 -
    1.21          LONG lResult = ERROR_SUCCESS;
    1.22          for (DWORD i = 0; lResult == ERROR_SUCCESS; i++) {
    1.23              value_name_size = 16383;
    1.24 @@ -527,17 +525,19 @@
    1.25          if (!internet)
    1.26              goto closing;
    1.27  
    1.28 -        product_list& products = registered_products();
    1.29 -        DWORD context = 0;
    1.30 +		{
    1.31 +			product_list products = registered_products();
    1.32 +			DWORD context = 0;
    1.33  
    1.34 -        for (auto i = products.begin(); i != products.end(); i++) {
    1.35 -            try {
    1.36 -                update_product(*i, context++);
    1.37 -            }
    1.38 -            catch (exception&) {
    1.39 -            
    1.40 -            }
    1.41 -        }
    1.42 +			for (auto i = products.begin(); i != products.end(); i++) {
    1.43 +				try {
    1.44 +					update_product(*i, context++);
    1.45 +				}
    1.46 +				catch (exception&) {
    1.47 +
    1.48 +				}
    1.49 +			}
    1.50 +		}
    1.51  
    1.52      closing:
    1.53          if (internet)
     2.1 --- a/GateKeeper.h	Mon Nov 14 12:14:43 2016 +0100
     2.2 +++ b/GateKeeper.h	Mon Nov 14 12:28:07 2016 +0100
     2.3 @@ -50,7 +50,7 @@
     2.4          string wrapped_delivery_key(BCRYPT_KEY_HANDLE hDeliveryKey);
     2.5  
     2.6          void update_product(product p, DWORD context);
     2.7 -        product_list& registered_products();
     2.8 +        product_list registered_products();
     2.9          void keep_updated();
    2.10  		static tstring get_lockFile();
    2.11