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
1=== modified file 'bin/zorbacmd.cpp'
2--- bin/zorbacmd.cpp 2012-11-06 10:11:37 +0000
3+++ bin/zorbacmd.cpp 2013-01-24 02:32:23 +0000
4@@ -622,6 +622,7 @@
5 void
6 removeOutputFileIfNeeded(const ZorbaCMDProperties& lProperties)
7 {
8+#ifdef ZORBA_WITH_FILE_ACCESS
9 if (lProperties.outputFile().size() > 0)
10 {
11 File_t lFile = zorba::File::createFile(lProperties.outputFile());
12@@ -630,6 +631,7 @@
13 lFile->remove();
14 }
15 }
16+#endif /* ZORBA_WITH_FILE_ACCESS */
17 }
18
19
20@@ -963,20 +965,28 @@
21
22 // write to file or standard out
23 std::auto_ptr<std::ostream>
24- lFileStream(properties.outputFile().size() > 0 ?
25- new std::ofstream(properties.outputFile().c_str()) : 0);
26+ lFileStream(
27+ #ifdef ZORBA_WITH_FILE_ACCESS
28+ properties.outputFile().size() > 0 ?
29+ new std::ofstream(properties.outputFile().c_str()) : 0
30+ #else /* ZORBA_WITH_FILE_ACCESS */
31+ 0
32+ #endif /* ZORBA_WITH_FILE_ACCESS */
33+ );
34
35 std::ostream* lOutputStream = lFileStream.get();
36 if ( lOutputStream == 0 )
37 {
38 lOutputStream = &std::cout;
39 }
40+#ifdef ZORBA_WITH_FILE_ACCESS
41 else if ( !lOutputStream->good() )
42 {
43 std::cerr << "could not write to output file {" << properties.outputFile()
44 << "}" << std::endl;
45 return 2;
46 }
47+#endif /* ZORBA_WITH_FILE_ACCESS */
48
49 if (properties.queriesOrFilesBegin() == properties.queriesOrFilesEnd())
50 {
51
52=== modified file 'bin/zorbacmdproperties_base.h'
53--- bin/zorbacmdproperties_base.h 2012-11-06 10:11:37 +0000
54+++ bin/zorbacmdproperties_base.h 2013-01-24 02:32:23 +0000
55@@ -32,7 +32,11 @@
56 const char** get_all_options () const
57 {
58 static const char* result [] = {
59- "--timing", "--output-file", "--serialization-parameter",
60+ "--timing",
61+#ifdef ZORBA_WITH_FILE_ACCESS
62+ "--output-file",
63+#endif /* ZORBA_WITH_FILE_ACCESS */
64+ "--serialization-parameter",
65 "--serialize-html", "--serialize-text", "--indent", "--print-query",
66 "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration",
67 "--base-uri", "--boundary-space", "--default-collation",
68@@ -48,7 +52,9 @@
69 }
70
71 bool theTiming;
72+#ifdef ZORBA_WITH_FILE_ACCESS
73 std::string theOutputFile;
74+#endif /* ZORBA_WITH_FILE_ACCESS */
75 std::vector<std::string> theSerializationParameter;
76 bool theSerializeHtml;
77 bool theSerializeText;
78@@ -119,7 +125,9 @@
79
80 public:
81 const bool &timing () const { return theTiming; }
82+#ifdef ZORBA_WITH_FILE_ACCESS
83 const std::string &outputFile () const { return theOutputFile; }
84+#endif /* ZORBA_WITH_FILE_ACCESS */
85 const std::vector<std::string> &serializationParameter () const { return theSerializationParameter; }
86 const bool &serializeHtml () const { return theSerializeHtml; }
87 const bool &serializeText () const { return theSerializeText; }
88@@ -177,6 +185,7 @@
89 {
90 theTiming = true;
91 }
92+#ifdef ZORBA_WITH_FILE_ACCESS
93 else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0)
94 {
95 int d = 2;
96@@ -184,6 +193,7 @@
97 if (*argv == NULL) { result = "No value given for --output-file option"; break; }
98 init_val (*argv, theOutputFile, d);
99 }
100+#endif /* ZORBA_WITH_FILE_ACCESS */
101 else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0)
102 {
103 int d = 2;
104
105=== modified file 'src/api/CMakeLists.txt'
106--- src/api/CMakeLists.txt 2012-12-05 03:33:46 +0000
107+++ src/api/CMakeLists.txt 2013-01-24 02:32:23 +0000
108@@ -46,7 +46,6 @@
109 invoke_item_sequence.cpp
110 item_sequence_chainer.cpp
111 empty_sequence.cpp
112- fileimpl.cpp
113 serializerimpl.cpp
114 base64impl.cpp
115 base64_streambuf.cpp
116@@ -63,6 +62,11 @@
117 uuid.cpp
118 )
119
120+IF (ZORBA_WITH_FILE_ACCESS)
121+ LIST(APPEND API_SRCS
122+ fileimpl.cpp)
123+ENDIF (ZORBA_WITH_FILE_ACCESS)
124+
125 IF (NOT ZORBA_NO_FULL_TEXT)
126 LIST(APPEND API_SRCS
127 stemmer.cpp
128
129=== modified file 'src/api/fileimpl.cpp'
130--- src/api/fileimpl.cpp 2012-09-19 21:16:15 +0000
131+++ src/api/fileimpl.cpp 2013-01-24 02:32:23 +0000
132@@ -102,7 +102,7 @@
133 ZORBA_CATCH
134
135 return lResult;
136-};
137+}
138
139 const std::string
140 FileImpl::getFileUri() const
141@@ -136,7 +136,7 @@
142 ZORBA_CATCH
143
144 return lPath;
145-};
146+}
147
148 bool
149 FileImpl::isDirectory() const
150@@ -148,7 +148,7 @@
151 ZORBA_CATCH
152
153 return lResult;
154-};
155+}
156
157 bool
158 FileImpl::isFile() const
159
160=== modified file 'src/unit_tests/CMakeLists.txt'
161--- src/unit_tests/CMakeLists.txt 2013-01-08 03:09:24 +0000
162+++ src/unit_tests/CMakeLists.txt 2013-01-24 02:32:23 +0000
163@@ -16,7 +16,6 @@
164 instantiate_string.cpp
165 test_base64.cpp
166 test_base64_streambuf.cpp
167- test_fs_iterator.cpp
168 test_hashmaps.cpp
169 test_json_parser.cpp
170 test_string.cpp
171@@ -26,6 +25,11 @@
172 unit_tests.cpp
173 )
174
175+IF (ZORBA_WITH_FILE_ACCESS)
176+ LIST (APPEND UNIT_TEST_SRCS
177+ test_fs_iterator.cpp)
178+ENDIF (ZORBA_WITH_FILE_ACCESS)
179+
180 IF (NOT ZORBA_NO_FULL_TEXT)
181 LIST (APPEND UNIT_TEST_SRCS
182 test_stemmer.cpp
183
184=== modified file 'src/unit_tests/unit_test_list.h'
185--- src/unit_tests/unit_test_list.h 2013-01-04 16:08:03 +0000
186+++ src/unit_tests/unit_test_list.h 2013-01-24 02:32:23 +0000
187@@ -45,7 +45,9 @@
188
189 int test_unique_ptr( int, char*[] );
190
191+#ifdef ZORBA_WITH_FILE_ACCESS
192 int test_fs_iterator( int, char*[] );
193+#endif /* ZORBA_WITH_FILE_ACCESS */
194
195 #ifndef ZORBA_NO_FULL_TEXT
196 int test_stemmer( int, char*[] );
197
198=== modified file 'src/unit_tests/unit_tests.cpp'
199--- src/unit_tests/unit_tests.cpp 2013-01-04 16:08:03 +0000
200+++ src/unit_tests/unit_tests.cpp 2013-01-24 02:32:23 +0000
201@@ -41,7 +41,9 @@
202
203 libunittests["base64_streambuf"] = test_base64_streambuf;
204
205+#ifdef ZORBA_WITH_FILE_ACCESS
206 libunittests["fs_iterator"] = test_fs_iterator;
207+#endif /* ZORBA_WITH_FILE_ACCESS */
208
209 #ifndef ZORBA_NO_ICU
210 libunittests["icu_streambuf"] = test_icu_streambuf;
211
212=== modified file 'src/util/file.cpp'
213--- src/util/file.cpp 2012-09-19 21:16:15 +0000
214+++ src/util/file.cpp 2013-01-24 02:32:23 +0000
215@@ -317,6 +317,7 @@
216 remove( ignore );
217 }
218
219+#ifdef ZORBA_WITH_FILE_ACCESS
220 #ifndef _WIN32_WCE
221 void file::chdir() {
222 if ( is_directory() ) {
223@@ -329,6 +330,7 @@
224 }
225 }
226 #endif
227+#endif /* ZORBA_WITH_FILE_ACCESS */
228
229 void file::rename( std::string const& newpath ) {
230 #ifdef ZORBA_WITH_FILE_ACCESS
231
232=== modified file 'src/util/fs_util.cpp'
233--- src/util/fs_util.cpp 2012-09-19 21:16:15 +0000
234+++ src/util/fs_util.cpp 2013-01-24 02:32:23 +0000
235@@ -273,6 +273,8 @@
236 #endif /* WIN32 */
237 }
238
239+#endif /* ZORBA_WITH_FILE_ACCESS */
240+
241 type get_type( char const *path, size_type *size ) {
242 #ifndef WIN32
243 struct stat st_buf;
244@@ -295,6 +297,8 @@
245 #endif /* WIN32 */
246 }
247
248+#ifdef ZORBA_WITH_FILE_ACCESS
249+
250 void mkdir( char const *path ) {
251 #ifndef WIN32
252 if ( ::mkdir( path, 0755 ) != 0 )
253
254=== modified file 'src/util/fs_util.h'
255--- src/util/fs_util.h 2012-11-25 16:03:48 +0000
256+++ src/util/fs_util.h 2013-01-24 02:32:23 +0000
257@@ -496,8 +496,6 @@
258 return base_name( path.c_str() );
259 }
260
261-#ifdef ZORBA_WITH_FILE_ACCESS
262-
263 /**
264 * Gets the type of the given file.
265 *
266@@ -525,8 +523,6 @@
267 return get_type( path.c_str(), size );
268 }
269
270-#endif /* ZORBA_WITH_FILE_ACCESS */
271-
272 /**
273 * Checks whether the given path is an absolute path.
274 *

Subscribers

People subscribed via source and target branches