Merge lp:~zorba-coders/zorba/msb-misc into lp:zorba

Proposed by Matthias Brantner on 2013-03-25
Status: Merged
Approved by: Paul J. Lucas on 2013-03-25
Approved revision: no longer in the source branch.
Merged at revision: 11313
Proposed branch: lp:~zorba-coders/zorba/msb-misc
Merge into: lp:zorba
Diff against target: 27 lines (+5/-4)
1 file modified
src/compiler/api/compiler_api.cpp (+5/-4)
To merge this branch: bzr merge lp:~zorba-coders/zorba/msb-misc
Reviewer Review Type Date Requested Status
Paul J. Lucas 2013-03-25 Approve on 2013-03-25
Matthias Brantner Approve on 2013-03-25
Review via email: mp+155267@code.launchpad.net

Commit message

fix crash on mac

To post a comment you must log in.
review: Approve
Paul J. Lucas (paul-lucas) wrote :

You should use the 2-argument form of get(). What if the whitespace is a tab?

    xquery\t

is perfectly legal.

review: Needs Fixing
Paul J. Lucas (paul-lucas) wrote :

Approve with objections. Patch does NOT account for leading whitespace or comments.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job msb-misc-2013-03-25T19-16-44.495Z is finished. The final status was:

All tests succeeded!

lp:~zorba-coders/zorba/msb-misc updated on 2013-03-25
11313. By [u'Matthias Brantner <matthias.brantner@28msec.com>'] on 2013-03-25

fix crash on mac Approved: Paul J. Lucas, Matthias Brantner

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/compiler/api/compiler_api.cpp'
2--- src/compiler/api/compiler_api.cpp 2013-03-24 20:40:03 +0000
3+++ src/compiler/api/compiler_api.cpp 2013-03-25 17:34:24 +0000
4@@ -128,18 +128,19 @@
5 ********************************************************************************/
6 bool XQueryCompiler::getLanguageMode(std::stringstream& s) const
7 {
8- char lPeek[6];
9- s.get(lPeek, 7, ' ');
10+ const size_t lPeekSize = 7;
11+ char lPeek[lPeekSize];
12+ s.get(lPeek, lPeekSize);
13 s.clear();
14 s.seekg(0, s.beg);
15
16 bool lXQueryMode;
17
18- if (strncmp(lPeek, "jsoniq", 6) == 0)
19+ if (strncmp(lPeek, "jsoniq", lPeekSize - 1) == 0)
20 {
21 lXQueryMode = false;
22 }
23- else if (strncmp(lPeek, "xquery", 6) == 0)
24+ else if (strncmp(lPeek, "xquery", lPeekSize - 1) == 0)
25 {
26 lXQueryMode = true;
27 }

Subscribers

People subscribed via source and target branches