Author: thiru
Date: Sun May 20 16:39:14 2012
New Revision: 1340767
URL: http://svn.apache.org/viewvc?rev=1340767&view=rev
Log:
AVRO-1095. C++ compiler warns about control reaching end of doAdavance (in
JsonIO.cc) which returns something other than void
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/c++/impl/json/JsonIO.cc
avro/trunk/lang/c++/impl/json/JsonIO.hh
Modified: avro/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1340767&r1=1340766&r2=1340767&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Sun May 20 16:39:14 2012
@@ -46,6 +46,8 @@ Avro 1.7.0 (unreleased)
AVRO-1028. Python: Fix HTTP server to handle connection resets and
redirects. (Bo Shi via cutting)
+ AVRO-1095. C++ compiler warns about control reaching end of doAdavance (in
JsonIO.cc) which returns something other than void. (thiru)
+
BUG FIXES
AVRO-1045. Java: Fix a bug in GenericData#deepCopy() of ByteBuffer values.
Modified: avro/trunk/lang/c++/impl/json/JsonIO.cc
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/impl/json/JsonIO.cc?rev=1340767&r1=1340766&r2=1340767&view=diff
==============================================================================
--- avro/trunk/lang/c++/impl/json/JsonIO.cc (original)
+++ avro/trunk/lang/c++/impl/json/JsonIO.cc Sun May 20 16:39:14 2012
@@ -53,7 +53,7 @@ JsonParser::Token JsonParser::doAdvance(
stateStack.pop();
return tkArrayEnd;
} else {
- unexpected(ch);
+ throw unexpected(ch);
}
} else if (ch == '}') {
if (curState == stObject0 || stObjectN) {
@@ -61,11 +61,11 @@ JsonParser::Token JsonParser::doAdvance(
stateStack.pop();
return tkObjectEnd;
} else {
- unexpected(ch);
+ throw unexpected(ch);
}
} else if (ch == ',') {
if (curState != stObjectN && curState != stArrayN) {
- unexpected(ch);
+ throw unexpected(ch);
}
if (curState == stObjectN) {
curState = stObject0;
@@ -73,7 +73,7 @@ JsonParser::Token JsonParser::doAdvance(
ch = next();
} else if (ch == ':') {
if (curState != stKey) {
- unexpected(ch);
+ throw unexpected(ch);
}
curState = stObjectN;
ch = next();
@@ -81,7 +81,7 @@ JsonParser::Token JsonParser::doAdvance(
if (curState == stObject0) {
if (ch != '"') {
- unexpected(ch);
+ throw unexpected(ch);
}
curState = stKey;
} else if (curState == stArray0) {
@@ -111,7 +111,7 @@ JsonParser::Token JsonParser::doAdvance(
if (isdigit(ch) || ch == '-') {
return tryNumber(ch);
} else {
- unexpected(ch);
+ throw unexpected(ch);
}
}
}
@@ -227,7 +227,7 @@ JsonParser::Token JsonParser::tryNumber(
}
} else {
if (hasNext) {
- unexpected(ch);
+ throw unexpected(ch);
} else {
throw Exception("Unexpected EOF");
}
@@ -281,14 +281,14 @@ JsonParser::Token JsonParser::tryString(
} else if (c >= 'A' && c <= 'F') {
n += c - 'A' + 10;
} else {
- unexpected(c);
+ throw unexpected(c);
}
}
sv.push_back(n);
}
break;
default:
- unexpected(ch);
+ throw unexpected(ch);
}
} else {
sv.push_back(ch);
@@ -296,11 +296,11 @@ JsonParser::Token JsonParser::tryString(
}
}
-void JsonParser::unexpected(unsigned char c)
+Exception JsonParser::unexpected(unsigned char c)
{
std::ostringstream oss;
oss << "Unexpected character in json " << toHex(c / 16) << toHex(c % 16);
- throw Exception(oss.str());
+ return Exception(oss.str());
}
JsonParser::Token JsonParser::tryLiteral(const char exp[], size_t n, Token tk)
@@ -309,13 +309,13 @@ JsonParser::Token JsonParser::tryLiteral
in_.readBytes(reinterpret_cast<uint8_t*>(c), n);
for (size_t i = 0; i < n; ++i) {
if (c[i] != exp[i]) {
- unexpected(c[i]);
+ throw unexpected(c[i]);
}
}
if (in_.hasMore()) {
nextChar = in_.read();
if (isdigit(nextChar) || isalpha(nextChar)) {
- unexpected(nextChar);
+ throw unexpected(nextChar);
}
hasNext = true;
}
Modified: avro/trunk/lang/c++/impl/json/JsonIO.hh
URL:
http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/impl/json/JsonIO.hh?rev=1340767&r1=1340766&r2=1340767&view=diff
==============================================================================
--- avro/trunk/lang/c++/impl/json/JsonIO.hh (original)
+++ avro/trunk/lang/c++/impl/json/JsonIO.hh Sun May 20 16:39:14 2012
@@ -75,7 +75,7 @@ private:
Token tryLiteral(const char exp[], size_t n, Token tk);
Token tryNumber(char ch);
Token tryString();
- void unexpected(unsigned char ch);
+ Exception unexpected(unsigned char ch);
char next();
public: