~ubuntu-branches/ubuntu/maverick/squid3/maverick-updates

« back to all changes in this revision

Viewing changes to src/StoreMeta.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-07-07 15:21:06 UTC
  • mfrom: (20.3.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100707152106-ozv23qjzn7q1jpaj
Tags: 3.1.5-2
* debian/control
  - Added build dependency on libltdl-dev fixing FTBFS on most archs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/*
3
 
 * $Id: StoreMeta.cc,v 1.6.2.2 2008/02/24 11:29:55 amosjeffries Exp $
 
3
 * $Id$
4
4
 *
5
5
 * DEBUG: section 20    Storage Manager Swapfile Metadata
6
6
 * AUTHOR: Kostas Anagnostakis
21
21
 *  it under the terms of the GNU General Public License as published by
22
22
 *  the Free Software Foundation; either version 2 of the License, or
23
23
 *  (at your option) any later version.
24
 
 *  
 
24
 *
25
25
 *  This program is distributed in the hope that it will be useful,
26
26
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
27
27
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
28
 *  GNU General Public License for more details.
29
 
 *  
 
29
 *
30
30
 *  You should have received a copy of the GNU General Public License
31
31
 *  along with this program; if not, write to the Free Software
32
32
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
55
55
 
56
56
    /* Not yet implemented */
57
57
    if (type >= STORE_META_END ||
58
 
            type == STORE_META_STOREURL ||
59
 
            type == STORE_META_VARY_ID) {
 
58
            type == STORE_META_STOREURL ||
 
59
            type == STORE_META_VARY_ID) {
60
60
        debugs(20, 3, "storeSwapMetaUnpack: Not yet implemented (" << type << ") in disk metadata");
61
61
        return false;
62
62
    }
77
77
{
78
78
 
79
79
public:
80
 
    IntRange (int minimum, int maximum) : _min (minimum), _max (maximum)
81
 
    {
 
80
    IntRange (int minimum, int maximum) : _min (minimum), _max (maximum) {
82
81
        if (_min > _max) {
83
82
            int temp = _min;
84
83
            _min = _max;
86
85
        }
87
86
    }
88
87
 
89
 
    bool includes (int anInt) const
90
 
    {
 
88
    bool includes (int anInt) const {
91
89
        if (anInt < _min || anInt > _max)
92
90
            return false;
93
91
 
103
101
const int StoreMeta::MaximumTLVLength = 1 << 16;
104
102
 
105
103
bool
106
 
StoreMeta::validLength(int length) const
 
104
StoreMeta::validLength(int aLength) const
107
105
{
108
 
    if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(length)) {
109
 
        debugs(20, 0, "storeSwapMetaUnpack: insane length (" << length << ")!");
 
106
    if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(aLength)) {
 
107
        debugs(20, 0, "storeSwapMetaUnpack: insane length (" << aLength << ")!");
110
108
        return false;
111
109
    }
112
110
 
140
138
        result = new StoreMetaSTDLFS;
141
139
        break;
142
140
 
143
 
     case STORE_META_OBJSIZE:
144
 
        result = new StoreMetaObjSize;
 
141
    case STORE_META_OBJSIZE:
 
142
        result = new StoreMetaObjSize;
145
143
        break;
146
144
 
147
145
    case STORE_META_VARY_HEADERS:
204
202
        break;
205
203
 
206
204
    case STORE_META_OBJSIZE:
207
 
        break;
 
205
        break;
208
206
 
209
207
    default:
210
208
        debugs(20, 1, "WARNING: got unused STORE_META type " << getType());