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
1=== modified file 'include/zorba/item.h'
2--- include/zorba/item.h 2013-09-26 07:38:44 +0000
3+++ include/zorba/item.h 2014-01-10 02:11:36 +0000
4@@ -418,7 +418,7 @@
5 * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON Object).
6 */
7 Item
8- getObjectValue(String aName) const;
9+ getObjectValue(String const &aName) const;
10
11 /**
12 * Checks whether the item's content is streamable.
13
14=== modified file 'include/zorba/util/base64_stream.h'
15--- include/zorba/util/base64_stream.h 2013-08-05 22:23:16 +0000
16+++ include/zorba/util/base64_stream.h 2014-01-10 02:11:36 +0000
17@@ -104,7 +104,7 @@
18 std::streamsize xsputn( char_type const*, std::streamsize );
19
20 private:
21- std::streambuf *orig_buf_;
22+ std::streambuf *const orig_buf_;
23
24 char gbuf_[3];
25 char pbuf_[3];
26@@ -269,11 +269,10 @@
27 * @param stream The stream to attach the base64::streambuf to. If the
28 * stream already has a base64::streambuf attached to it, this contructor
29 * does nothing.
30- * @param charset The name of the character encoding to convert from/to.
31 * @return \c true only if a base64::streambuf was attached.
32 */
33- bool attach( StreamType &stream, char const *charset ) {
34- if ( base64::attach( stream, charset ) ) {
35+ bool attach( StreamType &stream ) {
36+ if ( base64::attach( stream ) ) {
37 stream_ = &stream;
38 return true;
39 }
40@@ -311,6 +310,9 @@
41 public:
42 /**
43 * Constructs a %base64::stream.
44+ *
45+ * Do not use this constructor when StreamType is std::ostream; see
46+ * http://llvm.org/bugs/show_bug.cgi?id=15337
47 */
48 stream() :
49 #ifdef WIN32
50
51=== modified file 'include/zorba/util/hexbinary_stream.h'
52--- include/zorba/util/hexbinary_stream.h 2013-08-05 22:23:16 +0000
53+++ include/zorba/util/hexbinary_stream.h 2014-01-10 02:11:36 +0000
54@@ -94,7 +94,7 @@
55 std::streamsize xsputn( char_type const*, std::streamsize );
56
57 private:
58- std::streambuf *orig_buf_;
59+ std::streambuf *const orig_buf_;
60 char gbuf_[2];
61
62 void clear();
63@@ -294,6 +294,9 @@
64 public:
65 /**
66 * Constructs a %hexbinary::stream.
67+ *
68+ * Do not use this constructor when StreamType is std::ostream; see
69+ * http://llvm.org/bugs/show_bug.cgi?id=15337
70 */
71 stream() :
72 #ifdef WIN32
73
74=== modified file 'modules/http-client/json/http-client.xq.src/http_client.cpp'
75--- modules/http-client/json/http-client.xq.src/http_client.cpp 2013-09-17 21:12:49 +0000
76+++ modules/http-client/json/http-client.xq.src/http_client.cpp 2014-01-10 02:11:36 +0000
77@@ -254,3 +254,4 @@
78 return new zorba::http_client::HttpClientModule();
79 }
80
81+/* vim:set et sw=2 ts=2: */
82
83=== modified file 'modules/http-client/json/http-client.xq.src/http_request_handler.cpp'
84--- modules/http-client/json/http-client.xq.src/http_request_handler.cpp 2013-08-02 14:55:29 +0000
85+++ modules/http-client/json/http-client.xq.src/http_request_handler.cpp 2014-01-10 02:11:36 +0000
86@@ -293,13 +293,10 @@
87 void HttpRequestHandler::emitStreamableBase64Binary(Item aItem)
88 {
89 std::istream& stream = aItem.getStream();
90- bool lDecoderAttached = false;
91+ base64::auto_attach<std::istream> b64_aa;
92
93 if (aItem.isEncoded())
94- {
95- base64::attach(stream);
96- lDecoderAttached = true;
97- }
98+ b64_aa.attach(stream);
99
100 char buf[1024];
101 while (!stream.eof())
102@@ -307,9 +304,6 @@
103 stream.read(buf, 1024);
104 theSerStream->write(buf, stream.gcount());
105 }
106-
107- if (lDecoderAttached)
108- base64::detach(stream);
109 }
110
111 void HttpRequestHandler::emitBase64Binary(Item aItem)
112@@ -329,13 +323,10 @@
113 void HttpRequestHandler::emitStreamableHexBinary(Item aItem)
114 {
115 std::istream& stream = aItem.getStream();
116- bool lDecoderAttached = false;
117+ hexbinary::auto_attach<std::istream> hex_aa;
118
119 if (aItem.isEncoded())
120- {
121- hexbinary::attach(stream);
122- lDecoderAttached = true;
123- }
124+ hex_aa.attach(stream);
125
126 char buf[1024];
127 while (!stream.eof())
128@@ -343,9 +334,6 @@
129 stream.read(buf, 1024);
130 theSerStream->write(buf, stream.gcount());
131 }
132-
133- if (lDecoderAttached)
134- hexbinary::detach(stream);
135 }
136
137 void HttpRequestHandler::emitHexBinary(Item aItem)
138
139=== modified file 'modules/http-client/json/http-client.xq.src/http_request_handler.h'
140--- modules/http-client/json/http-client.xq.src/http_request_handler.h 2013-07-19 17:36:52 +0000
141+++ modules/http-client/json/http-client.xq.src/http_request_handler.h 2014-01-10 02:11:36 +0000
142@@ -117,3 +117,4 @@
143 }}
144
145 #endif //HTTP_REQUEST_HANDLER_H
146+/* vim:set et sw=2 ts=2: */
147
148=== modified file 'modules/http-client/json/http-client.xq.src/http_response_handler.cpp'
149--- modules/http-client/json/http-client.xq.src/http_response_handler.cpp 2013-06-14 16:32:01 +0000
150+++ modules/http-client/json/http-client.xq.src/http_response_handler.cpp 2014-01-10 02:11:36 +0000
151@@ -292,3 +292,4 @@
152 return theResult;
153 }
154 }} //namespace zorba, namespace http_client
155+/* vim:set et sw=2 ts=2: */
156
157=== modified file 'modules/http-client/json/http-client.xq.src/http_response_handler.h'
158--- modules/http-client/json/http-client.xq.src/http_response_handler.h 2013-07-19 17:36:52 +0000
159+++ modules/http-client/json/http-client.xq.src/http_response_handler.h 2014-01-10 02:11:36 +0000
160@@ -124,3 +124,4 @@
161 }} //namespace zorba, namespace http_client
162
163 #endif //HTTP_RESPONSE_HANDLER_H
164+/* vim:set et sw=2 ts=2: */
165
166=== modified file 'modules/http-client/json/http-client.xq.src/http_response_parser.h'
167--- modules/http-client/json/http-client.xq.src/http_response_parser.h 2013-07-19 17:36:52 +0000
168+++ modules/http-client/json/http-client.xq.src/http_response_parser.h 2014-01-10 02:11:36 +0000
169@@ -91,3 +91,4 @@
170 } // namespace zorba
171
172 #endif //HTTP_RESPONSE_PARSER_H
173+/* vim:set et sw=2 ts=2: */
174
175=== modified file 'modules/http-client/json/http-client.xq.src/inform_data_read.cpp'
176--- modules/http-client/json/http-client.xq.src/inform_data_read.cpp 2013-06-14 16:32:01 +0000
177+++ modules/http-client/json/http-client.xq.src/inform_data_read.cpp 2014-01-10 02:11:36 +0000
178@@ -20,3 +20,4 @@
179 {
180 }
181 }} //namespace zorba, http_client
182+/* vim:set et sw=2 ts=2: */
183
184=== modified file 'modules/http-client/json/http-client.xq.src/inform_data_read.h'
185--- modules/http-client/json/http-client.xq.src/inform_data_read.h 2013-06-14 16:32:01 +0000
186+++ modules/http-client/json/http-client.xq.src/inform_data_read.h 2014-01-10 02:11:36 +0000
187@@ -25,3 +25,4 @@
188 };
189 }} //namespace zorba, http_client
190 #endif //INFORM_DATA_READ_H
191+/* vim:set et sw=2 ts=2: */
192
193=== modified file 'modules/http-client/json/http-client.xq.src/request_parser.cpp'
194--- modules/http-client/json/http-client.xq.src/request_parser.cpp 2013-09-17 21:12:49 +0000
195+++ modules/http-client/json/http-client.xq.src/request_parser.cpp 2014-01-10 02:11:36 +0000
196@@ -352,3 +352,4 @@
197
198 }
199 }
200+/* vim:set et sw=2 ts=2: */
201
202=== modified file 'modules/http-client/json/http-client.xq.src/request_parser.h'
203--- modules/http-client/json/http-client.xq.src/request_parser.h 2013-07-19 17:36:52 +0000
204+++ modules/http-client/json/http-client.xq.src/request_parser.h 2014-01-10 02:11:36 +0000
205@@ -61,3 +61,4 @@
206 } //namespace http_request
207
208 #endif // REQUEST_PARSER_H
209+/* vim:set et sw=2 ts=2: */
210
211=== modified file 'src/api/item.cpp'
212--- src/api/item.cpp 2013-08-01 17:38:35 +0000
213+++ src/api/item.cpp 2014-01-10 02:11:36 +0000
214@@ -534,14 +534,15 @@
215
216
217 Item
218-Item::getObjectValue(String aName) const
219+Item::getObjectValue(String const &aName) const
220 {
221+ String lName( aName ); // copy needed because createString() is destructive
222 ITEM_TRY
223 SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)
224- zstring& lName = Unmarshaller::getInternalString(aName);
225+ zstring& liName = Unmarshaller::getInternalString(lName);
226
227 store::Item_t lStringItem;
228- GENV_ITEMFACTORY->createString(lStringItem, lName);
229+ GENV_ITEMFACTORY->createString(lStringItem, liName);
230
231 return m_item->getObjectValue(lStringItem).getp();
232
233
234=== modified file 'src/diagnostics/dict.cpp'
235--- src/diagnostics/dict.cpp 2013-08-02 18:34:59 +0000
236+++ src/diagnostics/dict.cpp 2014-01-10 02:11:36 +0000
237@@ -68,9 +68,15 @@
238
239 char const* lookup( char const *key ) {
240 typedef pair<entry const*,entry const*> range_type;
241+ //
242+ // It's possible an exception was thrown after shutdown has already started
243+ // in which case the GlobalEnvironment no longer exists.
244+ //
245+ GlobalEnvironment const *const genv = GENV_PTR;
246+ iso639_1::type lang = genv ? genv->get_host_lang() : locale::get_host_lang();
247
248 static entry const *begin, *end;
249- if ( !begin && !get_dict( GENV.get_host_lang(), &begin, &end ) )
250+ if ( !begin && !get_dict( lang, &begin, &end ) )
251 SET_DICT( en, begin, end );
252
253 entry entry_to_find;
254
255=== modified file 'src/system/globalenv.h'
256--- src/system/globalenv.h 2013-09-24 09:48:50 +0000
257+++ src/system/globalenv.h 2014-01-10 02:11:36 +0000
258@@ -102,6 +102,11 @@
259 return *m_globalEnv;
260 }
261
262+ static GlobalEnvironment* getInstancePtr()
263+ {
264+ return m_globalEnv;
265+ }
266+
267 public:
268 ~GlobalEnvironment();
269
270@@ -151,6 +156,7 @@
271
272
273 #define GENV GlobalEnvironment::getInstance()
274+#define GENV_PTR GlobalEnvironment::getInstancePtr()
275
276 #define GENV_TYPESYSTEM GlobalEnvironment::getInstance().getRootTypeManager()
277
278
279=== modified file 'src/unit_tests/test_base64_streambuf.cpp'
280--- src/unit_tests/test_base64_streambuf.cpp 2013-06-11 23:38:49 +0000
281+++ src/unit_tests/test_base64_streambuf.cpp 2014-01-10 02:11:36 +0000
282@@ -100,6 +100,13 @@
283 return b64_str == expected_b64_str;
284 }
285
286+static void test_instantiate() {
287+ base64::auto_attach<ostream> aa_os;
288+ (void)aa_os;
289+ base64::stream<ostringstream> b64_os;
290+ (void)b64_os;
291+}
292+
293 static bool test_put( test const *t ) {
294 ostringstream oss;
295 { // local scope
296@@ -128,6 +135,8 @@
297 namespace UnitTests {
298
299 int test_base64_streambuf( int, char*[] ) {
300+ test_instantiate();
301+
302 int test_no = 0;
303 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {
304 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );
305
306=== modified file 'src/unit_tests/test_hexbinary_streambuf.cpp'
307--- src/unit_tests/test_hexbinary_streambuf.cpp 2013-06-20 00:53:29 +0000
308+++ src/unit_tests/test_hexbinary_streambuf.cpp 2014-01-10 02:11:36 +0000
309@@ -100,6 +100,13 @@
310 return hb_str == expected_hb_str;
311 }
312
313+static void test_instantiate() {
314+ hexbinary::auto_attach<ostream> aa_os;
315+ (void)aa_os;
316+ hexbinary::stream<ostringstream> hb_os;
317+ (void)hb_os;
318+}
319+
320 static bool test_put( test const *t ) {
321 ostringstream oss;
322 { // local scope
323@@ -126,6 +133,8 @@
324 namespace UnitTests {
325
326 int test_hexbinary_streambuf( int, char*[] ) {
327+ test_instantiate();
328+
329 int test_no = 0;
330 for ( test const *t = tests; t->raw_str; ++t, ++test_no ) {
331 ASSERT_TRUE_AND_NO_EXCEPTION( test_no, test_getline( t ) );
332
333=== modified file 'test/unit/lib_unit_test.cpp'
334--- test/unit/lib_unit_test.cpp 2013-06-12 13:19:13 +0000
335+++ test/unit/lib_unit_test.cpp 2014-01-10 02:11:36 +0000
336@@ -19,15 +19,20 @@
337 #include <zorba/store_manager.h>
338 #include <zorba/internal/unit_tests.h>
339
340+using namespace std;
341+using namespace zorba;
342+
343 /**
344 * This is the main entry point for unit tests that require a running
345 * Zorba instance and execute inside of libzorba.
346 */
347-
348-using namespace zorba;
349-
350 int main(int argc, char* argv[])
351 {
352+ if ( argc != 2 ) {
353+ cerr << "usage: " << argv[0] << " test-name" << endl;
354+ return 1;
355+ }
356+
357 void* lStore = zorba::StoreManager::getStore();
358 Zorba* lZorba = Zorba::getInstance(lStore);
359

Subscribers

People subscribed via source and target branches