Merge lp:~zorba-coders/zorba/zorba-with-file-access into lp:zorba

Proposed by Chris Hillery
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11197
Merged at revision: 11197
Proposed branch: lp:~zorba-coders/zorba/zorba-with-file-access
Merge into: lp:zorba
Diff against target: 274 lines (+46/-12)
10 files modified
bin/zorbacmd.cpp (+12/-2)
bin/zorbacmdproperties_base.h (+11/-1)
src/api/CMakeLists.txt (+5/-1)
src/api/fileimpl.cpp (+3/-3)
src/unit_tests/CMakeLists.txt (+5/-1)
src/unit_tests/unit_test_list.h (+2/-0)
src/unit_tests/unit_tests.cpp (+2/-0)
src/util/file.cpp (+2/-0)
src/util/fs_util.cpp (+4/-0)
src/util/fs_util.h (+0/-4)
To merge this branch: bzr merge lp:~zorba-coders/zorba/zorba-with-file-access
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Chris Hillery Approve
Review via email: mp+144622@code.launchpad.net

Commit message

Fixes to make ZORBA_WITH_FILE_ACCESS=0 work.

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

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

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 zorba-with-file-access-2013-01-24T02-57-12.945Z 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.

Revision history for this message
Matthias Brantner (matthias-brantner) :
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 zorba-with-file-access-2013-01-24T03-57-38.04Z 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
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp 2012-11-06 10:11:37 +0000
+++ bin/zorbacmd.cpp 2013-01-24 02:32:23 +0000
@@ -622,6 +622,7 @@
622void622void
623removeOutputFileIfNeeded(const ZorbaCMDProperties& lProperties)623removeOutputFileIfNeeded(const ZorbaCMDProperties& lProperties)
624{624{
625#ifdef ZORBA_WITH_FILE_ACCESS
625 if (lProperties.outputFile().size() > 0)626 if (lProperties.outputFile().size() > 0)
626 {627 {
627 File_t lFile = zorba::File::createFile(lProperties.outputFile());628 File_t lFile = zorba::File::createFile(lProperties.outputFile());
@@ -630,6 +631,7 @@
630 lFile->remove();631 lFile->remove();
631 }632 }
632 }633 }
634#endif /* ZORBA_WITH_FILE_ACCESS */
633}635}
634636
635637
@@ -963,20 +965,28 @@
963965
964 // write to file or standard out966 // write to file or standard out
965 std::auto_ptr<std::ostream> 967 std::auto_ptr<std::ostream>
966 lFileStream(properties.outputFile().size() > 0 ?968 lFileStream(
967 new std::ofstream(properties.outputFile().c_str()) : 0);969 #ifdef ZORBA_WITH_FILE_ACCESS
970 properties.outputFile().size() > 0 ?
971 new std::ofstream(properties.outputFile().c_str()) : 0
972 #else /* ZORBA_WITH_FILE_ACCESS */
973 0
974 #endif /* ZORBA_WITH_FILE_ACCESS */
975 );
968976
969 std::ostream* lOutputStream = lFileStream.get();977 std::ostream* lOutputStream = lFileStream.get();
970 if ( lOutputStream == 0 )978 if ( lOutputStream == 0 )
971 {979 {
972 lOutputStream = &std::cout;980 lOutputStream = &std::cout;
973 }981 }
982#ifdef ZORBA_WITH_FILE_ACCESS
974 else if ( !lOutputStream->good() )983 else if ( !lOutputStream->good() )
975 {984 {
976 std::cerr << "could not write to output file {" << properties.outputFile()985 std::cerr << "could not write to output file {" << properties.outputFile()
977 << "}" << std::endl;986 << "}" << std::endl;
978 return 2;987 return 2;
979 }988 }
989#endif /* ZORBA_WITH_FILE_ACCESS */
980990
981 if (properties.queriesOrFilesBegin() == properties.queriesOrFilesEnd())991 if (properties.queriesOrFilesBegin() == properties.queriesOrFilesEnd())
982 {992 {
983993
=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h 2012-11-06 10:11:37 +0000
+++ bin/zorbacmdproperties_base.h 2013-01-24 02:32:23 +0000
@@ -32,7 +32,11 @@
32 const char** get_all_options () const32 const char** get_all_options () const
33 {33 {
34 static const char* result [] = {34 static const char* result [] = {
35 "--timing", "--output-file", "--serialization-parameter",35 "--timing",
36#ifdef ZORBA_WITH_FILE_ACCESS
37 "--output-file",
38#endif /* ZORBA_WITH_FILE_ACCESS */
39 "--serialization-parameter",
36 "--serialize-html", "--serialize-text", "--indent", "--print-query",40 "--serialize-html", "--serialize-text", "--indent", "--print-query",
37 "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration",41 "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration",
38 "--base-uri", "--boundary-space", "--default-collation",42 "--base-uri", "--boundary-space", "--default-collation",
@@ -48,7 +52,9 @@
48 }52 }
4953
50 bool theTiming;54 bool theTiming;
55#ifdef ZORBA_WITH_FILE_ACCESS
51 std::string theOutputFile;56 std::string theOutputFile;
57#endif /* ZORBA_WITH_FILE_ACCESS */
52 std::vector<std::string> theSerializationParameter;58 std::vector<std::string> theSerializationParameter;
53 bool theSerializeHtml;59 bool theSerializeHtml;
54 bool theSerializeText;60 bool theSerializeText;
@@ -119,7 +125,9 @@
119125
120public:126public:
121 const bool &timing () const { return theTiming; }127 const bool &timing () const { return theTiming; }
128#ifdef ZORBA_WITH_FILE_ACCESS
122 const std::string &outputFile () const { return theOutputFile; }129 const std::string &outputFile () const { return theOutputFile; }
130#endif /* ZORBA_WITH_FILE_ACCESS */
123 const std::vector<std::string> &serializationParameter () const { return theSerializationParameter; }131 const std::vector<std::string> &serializationParameter () const { return theSerializationParameter; }
124 const bool &serializeHtml () const { return theSerializeHtml; }132 const bool &serializeHtml () const { return theSerializeHtml; }
125 const bool &serializeText () const { return theSerializeText; }133 const bool &serializeText () const { return theSerializeText; }
@@ -177,6 +185,7 @@
177 {185 {
178 theTiming = true;186 theTiming = true;
179 }187 }
188#ifdef ZORBA_WITH_FILE_ACCESS
180 else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0) 189 else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0)
181 {190 {
182 int d = 2;191 int d = 2;
@@ -184,6 +193,7 @@
184 if (*argv == NULL) { result = "No value given for --output-file option"; break; }193 if (*argv == NULL) { result = "No value given for --output-file option"; break; }
185 init_val (*argv, theOutputFile, d);194 init_val (*argv, theOutputFile, d);
186 }195 }
196#endif /* ZORBA_WITH_FILE_ACCESS */
187 else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0) 197 else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0)
188 {198 {
189 int d = 2;199 int d = 2;
190200
=== modified file 'src/api/CMakeLists.txt'
--- src/api/CMakeLists.txt 2012-12-05 03:33:46 +0000
+++ src/api/CMakeLists.txt 2013-01-24 02:32:23 +0000
@@ -46,7 +46,6 @@
46 invoke_item_sequence.cpp46 invoke_item_sequence.cpp
47 item_sequence_chainer.cpp47 item_sequence_chainer.cpp
48 empty_sequence.cpp48 empty_sequence.cpp
49 fileimpl.cpp
50 serializerimpl.cpp49 serializerimpl.cpp
51 base64impl.cpp50 base64impl.cpp
52 base64_streambuf.cpp51 base64_streambuf.cpp
@@ -63,6 +62,11 @@
63 uuid.cpp62 uuid.cpp
64 )63 )
6564
65IF (ZORBA_WITH_FILE_ACCESS)
66 LIST(APPEND API_SRCS
67 fileimpl.cpp)
68ENDIF (ZORBA_WITH_FILE_ACCESS)
69
66IF (NOT ZORBA_NO_FULL_TEXT)70IF (NOT ZORBA_NO_FULL_TEXT)
67 LIST(APPEND API_SRCS71 LIST(APPEND API_SRCS
68 stemmer.cpp72 stemmer.cpp
6973
=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp 2012-09-19 21:16:15 +0000
+++ src/api/fileimpl.cpp 2013-01-24 02:32:23 +0000
@@ -102,7 +102,7 @@
102 ZORBA_CATCH102 ZORBA_CATCH
103103
104 return lResult;104 return lResult;
105};105}
106106
107const std::string107const std::string
108FileImpl::getFileUri() const108FileImpl::getFileUri() const
@@ -136,7 +136,7 @@
136 ZORBA_CATCH136 ZORBA_CATCH
137137
138 return lPath;138 return lPath;
139};139}
140140
141bool141bool
142FileImpl::isDirectory() const142FileImpl::isDirectory() const
@@ -148,7 +148,7 @@
148 ZORBA_CATCH148 ZORBA_CATCH
149149
150 return lResult;150 return lResult;
151};151}
152152
153bool153bool
154FileImpl::isFile() const154FileImpl::isFile() const
155155
=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt 2013-01-08 03:09:24 +0000
+++ src/unit_tests/CMakeLists.txt 2013-01-24 02:32:23 +0000
@@ -16,7 +16,6 @@
16 instantiate_string.cpp16 instantiate_string.cpp
17 test_base64.cpp17 test_base64.cpp
18 test_base64_streambuf.cpp18 test_base64_streambuf.cpp
19 test_fs_iterator.cpp
20 test_hashmaps.cpp19 test_hashmaps.cpp
21 test_json_parser.cpp20 test_json_parser.cpp
22 test_string.cpp21 test_string.cpp
@@ -26,6 +25,11 @@
26 unit_tests.cpp25 unit_tests.cpp
27)26)
2827
28IF (ZORBA_WITH_FILE_ACCESS)
29 LIST (APPEND UNIT_TEST_SRCS
30 test_fs_iterator.cpp)
31ENDIF (ZORBA_WITH_FILE_ACCESS)
32
29IF (NOT ZORBA_NO_FULL_TEXT)33IF (NOT ZORBA_NO_FULL_TEXT)
30 LIST (APPEND UNIT_TEST_SRCS34 LIST (APPEND UNIT_TEST_SRCS
31 test_stemmer.cpp35 test_stemmer.cpp
3236
=== modified file 'src/unit_tests/unit_test_list.h'
--- src/unit_tests/unit_test_list.h 2013-01-04 16:08:03 +0000
+++ src/unit_tests/unit_test_list.h 2013-01-24 02:32:23 +0000
@@ -45,7 +45,9 @@
4545
46 int test_unique_ptr( int, char*[] );46 int test_unique_ptr( int, char*[] );
4747
48#ifdef ZORBA_WITH_FILE_ACCESS
48 int test_fs_iterator( int, char*[] );49 int test_fs_iterator( int, char*[] );
50#endif /* ZORBA_WITH_FILE_ACCESS */
4951
50#ifndef ZORBA_NO_FULL_TEXT52#ifndef ZORBA_NO_FULL_TEXT
51 int test_stemmer( int, char*[] );53 int test_stemmer( int, char*[] );
5254
=== modified file 'src/unit_tests/unit_tests.cpp'
--- src/unit_tests/unit_tests.cpp 2013-01-04 16:08:03 +0000
+++ src/unit_tests/unit_tests.cpp 2013-01-24 02:32:23 +0000
@@ -41,7 +41,9 @@
4141
42 libunittests["base64_streambuf"] = test_base64_streambuf;42 libunittests["base64_streambuf"] = test_base64_streambuf;
4343
44#ifdef ZORBA_WITH_FILE_ACCESS
44 libunittests["fs_iterator"] = test_fs_iterator;45 libunittests["fs_iterator"] = test_fs_iterator;
46#endif /* ZORBA_WITH_FILE_ACCESS */
4547
46#ifndef ZORBA_NO_ICU48#ifndef ZORBA_NO_ICU
47 libunittests["icu_streambuf"] = test_icu_streambuf;49 libunittests["icu_streambuf"] = test_icu_streambuf;
4850
=== modified file 'src/util/file.cpp'
--- src/util/file.cpp 2012-09-19 21:16:15 +0000
+++ src/util/file.cpp 2013-01-24 02:32:23 +0000
@@ -317,6 +317,7 @@
317 remove( ignore );317 remove( ignore );
318}318}
319319
320#ifdef ZORBA_WITH_FILE_ACCESS
320#ifndef _WIN32_WCE321#ifndef _WIN32_WCE
321void file::chdir() {322void file::chdir() {
322 if ( is_directory() ) {323 if ( is_directory() ) {
@@ -329,6 +330,7 @@
329 }330 }
330}331}
331#endif332#endif
333#endif /* ZORBA_WITH_FILE_ACCESS */
332334
333void file::rename( std::string const& newpath ) {335void file::rename( std::string const& newpath ) {
334#ifdef ZORBA_WITH_FILE_ACCESS336#ifdef ZORBA_WITH_FILE_ACCESS
335337
=== modified file 'src/util/fs_util.cpp'
--- src/util/fs_util.cpp 2012-09-19 21:16:15 +0000
+++ src/util/fs_util.cpp 2013-01-24 02:32:23 +0000
@@ -273,6 +273,8 @@
273#endif /* WIN32 */273#endif /* WIN32 */
274}274}
275275
276#endif /* ZORBA_WITH_FILE_ACCESS */
277
276type get_type( char const *path, size_type *size ) {278type get_type( char const *path, size_type *size ) {
277#ifndef WIN32279#ifndef WIN32
278 struct stat st_buf;280 struct stat st_buf;
@@ -295,6 +297,8 @@
295#endif /* WIN32 */297#endif /* WIN32 */
296}298}
297299
300#ifdef ZORBA_WITH_FILE_ACCESS
301
298void mkdir( char const *path ) {302void mkdir( char const *path ) {
299#ifndef WIN32303#ifndef WIN32
300 if ( ::mkdir( path, 0755 ) != 0 )304 if ( ::mkdir( path, 0755 ) != 0 )
301305
=== modified file 'src/util/fs_util.h'
--- src/util/fs_util.h 2012-11-25 16:03:48 +0000
+++ src/util/fs_util.h 2013-01-24 02:32:23 +0000
@@ -496,8 +496,6 @@
496 return base_name( path.c_str() );496 return base_name( path.c_str() );
497}497}
498498
499#ifdef ZORBA_WITH_FILE_ACCESS
500
501/**499/**
502 * Gets the type of the given file.500 * Gets the type of the given file.
503 *501 *
@@ -525,8 +523,6 @@
525 return get_type( path.c_str(), size );523 return get_type( path.c_str(), size );
526}524}
527525
528#endif /* ZORBA_WITH_FILE_ACCESS */
529
530/**526/**
531 * Checks whether the given path is an absolute path.527 * Checks whether the given path is an absolute path.
532 *528 *

Subscribers

People subscribed via source and target branches