Return-Path: X-Original-To: apmail-avro-commits-archive@www.apache.org Delivered-To: apmail-avro-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 87E98997E for ; Sun, 20 May 2012 16:39:37 +0000 (UTC) Received: (qmail 5727 invoked by uid 500); 20 May 2012 16:39:37 -0000 Delivered-To: apmail-avro-commits-archive@avro.apache.org Received: (qmail 5706 invoked by uid 500); 20 May 2012 16:39:37 -0000 Mailing-List: contact commits-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list commits@avro.apache.org Received: (qmail 5699 invoked by uid 99); 20 May 2012 16:39:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2012 16:39:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 May 2012 16:39:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EFBDB2388962 for ; Sun, 20 May 2012 16:39:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1340767 - in /avro/trunk: CHANGES.txt lang/c++/impl/json/JsonIO.cc lang/c++/impl/json/JsonIO.hh Date: Sun, 20 May 2012 16:39:15 -0000 To: commits@avro.apache.org From: thiru@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120520163915.EFBDB2388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(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: