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

Proposed by Paul J. Lucas
Status: Merged
Approved by: Chris Hillery
Approved revision: 11024
Merged at revision: 11164
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 574 lines (+128/-55)
22 files modified
ChangeLog (+4/-4)
include/zorba/internal/streambuf.h (+3/-0)
include/zorba/transcode_stream.h (+1/-8)
modules/com/zorba-xquery/www/modules/http-client.xq.src/http_response_parser.cpp (+5/-3)
modules/org/expath/ns/file.xq.src/file.cpp (+2/-1)
src/api/base64_streambuf.cpp (+8/-3)
src/api/transcode_streambuf.cpp (+2/-1)
src/unit_tests/CMakeLists.txt (+1/-4)
src/unit_tests/memory_manager.cpp (+14/-9)
src/unit_tests/test_base64.cpp (+4/-2)
src/unit_tests/test_base64_streambuf.cpp (+2/-1)
src/unit_tests/test_icu_streambuf.cpp (+4/-1)
src/unit_tests/test_json_parser.cpp (+2/-1)
src/unit_tests/test_string.cpp (+2/-1)
src/unit_tests/test_unordered_map.cpp (+2/-1)
src/util/icu_streambuf.cpp (+5/-5)
src/util/icu_streambuf.h (+3/-3)
src/util/mem_streambuf.cpp (+1/-1)
src/util/oseparator.h (+8/-0)
src/util/passthru_streambuf.cpp (+2/-1)
src/util/transcode_streambuf.h (+1/-0)
src/zorbautils/locale.h (+52/-5)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Paul J. Lucas Approve
Review via email: mp+142005@code.launchpad.net

Commit message

1. Improved catch() for unit tests.
2. Improved bpackfail() for streambufs.
3. locale template function additions.
4. Enhanced aton().

Description of the change

1. Improved catch() for unit tests.
2. Improved bpackfail() for streambufs.
3. locale template function additions.
4. Enhanced aton().

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job pjl-misc-2013-01-05T08-12-46.857Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

Validation queue job pjl-misc-2013-01-05T11-06-49.728Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Pending.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job pjl-misc-2013-01-07T03-14-55.494Z is finished. The
  final status was:

  3 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

Validation queue job pjl-misc-2013-01-07T14-55-05.371Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 1 Pending.

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-01-08T02-10-51.679Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-01-03 20:25:05 +0000
3+++ ChangeLog 2013-01-07 14:51:39 +0000
4@@ -5,8 +5,8 @@
5
6 New Features:
7 * (bug #1039284) Implemented jn:json-doc().
8- * (bug #867363) Added http-uri-resolution feature to disable HTTP
9- when resolving URIs.
10+ * (bug #867363) Added http-uri-resolution feature to disable HTTP when
11+ resolving URIs.
12 * Can now specify jsoniq-strip-top-level-array option to parse-json() to
13 strip the top-level array from JSON streams.
14 * New info-extraction module for querying concepts and entities in
15@@ -44,8 +44,8 @@
16 * Fixed bug #1021492 (while computeing the "sources" of a prolog var, skip
17 any var-setting exprs that appear in non-used (and non-optimized) functions).
18 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)
19- * Fixed bug #992304 (Compiling library modules could load data from
20- wrong source)
21+ * Fixed bug #992304 (Compiling library modules could load data from wrong
22+ source)
23 * Fixed bugs related to casting to user-defined types.
24
25
26
27=== modified file 'include/zorba/internal/streambuf.h'
28--- include/zorba/internal/streambuf.h 2012-06-15 17:01:01 +0000
29+++ include/zorba/internal/streambuf.h 2013-01-07 14:51:39 +0000
30@@ -20,12 +20,15 @@
31 #include <streambuf>
32
33 #include <zorba/config.h>
34+#include <zorba/internal/proxy.h>
35
36 namespace zorba {
37 namespace internal {
38
39 ///////////////////////////////////////////////////////////////////////////////
40
41+typedef ztd::proxy<std::streambuf> proxy_streambuf;
42+
43 ZORBA_DLL_PUBLIC
44 void dealloc_streambuf( std::streambuf* );
45
46
47=== modified file 'include/zorba/transcode_stream.h'
48--- include/zorba/transcode_stream.h 2012-09-19 21:16:15 +0000
49+++ include/zorba/transcode_stream.h 2013-01-07 14:51:39 +0000
50@@ -17,18 +17,11 @@
51 #ifndef ZORBA_TRANSCODE_STREAM_API_H
52 #define ZORBA_TRANSCODE_STREAM_API_H
53
54-#include <stdexcept>
55-#include <streambuf>
56-
57 #include <zorba/config.h>
58-#include <zorba/internal/proxy.h>
59 #include <zorba/internal/streambuf.h>
60 #include <zorba/internal/unique_ptr.h>
61
62 namespace zorba {
63-
64-typedef internal::ztd::proxy<std::streambuf> proxy_streambuf;
65-
66 namespace transcode {
67
68 ///////////////////////////////////////////////////////////////////////////////
69@@ -108,7 +101,7 @@
70 std::streamsize xsputn( char_type const*, std::streamsize );
71
72 private:
73- std::unique_ptr<proxy_streambuf> proxy_buf_;
74+ std::unique_ptr<internal::proxy_streambuf> proxy_buf_;
75
76 // forbid
77 streambuf( streambuf const& );
78
79=== modified file 'modules/com/zorba-xquery/www/modules/http-client.xq.src/http_response_parser.cpp'
80--- modules/com/zorba-xquery/www/modules/http-client.xq.src/http_response_parser.cpp 2012-09-19 21:16:15 +0000
81+++ modules/com/zorba-xquery/www/modules/http-client.xq.src/http_response_parser.cpp 2013-01-07 14:51:39 +0000
82@@ -13,11 +13,13 @@
83 * See the License for the specific language governing permissions and
84 * limitations under the License.
85 */
86+
87+#include <cassert>
88 #include <cstring>
89+#include <iostream>
90+#include <sstream>
91+#include <stdexcept>
92 #include <string>
93-#include <sstream>
94-#include <assert.h>
95-#include <iostream>
96
97 #include <zorba/base64.h>
98 #include <zorba/config.h>
99
100=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
101--- modules/org/expath/ns/file.xq.src/file.cpp 2012-09-19 21:16:15 +0000
102+++ modules/org/expath/ns/file.xq.src/file.cpp 2013-01-07 14:51:39 +0000
103@@ -16,9 +16,10 @@
104
105 #include "file.h"
106
107+#include <fstream>
108 #include <memory>
109-#include <fstream>
110 #include <sstream>
111+#include <stdexcept>
112
113 #include <zorba/base64.h>
114 #include <zorba/empty_sequence.h>
115
116=== modified file 'src/api/base64_streambuf.cpp'
117--- src/api/base64_streambuf.cpp 2012-06-15 23:02:52 +0000
118+++ src/api/base64_streambuf.cpp 2013-01-07 14:51:39 +0000
119@@ -110,9 +110,14 @@
120 }
121
122 streambuf::int_type streambuf::pbackfail( int_type c ) {
123- if ( gptr() > eback() )
124- gbump( -1 );
125- return orig_buf_->sputbackc( traits_type::to_char_type( c ) );
126+ if ( !traits_type::eq_int_type( c, traits_type::eof() ) &&
127+ gptr() > eback() ) {
128+ c = orig_buf_->sputbackc( traits_type::to_char_type( c ) );
129+ if ( !traits_type::eq_int_type( c, traits_type::eof() ) )
130+ gbump( -1 );
131+ return c;
132+ }
133+ return traits_type::eof();
134 }
135
136 streambuf::int_type streambuf::underflow() {
137
138=== modified file 'src/api/transcode_streambuf.cpp'
139--- src/api/transcode_streambuf.cpp 2012-09-19 21:16:15 +0000
140+++ src/api/transcode_streambuf.cpp 2013-01-07 14:51:39 +0000
141@@ -66,7 +66,8 @@
142 }
143
144 streambuf::int_type streambuf::pbackfail( int_type c ) {
145- return proxy_buf_->sputbackc( traits_type::to_char_type( c ) );
146+ return traits_type::eq_int_type( c, traits_type::eof() ) ?
147+ c : proxy_buf_->sputbackc( traits_type::to_char_type( c ) );
148 }
149
150 streambuf::int_type streambuf::uflow() {
151
152=== modified file 'src/unit_tests/CMakeLists.txt'
153--- src/unit_tests/CMakeLists.txt 2012-11-12 21:17:32 +0000
154+++ src/unit_tests/CMakeLists.txt 2013-01-07 14:51:39 +0000
155@@ -17,15 +17,12 @@
156 test_base64.cpp
157 test_base64_streambuf.cpp
158 test_fs_iterator.cpp
159+ test_hashmaps.cpp
160 test_json_parser.cpp
161 test_string.cpp
162 test_uri.cpp
163 test_uuid.cpp
164 unit_tests.cpp
165- test_uri.cpp
166- test_json_parser.cpp
167- test_fs_iterator.cpp
168- test_hashmaps.cpp
169 )
170
171 IF (NOT ZORBA_NO_FULL_TEXT)
172
173=== modified file 'src/unit_tests/memory_manager.cpp'
174--- src/unit_tests/memory_manager.cpp 2012-09-19 21:16:15 +0000
175+++ src/unit_tests/memory_manager.cpp 2013-01-07 14:51:39 +0000
176@@ -30,7 +30,7 @@
177 }
178
179 static void print_exception( char const *expr, char const *testName,
180- std::exception const &e ) {
181+ std::exception const &e ) {
182 std::cout << "FAILED " << testName << ": exception: " << e.what() <<
183 std::endl;
184 ++failures;
185@@ -40,19 +40,19 @@
186
187 #define ASSERT_EXCEPTION( EXPR, EXCEPTION ) \
188 try { EXPR; assert_true( #EXPR, testName, false); } \
189- catch (EXCEPTION const& ) { } \
190- catch ( std::exception const &e ){ print_exception( #EXPR, testName, e ); } \
191+ catch ( EXCEPTION const& ) { } \
192+ catch ( std::exception const &e ) { print_exception( #EXPR, testName, e ); } \
193 catch ( ... ) { assert_true ( #EXPR, testName, false ); }
194
195 #define ASSERT_NO_EXCEPTION( EXPR ) \
196- try {EXPR; } \
197- catch ( std::exception const &e ){ print_exception( #EXPR, testName, e ); } \
198+ try { EXPR; } \
199+ catch ( std::exception const &e ) { print_exception( #EXPR, testName, e ); } \
200 catch ( ... ) { assert_true (#EXPR, testName, false ); }
201
202 #define ASSERT_TRUE_AND_NO_EXCEPTION( EXPR ) \
203 try { ASSERT_TRUE ( EXPR ); } \
204 catch ( std::exception const &e ) { print_exception( #EXPR, testName, e ); } \
205- catch ( ... ) {assert_true( #EXPR, testName, false ); }
206+ catch ( ... ) { assert_true( #EXPR, testName, false ); }
207
208 #define TEST( TESTNAME ) \
209 static void TESTNAME () { \
210@@ -177,9 +177,11 @@
211 ASSERT_TRUE(hugePage == mem);
212 END_TEST
213
214-namespace zorba { namespace UnitTests{
215-
216 ///////////////////////////////////////////////////////////////////////////////
217+
218+namespace zorba {
219+namespace UnitTests {
220+
221 int test_mem_manager( int, char*[] )
222 {
223 PageCreationAllocatesMemoryDeletionFreesIt();
224@@ -201,4 +203,7 @@
225 return failures ? 1 : 0;
226 }
227
228-}} //namespace zorba::UnitTests
229+} // namespace UnitTests
230+} // namespace zorba
231+
232+/* vim:set et sw=2 ts=2: */
233
234=== modified file 'src/unit_tests/test_base64.cpp'
235--- src/unit_tests/test_base64.cpp 2012-09-19 21:16:15 +0000
236+++ src/unit_tests/test_base64.cpp 2013-01-07 14:51:39 +0000
237@@ -53,11 +53,13 @@
238
239 #define ASSERT_NO_EXCEPTION( NO, EXPR ) \
240 try { EXPR; } \
241- catch ( std::exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); }
242+ catch ( exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); } \
243+ catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
244
245 #define ASSERT_EXCEPTION( NO, EXPR, EXCEPTION ) \
246 try { EXPR; assert_true( NO, #EXPR, __LINE__, false ); } \
247- catch ( EXCEPTION const& ) { }
248+ catch ( EXCEPTION const& ) { } \
249+ catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
250
251 ///////////////////////////////////////////////////////////////////////////////}
252
253
254=== modified file 'src/unit_tests/test_base64_streambuf.cpp'
255--- src/unit_tests/test_base64_streambuf.cpp 2012-06-15 17:01:01 +0000
256+++ src/unit_tests/test_base64_streambuf.cpp 2013-01-07 14:51:39 +0000
257@@ -51,7 +51,8 @@
258
259 #define ASSERT_TRUE_AND_NO_EXCEPTION( NO, EXPR ) \
260 try { ASSERT_TRUE( NO, EXPR ); } \
261- catch ( std::exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); }
262+ catch ( exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); } \
263+ catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
264
265 ///////////////////////////////////////////////////////////////////////////////
266
267
268=== modified file 'src/unit_tests/test_icu_streambuf.cpp'
269--- src/unit_tests/test_icu_streambuf.cpp 2012-09-19 21:16:15 +0000
270+++ src/unit_tests/test_icu_streambuf.cpp 2013-01-07 14:51:39 +0000
271@@ -15,9 +15,11 @@
272 */
273
274 #include "stdafx.h"
275+
276 #include <fstream>
277 #include <iostream>
278 #include <sstream>
279+#include <string>
280
281 #include "util/transcode_streambuf.h"
282
283@@ -71,7 +73,8 @@
284
285 #define ASSERT_TRUE_AND_NO_EXCEPTION( NO, EXPR ) \
286 try { ASSERT_TRUE( NO, EXPR ); } \
287- catch ( std::exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); }
288+ catch ( exception const &e ) { print_exception( NO, #EXPR, __LINE__, e ); } \
289+ catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
290
291 ///////////////////////////////////////////////////////////////////////////////
292
293
294=== modified file 'src/unit_tests/test_json_parser.cpp'
295--- src/unit_tests/test_json_parser.cpp 2012-09-19 21:16:15 +0000
296+++ src/unit_tests/test_json_parser.cpp 2013-01-07 14:51:39 +0000
297@@ -55,7 +55,8 @@
298
299 #define ASSERT_EXCEPTION( EXPR, EXCEPTION ) \
300 try { EXPR; assert_true( #EXPR, __LINE__, false ); } \
301- catch ( EXCEPTION const& ) { }
302+ catch ( EXCEPTION const& ) { } \
303+ catch ( ... ) { assert_true( #EXPR, __LINE__, false ); }
304
305 #define ASSERT_NO_EXCEPTION( EXPR ) \
306 try { EXPR; } \
307
308=== modified file 'src/unit_tests/test_string.cpp'
309--- src/unit_tests/test_string.cpp 2012-09-19 21:16:15 +0000
310+++ src/unit_tests/test_string.cpp 2013-01-07 14:51:39 +0000
311@@ -82,7 +82,8 @@
312
313 #define ASSERT_EXCEPTION( EXPR, EXCEPTION ) \
314 try { EXPR; assert_true( #EXPR, __LINE__, false ); } \
315- catch ( EXCEPTION const& ) { }
316+ catch ( EXCEPTION const& ) { } \
317+ catch ( ... ) { assert_true( #EXPR, __LINE__, false ); }
318
319 #define ASSERT_NO_EXCEPTION( EXPR ) \
320 try { EXPR; } \
321
322=== modified file 'src/unit_tests/test_unordered_map.cpp'
323--- src/unit_tests/test_unordered_map.cpp 2012-12-05 02:14:31 +0000
324+++ src/unit_tests/test_unordered_map.cpp 2013-01-07 14:51:39 +0000
325@@ -53,7 +53,8 @@
326
327 #define ASSERT_EXCEPTION( EXPR, EXCEPTION ) \
328 try { EXPR; assert_true( #EXPR, __LINE__, false ); } \
329- catch ( EXCEPTION const& ) { }
330+ catch ( EXCEPTION const& ) { } \
331+ catch ( ... ) { assert_true( #EXPR, __LINE__, false ); }
332
333 ///////////////////////////////////////////////////////////////////////////////
334
335
336=== modified file 'src/util/icu_streambuf.cpp'
337--- src/util/icu_streambuf.cpp 2012-09-19 21:16:15 +0000
338+++ src/util/icu_streambuf.cpp 2013-01-07 14:51:39 +0000
339@@ -58,7 +58,7 @@
340 }
341
342 icu_streambuf::icu_streambuf( char const *charset, streambuf *orig ) :
343- proxy_streambuf( orig ),
344+ internal::proxy_streambuf( orig ),
345 no_conv_( !is_necessary( charset ) ),
346 external_conv_( no_conv_ ? nullptr : create_conv( charset ) ),
347 utf8_conv_( no_conv_ ? nullptr : create_conv( "UTF-8" ) )
348@@ -151,7 +151,7 @@
349 }
350
351 icu_streambuf::int_type icu_streambuf::overflow( int_type c ) {
352-#if ZORBA_DEBUG_ICU_STREAMBUF
353+#ifdef ZORBA_DEBUG_ICU_STREAMBUF
354 printf( "overflow()\n" );
355 #endif
356 if ( no_conv_ )
357@@ -233,7 +233,7 @@
358 #endif /* GCC_PRAGMA_DIAGNOSTIC_PUSH */
359
360 icu_streambuf::int_type icu_streambuf::underflow() {
361-#if ZORBA_DEBUG_ICU_STREAMBUF
362+#ifdef ZORBA_DEBUG_ICU_STREAMBUF
363 printf( "underflow()\n" );
364 #endif
365 if ( no_conv_ )
366@@ -263,7 +263,7 @@
367 }
368
369 streamsize icu_streambuf::xsgetn( char_type *to, streamsize size ) {
370-#if ZORBA_DEBUG_ICU_STREAMBUF
371+#ifdef ZORBA_DEBUG_ICU_STREAMBUF
372 printf( "xsgetn()\n" );
373 #endif
374 if ( no_conv_ )
375@@ -301,7 +301,7 @@
376 }
377
378 streamsize icu_streambuf::xsputn( char_type const *from, streamsize size ) {
379-#if ZORBA_DEBUG_ICU_STREAMBUF
380+#ifdef ZORBA_DEBUG_ICU_STREAMBUF
381 printf( "xsputn()\n" );
382 #endif
383 if ( no_conv_ )
384
385=== modified file 'src/util/icu_streambuf.h'
386--- src/util/icu_streambuf.h 2012-09-19 21:16:15 +0000
387+++ src/util/icu_streambuf.h 2013-01-07 14:51:39 +0000
388@@ -18,7 +18,7 @@
389 #define ZORBA_ICU_STREAMBUF_H
390
391 #include <unicode/ucnv.h>
392-#include <zorba/transcode_stream.h>
393+#include <zorba/internal/streambuf.h>
394
395 #include "util/utf8_util.h"
396
397@@ -38,7 +38,7 @@
398 * is.ios::rdbuf( &xbuf );
399 * \endcode
400 * Note that the %icu_streambuf must exist for as long as it's being used by
401- * the stream. If you are replacing the streabuf for a stream you did not
402+ * the stream. If you are replacing the streambuf for a stream you did not
403 * create, you should set it back to the original streambuf:
404 * \code
405 * void f( ostream &os ) {
406@@ -58,7 +58,7 @@
407 * While %icu_streambuf does support seeking, the positions are relative to the
408 * original byte stream.
409 */
410-class icu_streambuf : public proxy_streambuf {
411+class icu_streambuf : public internal::proxy_streambuf {
412 public:
413 /**
414 * Constructs an %icu_streambuf.
415
416=== modified file 'src/util/mem_streambuf.cpp'
417--- src/util/mem_streambuf.cpp 2012-09-19 21:16:15 +0000
418+++ src/util/mem_streambuf.cpp 2013-01-07 14:51:39 +0000
419@@ -52,7 +52,7 @@
420
421 mem_streambuf::int_type mem_streambuf::pbackfail( int_type c ) {
422 if ( !traits_type::eq_int_type( c, traits_type::eof() ) ) {
423- *pptr() = traits_type::to_int_type( c );
424+ *pptr() = traits_type::to_char_type( c );
425 pbump( -1 );
426 }
427 return traits_type::to_int_type( *pptr() );
428
429=== modified file 'src/util/oseparator.h'
430--- src/util/oseparator.h 2012-09-19 21:16:15 +0000
431+++ src/util/oseparator.h 2013-01-07 14:51:39 +0000
432@@ -40,6 +40,14 @@
433 }
434
435 /**
436+ * Constructs an %oseparator.
437+ *
438+ * @param sep The separator character.
439+ */
440+ explicit oseparator( char sep ) : sep_( 1, sep ), print_( false ) {
441+ }
442+
443+ /**
444 * Gets the printing state of this %oseparator.
445 *
446 * @return Returns \c true only if this %oseparator is currently printing.
447
448=== modified file 'src/util/passthru_streambuf.cpp'
449--- src/util/passthru_streambuf.cpp 2012-09-19 21:16:15 +0000
450+++ src/util/passthru_streambuf.cpp 2013-01-07 14:51:39 +0000
451@@ -84,7 +84,8 @@
452 }
453
454 passthru_streambuf::int_type passthru_streambuf::pbackfail( int_type c ) {
455- return original()->sputbackc( traits_type::to_char_type( c ) );
456+ return traits_type::eq_int_type( c, traits_type::eof() ) ?
457+ c : proxy_buf_->sputbackc( traits_type::to_char_type( c ) );
458 }
459
460 passthru_streambuf::int_type passthru_streambuf::uflow() {
461
462=== modified file 'src/util/transcode_streambuf.h'
463--- src/util/transcode_streambuf.h 2012-09-19 21:16:15 +0000
464+++ src/util/transcode_streambuf.h 2013-01-07 14:51:39 +0000
465@@ -18,6 +18,7 @@
466 #define ZORBA_TRANSCODE_STREAMBUF_H
467
468 #include <zorba/config.h>
469+#include <zorba/transcode_stream.h>
470
471 ///////////////////////////////////////////////////////////////////////////////
472
473
474=== modified file 'src/zorbautils/locale.h'
475--- src/zorbautils/locale.h 2012-09-19 21:16:15 +0000
476+++ src/zorbautils/locale.h 2013-01-07 14:51:39 +0000
477@@ -21,6 +21,7 @@
478
479 #include <zorba/locale.h>
480
481+#include "util/string_util.h"
482 namespace zorba {
483 namespace locale {
484
485@@ -297,7 +298,19 @@
486 * @return Returns said enumeration or \c unknown.
487 */
488 type find( char const *country );
489- }
490+
491+ //
492+ // Template version of find().
493+ //
494+ template<class StringType> inline
495+ typename std::enable_if<
496+ ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
497+ type
498+ >::type
499+ find( StringType const &country ) {
500+ return find( country.c_str() );
501+ }
502+ } // namespace iso3166_1
503
504 ///////////////////////////////////////////////////////////////////////////
505
506@@ -322,7 +335,19 @@
507 * @return Returns said enumeration or \c unknown.
508 */
509 type find( char const *lang );
510- }
511+
512+ //
513+ // Template version of find().
514+ //
515+ template<class StringType> inline
516+ typename std::enable_if<
517+ ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
518+ type
519+ >::type
520+ find( StringType const &lang ) {
521+ return find( lang.c_str() );
522+ }
523+ } // namespace iso639_1
524
525 ///////////////////////////////////////////////////////////////////////////
526
527@@ -474,7 +499,19 @@
528 * @return Returns said enumeration or \c unknown.
529 */
530 type find( char const *lang );
531- }
532+
533+ //
534+ // Template version of find().
535+ //
536+ template<class StringType> inline
537+ typename std::enable_if<
538+ ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
539+ type
540+ >::type
541+ find( StringType const &lang ) {
542+ return find( lang.c_str() );
543+ }
544+ } // namespace iso639_2
545
546 ///////////////////////////////////////////////////////////////////////////
547
548@@ -486,6 +523,18 @@
549 */
550 iso639_1::type find_lang( char const *lang );
551
552+ //
553+ // Template version of find_lang().
554+ //
555+ template<class StringType> inline
556+ typename std::enable_if<
557+ ztd::has_c_str<StringType,char const* (StringType::*)() const>::value,
558+ iso639_1::type
559+ >::type
560+ find_lang( StringType const &lang ) {
561+ return find_lang( lang.c_str() );
562+ }
563+
564 /**
565 * Gets the ISO 3166-1 country code enumeration for the host system.
566 *
567@@ -505,7 +554,5 @@
568 } // namespace locale
569 } // namespace zorba
570
571-#undef DEF_OSTREAM_INSERT_OPERATOR
572-
573 #endif /* ZORBA_CORE_LOCALE_H */
574 /* vim:set et sw=2 ts=2: */

Subscribers

People subscribed via source and target branches