Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11399
Merged at revision: 11684
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 358 lines (+67/-29)
19 files modified
include/zorba/item.h (+1/-1)
include/zorba/util/base64_stream.h (+6/-4)
include/zorba/util/hexbinary_stream.h (+4/-1)
modules/http-client/json/http-client.xq.src/http_client.cpp (+1/-0)
modules/http-client/json/http-client.xq.src/http_request_handler.cpp (+4/-16)
modules/http-client/json/http-client.xq.src/http_request_handler.h (+1/-0)
modules/http-client/json/http-client.xq.src/http_response_handler.cpp (+1/-0)
modules/http-client/json/http-client.xq.src/http_response_handler.h (+1/-0)
modules/http-client/json/http-client.xq.src/http_response_parser.h (+1/-0)
modules/http-client/json/http-client.xq.src/inform_data_read.cpp (+1/-0)
modules/http-client/json/http-client.xq.src/inform_data_read.h (+1/-0)
modules/http-client/json/http-client.xq.src/request_parser.cpp (+1/-0)
modules/http-client/json/http-client.xq.src/request_parser.h (+1/-0)
src/api/item.cpp (+4/-3)
src/diagnostics/dict.cpp (+7/-1)
src/system/globalenv.h (+6/-0)
src/unit_tests/test_base64_streambuf.cpp (+9/-0)
src/unit_tests/test_hexbinary_streambuf.cpp (+9/-0)
test/unit/lib_unit_test.cpp (+8/-3)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+201083@code.launchpad.net

Commit message

Misc fixes.

Description of the change

Misc fixes.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/201083

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/201083

Stage "TestZorbaUbuntu" failed.
22 tests failed (8752 total tests run).

Check test results at http://jenkins.lambda.nu:8180/job/TestZorbaUbuntu/429/testReport/ to view the results.

lp:~paul-lucas/zorba/pjl-misc updated
11400. By Paul J. Lucas

Now checking command-line argument count.

11401. By Paul J. Lucas

Now using auto_attach.

11402. By Paul J. Lucas

Work-around for stream bug.

11403. By Paul J. Lucas

Added vim lines.

11404. By Paul J. Lucas

Fixed getObjectValue().

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/201083

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/zorba/item.h'
--- include/zorba/item.h 2013-09-26 07:38:44 +0000
+++ include/zorba/item.h 2014-01-10 02:11:36 +0000
@@ -418,7 +418,7 @@
418 * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON Object).418 * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON Object).
419 */419 */
420 Item420 Item
421 getObjectValue(String aName) const;421 getObjectValue(String const &aName) const;
422422
423 /**423 /**
424 * Checks whether the item's content is streamable.424 * Checks whether the item's content is streamable.
425425
=== modified file 'include/zorba/util/base64_stream.h'
--- include/zorba/util/base64_stream.h 2013-08-05 22:23:16 +0000
+++ include/zorba/util/base64_stream.h 2014-01-10 02:11:36 +0000
@@ -104,7 +104,7 @@
104 std::streamsize xsputn( char_type const*, std::streamsize );104 std::streamsize xsputn( char_type const*, std::streamsize );
105105
106private:106private:
107 std::streambuf *orig_buf_;107 std::streambuf *const orig_buf_;
108108
109 char gbuf_[3];109 char gbuf_[3];
110 char pbuf_[3];110 char pbuf_[3];
@@ -269,11 +269,10 @@
269 * @param stream The stream to attach the base64::streambuf to. If the269 * @param stream The stream to attach the base64::streambuf to. If the
270 * stream already has a base64::streambuf attached to it, this contructor270 * stream already has a base64::streambuf attached to it, this contructor
271 * does nothing.271 * does nothing.
272 * @param charset The name of the character encoding to convert from/to.
273 * @return \c true only if a base64::streambuf was attached.272 * @return \c true only if a base64::streambuf was attached.
274 */273 */
275 bool attach( StreamType &stream, char const *charset ) {274 bool attach( StreamType &stream ) {
276 if ( base64::attach( stream, charset ) ) {275 if ( base64::attach( stream ) ) {
277 stream_ = &stream;276 stream_ = &stream;
278 return true;277 return true;
279 }278 }
@@ -311,6 +310,9 @@
311public:310public:
312 /**311 /**
313 * Constructs a %base64::stream.312 * Constructs a %base64::stream.
313 *
314 * Do not use this constructor when StreamType is std::ostream; see
315 * http://llvm.org/bugs/show_bug.cgi?id=15337
314 */316 */
315 stream() :317 stream() :
316#ifdef WIN32318#ifdef WIN32
317319
=== modified file 'include/zorba/util/hexbinary_stream.h'
--- include/zorba/util/hexbinary_stream.h 2013-08-05 22:23:16 +0000
+++ include/zorba/util/hexbinary_stream.h 2014-01-10 02:11:36 +0000
@@ -94,7 +94,7 @@
94 std::streamsize xsputn( char_type const*, std::streamsize );94 std::streamsize xsputn( char_type const*, std::streamsize );
9595
96private:96private:
97 std::streambuf *orig_buf_;97 std::streambuf *const orig_buf_;
98 char gbuf_[2];98 char gbuf_[2];
9999
100 void clear();100 void clear();
@@ -294,6 +294,9 @@
294public:294public:
295 /**295 /**
296 * Constructs a %hexbinary::stream.296 * Constructs a %hexbinary::stream.
297 *
298 * Do not use this constructor when StreamType is std::ostream; see
299 * http://llvm.org/bugs/show_bug.cgi?id=15337
297 */300 */
298 stream() :301 stream() :
299#ifdef WIN32302#ifdef WIN32
300303
=== modified file 'modules/http-client/json/http-client.xq.src/http_client.cpp'
--- modules/http-client/json/http-client.xq.src/http_client.cpp 2013-09-17 21:12:49 +0000
+++ modules/http-client/json/http-client.xq.src/http_client.cpp 2014-01-10 02:11:36 +0000
@@ -254,3 +254,4 @@
254 return new zorba::http_client::HttpClientModule();254 return new zorba::http_client::HttpClientModule();
255}255}
256256
257/* vim:set et sw=2 ts=2: */
257258
=== modified file 'modules/http-client/json/http-client.xq.src/http_request_handler.cpp'
--- modules/http-client/json/http-client.xq.src/http_request_handler.cpp 2013-08-02 14:55:29 +0000
+++ modules/http-client/json/http-client.xq.src/http_request_handler.cpp 2014-01-10 02:11:36 +0000
@@ -293,13 +293,10 @@
293 void HttpRequestHandler::emitStreamableBase64Binary(Item aItem)293 void HttpRequestHandler::emitStreamableBase64Binary(Item aItem)
294 {294 {
295 std::istream& stream = aItem.getStream();295 std::istream& stream = aItem.getStream();
296 bool lDecoderAttached = false;296 base64::auto_attach<std::istream> b64_aa;
297297
298 if (aItem.isEncoded())298 if (aItem.isEncoded())
299 {299 b64_aa.attach(stream);
300 base64::attach(stream);
301 lDecoderAttached = true;
302 }
303300
304 char buf[1024];301 char buf[1024];
305 while (!stream.eof())302 while (!stream.eof())
@@ -307,9 +304,6 @@
307 stream.read(buf, 1024);304 stream.read(buf, 1024);
308 theSerStream->write(buf, stream.gcount());305 theSerStream->write(buf, stream.gcount());
309 }306 }
310
311 if (lDecoderAttached)
312 base64::detach(stream);
313 }307 }
314308
315 void HttpRequestHandler::emitBase64Binary(Item aItem)309 void HttpRequestHandler::emitBase64Binary(Item aItem)
@@ -329,13 +323,10 @@
329 void HttpRequestHandler::emitStreamableHexBinary(Item aItem)323 void HttpRequestHandler::emitStreamableHexBinary(Item aItem)
330 {324 {
331 std::istream& stream = aItem.getStream();325 std::istream& stream = aItem.getStream();
332 bool lDecoderAttached = false;326 hexbinary::auto_attach<std::istream> hex_aa;
333327
334 if (aItem.isEncoded())328 if (aItem.isEncoded())
335 {329 hex_aa.attach(stream);
336 hexbinary::attach(stream);
337 lDecoderAttached = true;
338 }
339330
340 char buf[1024];331 char buf[1024];
341 while (!stream.eof())332 while (!stream.eof())
@@ -343,9 +334,6 @@
343 stream.read(buf, 1024);334 stream.read(buf, 1024);
344 theSerStream->write(buf, stream.gcount());335 theSerStream->write(buf, stream.gcount());
345 }336 }
346
347 if (lDecoderAttached)
348 hexbinary::detach(stream);
349 }337 }
350338
351 void HttpRequestHandler::emitHexBinary(Item aItem)339 void HttpRequestHandler::emitHexBinary(Item aItem)
352340
=== modified file 'modules/http-client/json/http-client.xq.src/http_request_handler.h'
--- modules/http-client/json/http-client.xq.src/http_request_handler.h 2013-07-19 17:36:52 +0000
+++ modules/http-client/json/http-client.xq.src/http_request_handler.h 2014-01-10 02:11:36 +0000
@@ -117,3 +117,4 @@
117}}117}}
118118
119#endif //HTTP_REQUEST_HANDLER_H119#endif //HTTP_REQUEST_HANDLER_H
120/* vim:set et sw=2 ts=2: */
120121
=== modified file 'modules/http-client/json/http-client.xq.src/http_response_handler.cpp'
--- modules/http-client/json/http-client.xq.src/http_response_handler.cpp 2013-06-14 16:32:01 +0000
+++ modules/http-client/json/http-client.xq.src/http_response_handler.cpp 2014-01-10 02:11:36 +0000
@@ -292,3 +292,4 @@
292 return theResult;292 return theResult;
293 }293 }
294}} //namespace zorba, namespace http_client294}} //namespace zorba, namespace http_client
295/* vim:set et sw=2 ts=2: */
295296
=== modified file 'modules/http-client/json/http-client.xq.src/http_response_handler.h'
--- modules/http-client/json/http-client.xq.src/http_response_handler.h 2013-07-19 17:36:52 +0000
+++ modules/http-client/json/http-client.xq.src/http_response_handler.h 2014-01-10 02:11:36 +0000
@@ -124,3 +124,4 @@
124}} //namespace zorba, namespace http_client124}} //namespace zorba, namespace http_client
125125
126#endif //HTTP_RESPONSE_HANDLER_H126#endif //HTTP_RESPONSE_HANDLER_H
127/* vim:set et sw=2 ts=2: */
127128
=== modified file 'modules/http-client/json/http-client.xq.src/http_response_parser.h'
--- modules/http-client/json/http-client.xq.src/http_response_parser.h 2013-07-19 17:36:52 +0000
+++ modules/http-client/json/http-client.xq.src/http_response_parser.h 2014-01-10 02:11:36 +0000
@@ -91,3 +91,4 @@
91} // namespace zorba91} // namespace zorba
9292
93#endif //HTTP_RESPONSE_PARSER_H93#endif //HTTP_RESPONSE_PARSER_H
94/* vim:set et sw=2 ts=2: */
9495
=== modified file 'modules/http-client/json/http-client.xq.src/inform_data_read.cpp'
--- modules/http-client/json/http-client.xq.src/inform_data_read.cpp 2013-06-14 16:32:01 +0000
+++ modules/http-client/json/http-client.xq.src/inform_data_read.cpp 2014-01-10 02:11:36 +0000
@@ -20,3 +20,4 @@
20 {20 {
21 }21 }
22}} //namespace zorba, http_client22}} //namespace zorba, http_client
23/* vim:set et sw=2 ts=2: */
2324
=== modified file 'modules/http-client/json/http-client.xq.src/inform_data_read.h'
--- modules/http-client/json/http-client.xq.src/inform_data_read.h 2013-06-14 16:32:01 +0000
+++ modules/http-client/json/http-client.xq.src/inform_data_read.h 2014-01-10 02:11:36 +0000
@@ -25,3 +25,4 @@
25 };25 };
26}} //namespace zorba, http_client26}} //namespace zorba, http_client
27#endif //INFORM_DATA_READ_H27#endif //INFORM_DATA_READ_H
28/* vim:set et sw=2 ts=2: */
2829
=== modified file 'modules/http-client/json/http-client.xq.src/request_parser.cpp'
--- modules/http-client/json/http-client.xq.src/request_parser.cpp 2013-09-17 21:12:49 +0000
+++ modules/http-client/json/http-client.xq.src/request_parser.cpp 2014-01-10 02:11:36 +0000
@@ -352,3 +352,4 @@
352352
353}353}
354}354}
355/* vim:set et sw=2 ts=2: */
355356
=== modified file 'modules/http-client/json/http-client.xq.src/request_parser.h'
--- modules/http-client/json/http-client.xq.src/request_parser.h 2013-07-19 17:36:52 +0000
+++ modules/http-client/json/http-client.xq.src/request_parser.h 2014-01-10 02:11:36 +0000
@@ -61,3 +61,4 @@
61} //namespace http_request61} //namespace http_request
6262
63#endif // REQUEST_PARSER_H63#endif // REQUEST_PARSER_H
64/* vim:set et sw=2 ts=2: */
6465
=== modified file 'src/api/item.cpp'
--- src/api/item.cpp 2013-08-01 17:38:35 +0000
+++ src/api/item.cpp 2014-01-10 02:11:36 +0000
@@ -534,14 +534,15 @@
534534
535535
536Item536Item
537Item::getObjectValue(String aName) const537Item::getObjectValue(String const &aName) const
538{538{
539 String lName( aName ); // copy needed because createString() is destructive
539 ITEM_TRY540 ITEM_TRY
540 SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)541 SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)
541 zstring& lName = Unmarshaller::getInternalString(aName);542 zstring& liName = Unmarshaller::getInternalString(lName);
542 543
543 store::Item_t lStringItem;544 store::Item_t lStringItem;
544 GENV_ITEMFACTORY->createString(lStringItem, lName);545 GENV_ITEMFACTORY->createString(lStringItem, liName);
545 546
546 return m_item->getObjectValue(lStringItem).getp();547 return m_item->getObjectValue(lStringItem).getp();
547548
548549
=== modified file 'src/diagnostics/dict.cpp'
--- src/diagnostics/dict.cpp 2013-08-02 18:34:59 +0000
+++ src/diagnostics/dict.cpp 2014-01-10 02:11:36 +0000
@@ -68,9 +68,15 @@
6868
69char const* lookup( char const *key ) {69char const* lookup( char const *key ) {
70 typedef pair<entry const*,entry const*> range_type;70 typedef pair<entry const*,entry const*> range_type;
71 //
72 // It's possible an exception was thrown after shutdown has already started
73 // in which case the GlobalEnvironment no longer exists.
74 //
75 GlobalEnvironment const *const genv = GENV_PTR;
76 iso639_1::type lang = genv ? genv->get_host_lang() : locale::get_host_lang();
7177
72 static entry const *begin, *end;78 static entry const *begin, *end;
73 if ( !begin && !get_dict( GENV.get_host_lang(), &begin, &end ) )79 if ( !begin && !get_dict( lang, &begin, &end ) )
74 SET_DICT( en, begin, end );80 SET_DICT( en, begin, end );
7581
76 entry entry_to_find;82 entry entry_to_find;
7783
=== modified file 'src/system/globalenv.h'
--- src/system/globalenv.h 2013-09-24 09:48:50 +0000
+++ src/system/globalenv.h 2014-01-10 02:11:36 +0000
@@ -102,6 +102,11 @@
102 return *m_globalEnv;102 return *m_globalEnv;
103 }103 }
104104
105 static GlobalEnvironment* getInstancePtr()
106 {
107 return m_globalEnv;
108 }
109
105public:110public:
106 ~GlobalEnvironment();111 ~GlobalEnvironment();
107112
@@ -151,6 +156,7 @@
151156
152157
153#define GENV GlobalEnvironment::getInstance()158#define GENV GlobalEnvironment::getInstance()
159#define GENV_PTR GlobalEnvironment::getInstancePtr()
154160
155#define GENV_TYPESYSTEM GlobalEnvironment::getInstance().getRootTypeManager()161#define GENV_TYPESYSTEM GlobalEnvironment::getInstance().getRootTypeManager()
156162
157163
=== modified file 'src/unit_tests/test_base64_streambuf.cpp'
--- src/unit_tests/test_base64_streambuf.cpp 2013-06-11 23:38:49 +0000
+++ src/unit_tests/test_base64_streambuf.cpp 2014-01-10 02:11:36 +0000
@@ -100,6 +100,13 @@
100 return b64_str == expected_b64_str;100 return b64_str == expected_b64_str;
101}101}
102102
103static void test_instantiate() {
104 base64::auto_attach<ostream> aa_os;
105 (void)aa_os;
106 base64::stream<ostringstream> b64_os;
107 (void)b64_os;
108}
109
103static bool test_put( test const *t ) {110static bool test_put( test const *t ) {
104 ostringstream oss;111 ostringstream oss;
105 { // local scope112 { // local scope
@@ -128,6 +135,8 @@
128namespace UnitTests {135namespace UnitTests {
129136
130int test_base64_streambuf( int, char*[] ) {137int test_base64_streambuf( int, char*[] ) {
138 test_instantiate();
139
131 int test_no = 0;140 int test_no = 0;
132 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {141 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {
133 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );142 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );
134143
=== modified file 'src/unit_tests/test_hexbinary_streambuf.cpp'
--- src/unit_tests/test_hexbinary_streambuf.cpp 2013-06-20 00:53:29 +0000
+++ src/unit_tests/test_hexbinary_streambuf.cpp 2014-01-10 02:11:36 +0000
@@ -100,6 +100,13 @@
100 return hb_str == expected_hb_str;100 return hb_str == expected_hb_str;
101}101}
102102
103static void test_instantiate() {
104 hexbinary::auto_attach<ostream> aa_os;
105 (void)aa_os;
106 hexbinary::stream<ostringstream> hb_os;
107 (void)hb_os;
108}
109
103static bool test_put( test const *t ) {110static bool test_put( test const *t ) {
104 ostringstream oss;111 ostringstream oss;
105 { // local scope112 { // local scope
@@ -126,6 +133,8 @@
126namespace UnitTests {133namespace UnitTests {
127134
128int test_hexbinary_streambuf( int, char*[] ) {135int test_hexbinary_streambuf( int, char*[] ) {
136 test_instantiate();
137
129 int test_no = 0;138 int test_no = 0;
130 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {139 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {
131 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );140 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );
132141
=== modified file 'test/unit/lib_unit_test.cpp'
--- test/unit/lib_unit_test.cpp 2013-06-12 13:19:13 +0000
+++ test/unit/lib_unit_test.cpp 2014-01-10 02:11:36 +0000
@@ -19,15 +19,20 @@
19#include <zorba/store_manager.h>19#include <zorba/store_manager.h>
20#include <zorba/internal/unit_tests.h>20#include <zorba/internal/unit_tests.h>
2121
22using namespace std;
23using namespace zorba;
24
22/**25/**
23 * This is the main entry point for unit tests that require a running26 * This is the main entry point for unit tests that require a running
24 * Zorba instance and execute inside of libzorba.27 * Zorba instance and execute inside of libzorba.
25 */28 */
26
27using namespace zorba;
28
29int main(int argc, char* argv[])29int main(int argc, char* argv[])
30{30{
31 if ( argc != 2 ) {
32 cerr << "usage: " << argv[0] << " test-name" << endl;
33 return 1;
34 }
35
31 void* lStore = zorba::StoreManager::getStore();36 void* lStore = zorba::StoreManager::getStore();
32 Zorba* lZorba = Zorba::getInstance(lStore);37 Zorba* lZorba = Zorba::getInstance(lStore);
3338

Subscribers

People subscribed via source and target branches