Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: Source/modules/indexeddb/IDBKeyRange.cpp

Issue 1166553004: IndexedDB: Replace 0 with nullptr where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MOAR Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBIndex.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 IDBKeyRange* IDBKeyRange::lowerBound(ExecutionContext* context, const ScriptValu e& boundValue, bool open, ExceptionState& exceptionState) 104 IDBKeyRange* IDBKeyRange::lowerBound(ExecutionContext* context, const ScriptValu e& boundValue, bool open, ExceptionState& exceptionState)
105 { 105 {
106 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc eptionState); 106 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc eptionState);
107 if (exceptionState.hadException()) 107 if (exceptionState.hadException())
108 return nullptr; 108 return nullptr;
109 if (!bound || !bound->isValid()) { 109 if (!bound || !bound->isValid()) {
110 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 110 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
111 return nullptr; 111 return nullptr;
112 } 112 }
113 113
114 return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClose d, UpperBoundOpen); 114 return IDBKeyRange::create(bound, nullptr, open ? LowerBoundOpen : LowerBoun dClosed, UpperBoundOpen);
115 } 115 }
116 116
117 IDBKeyRange* IDBKeyRange::upperBound(ExecutionContext* context, const ScriptValu e& boundValue, bool open, ExceptionState& exceptionState) 117 IDBKeyRange* IDBKeyRange::upperBound(ExecutionContext* context, const ScriptValu e& boundValue, bool open, ExceptionState& exceptionState)
118 { 118 {
119 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc eptionState); 119 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc eptionState);
120 if (exceptionState.hadException()) 120 if (exceptionState.hadException())
121 return nullptr; 121 return nullptr;
122 if (!bound || !bound->isValid()) { 122 if (!bound || !bound->isValid()) {
123 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 123 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
124 return nullptr; 124 return nullptr;
125 } 125 }
126 126
127 return IDBKeyRange::create(0, bound, LowerBoundOpen, open ? UpperBoundOpen : UpperBoundClosed); 127 return IDBKeyRange::create(nullptr, bound, LowerBoundOpen, open ? UpperBound Open : UpperBoundClosed);
128 } 128 }
129 129
130 IDBKeyRange* IDBKeyRange::bound(ExecutionContext* context, const ScriptValue& lo werValue, const ScriptValue& upperValue, bool lowerOpen, bool upperOpen, Excepti onState& exceptionState) 130 IDBKeyRange* IDBKeyRange::bound(ExecutionContext* context, const ScriptValue& lo werValue, const ScriptValue& upperValue, bool lowerOpen, bool upperOpen, Excepti onState& exceptionState)
131 { 131 {
132 IDBKey* lower = ScriptValue::to<IDBKey*>(toIsolate(context), lowerValue, exc eptionState); 132 IDBKey* lower = ScriptValue::to<IDBKey*>(toIsolate(context), lowerValue, exc eptionState);
133 if (exceptionState.hadException()) 133 if (exceptionState.hadException())
134 return nullptr; 134 return nullptr;
135 if (!lower || !lower->isValid()) { 135 if (!lower || !lower->isValid()) {
136 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 136 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
137 return nullptr; 137 return nullptr;
(...skipping 13 matching lines...) Expand all
151 } 151 }
152 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) { 152 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) {
153 exceptionState.throwDOMException(DataError, "The lower key and upper key are equal and one of the bounds is open."); 153 exceptionState.throwDOMException(DataError, "The lower key and upper key are equal and one of the bounds is open.");
154 return nullptr; 154 return nullptr;
155 } 155 }
156 156
157 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed); 157 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed);
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBIndex.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698