summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/db/datacache.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer/db/datacache.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tableviewer/db/datacache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp
index 6380e1b..de57961 100644
--- a/noncore/apps/tableviewer/db/datacache.cpp
+++ b/noncore/apps/tableviewer/db/datacache.cpp
@@ -135,49 +135,49 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
135 archive = new DBXml(this); 135 archive = new DBXml(this);
136 } else if (source == "text/x-xml-tableviewer") { 136 } else if (source == "text/x-xml-tableviewer") {
137 archive = new DBCsv(this); 137 archive = new DBCsv(this);
138 } else 138 } else
139 return false; 139 return false;
140 } 140 }
141 141
142 return (archive->saveSource(outDev)); 142 return (archive->saveSource(outDev));
143} 143}
144 144
145/*! 145/*!
146 This function is used to add new elements to the database. If the database 146 This function is used to add new elements to the database. If the database
147 has already reached the maximum allowable size this function does not alter 147 has already reached the maximum allowable size this function does not alter
148 the database. 148 the database.
149 149
150 \param delm An already allocated and initialized data element to be added 150 \param delm An already allocated and initialized data element to be added
151*/ 151*/
152void DBStore::addItem(DataElem *delem) 152void DBStore::addItem(DataElem *delem)
153{ 153{
154 addItemInternal(delem); 154 addItemInternal(delem);
155} 155}
156 156
157void DBStore::addItemInternal(DataElem *delem) 157void DBStore::addItemInternal(DataElem *delem)
158{ 158{
159 /* if already full, don't over fill, do a qWarning though */ 159 /* if already full, don't over fill, do a owarn though */
160 if (full) { 160 if (full) {
161 owarn << "Attempted to add items to already full table" << oendl; 161 owarn << "Attempted to add items to already full table" << oendl;
162 return; 162 return;
163 } 163 }
164 164
165 master_table.insert(number_elems, delem); 165 master_table.insert(number_elems, delem);
166 166
167 current_elem = number_elems; 167 current_elem = number_elems;
168 number_elems++; 168 number_elems++;
169 169
170 if(number_elems >= table_size) { 170 if(number_elems >= table_size) {
171 /* filled current table, double if we can */ 171 /* filled current table, double if we can */
172 table_size = table_size << 1; 172 table_size = table_size << 1;
173 173
174 /* check that the new table size is still valid, i.e. that we didn't 174 /* check that the new table size is still valid, i.e. that we didn't
175 just shift the 1 bit of the end of the int. */ 175 just shift the 1 bit of the end of the int. */
176 if (!table_size) { 176 if (!table_size) {
177 full = true; 177 full = true;
178 /* no point in doing antying else. */ 178 /* no point in doing antying else. */
179 return; 179 return;
180 } 180 }
181 master_table.resize(table_size); 181 master_table.resize(table_size);
182 } 182 }
183} 183}