summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Christian <andrew.christian@nokia.com>2012-03-19 07:29:56 -0400
committerChris Craig <ext-chris.craig@nokia.com>2012-03-19 14:32:50 +0100
commit2c7a5a89ce98e682acfe12aacf5b3a833f52f0c9 (patch)
treee577b435bf8edf490b20f9377db03124f669e2c9
parent85c13d27209d5197894f60ecfeba5433a0c48127 (diff)
Fixed compiler warnings in bson
Change-Id: I77e9ea5daafc20556c6ebb13e374a7ffe0529b07 Reviewed-by: Alexei Rousskikh <ext-alexei.rousskikh@nokia.com> Reviewed-by: Chris Craig <ext-chris.craig@nokia.com>
-rw-r--r--src/bson/bson.cpp2
-rw-r--r--src/bson/bson_p.h3
-rw-r--r--src/bson/qt-bson.cpp18
3 files changed, 11 insertions, 12 deletions
diff --git a/src/bson/bson.cpp b/src/bson/bson.cpp
index e60decc..09eaa46 100644
--- a/src/bson/bson.cpp
+++ b/src/bson/bson.cpp
@@ -89,7 +89,7 @@ void bson_print_raw( const char * data , int depth ){
case bson_double: printf( "%f" , bson_iterator_double( &i ) ); break;
case bson_bool: printf( "%s" , bson_iterator_bool( &i ) ? "true" : "false" ); break;
case bson_string: printf( "%s" , bson_iterator_string( &i ) ); break;
- case bson_utf16: printf( "%s" , bson_iterator_utf16( &i ) ); break;
+ case bson_utf16: printf( "%ls" , (wchar_t *) bson_iterator_utf16( &i ) ); break;
case bson_null: printf( "null" ); break;
case bson_timestamp:
ts = bson_iterator_timestamp( &i );
diff --git a/src/bson/bson_p.h b/src/bson/bson_p.h
index 352746e..e8295d3 100644
--- a/src/bson/bson_p.h
+++ b/src/bson/bson_p.h
@@ -43,8 +43,7 @@ typedef enum {
bson_int = 16,
bson_timestamp = 17,
bson_long = 18,
- bson_utf16 = 19,
- bson_object_utf16 = 20
+ bson_utf16 = 19
} bson_type;
typedef enum bson_bool {
diff --git a/src/bson/qt-bson.cpp b/src/bson/qt-bson.cpp
index 386062b..da7315c 100644
--- a/src/bson/qt-bson.cpp
+++ b/src/bson/qt-bson.cpp
@@ -95,7 +95,7 @@ BsonObject::BsonObject(const QVariantList &v)
{
d->mBsonType = bson_array;
for (int i = 0; i < v.size(); i++) {
- insert(QByteArray::number(i), v[i]);
+ insert(QString::number(i), v[i]);
}
finish();
}
@@ -133,7 +133,7 @@ void BsonObject::finish()
bson_iterator_init(&j, bson.data);
while (bson_iterator_next(&j) != bson_eoo) {
const char *jkey = bson_iterator_key(&j);
- QString s(jkey);
+ QString s = QString::fromUtf8(jkey);
if (newKeys.contains(s)) {
qCritical() << "BsonObject::finish" << "duplicate key" << s;
}
@@ -149,7 +149,7 @@ void BsonObject::finish()
bson_iterator_init(&i, d->mBson.data);
while (bson_iterator_next(&i) != bson_eoo) {
const char *ikey = bson_iterator_key(&i);
- QString s(ikey);
+ QString s = QString::fromUtf8(ikey);
if (newKeys.contains(s)) {
continue;
}
@@ -175,10 +175,10 @@ QVariantMap BsonObject::toMap()
while ((bt = bson_iterator_next(&it)) && (bt != bson_eoo)) {
const char *ckey = bson_iterator_key(&it);
QVariant v = elementToVariant(bt, &it);
-
- if (map.contains(QByteArray(ckey)))
+ QString s = QString::fromUtf8(ckey);
+ if (map.contains(s))
qDebug() << "BsonObject::toMap" << "duplicate key" << ckey;
- map.insert(QByteArray(ckey), v);
+ map.insert(s, v);
}
return map;
}
@@ -229,7 +229,7 @@ QList<QString> BsonObject::keys()
bson_iterator_init(&it, d->mBson.data);
bson_type bt;
while ((bt = bson_iterator_next(&it)) && (bt != bson_eoo)) {
- keys.append(QByteArray(bson_iterator_key(&it)));
+ keys.append(QString::fromUtf8(bson_iterator_key(&it)));
}
return keys;
}
@@ -370,7 +370,7 @@ BsonObject &BsonObject::insert(const QString &key, const char *s)
finish();
}
d->mAddedKeys.insert(key);
- return insert(key, QString(s));
+ return insert(key, QString::fromUtf8(s));
}
BsonObject &BsonObject::insert(const QString &key, const QString &v)
@@ -563,7 +563,7 @@ QVariant BsonObject::value(const QString &key)
case bson_eoo: // when attempting to fetch a value from an empty object
return QVariant();
default:
- qCritical() << QString("Converting BsonObject element of type %1 to QVariant()").arg(t);
+ qCritical() << QString::fromLatin1("Converting BsonObject element of type %1 to QVariant()").arg(t);
return QVariant();
}
}