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

Proposed by Matthias Brantner
Status: Merged
Approved by: Paul J. Lucas
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 Approve
Matthias Brantner Approve
Review via email: mp+155267@code.launchpad.net

Commit message

fix crash on mac

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
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
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

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

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 msb-misc-2013-03-25T19-16-44.495Z is finished. The final status was:

All tests succeeded!

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

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
=== modified file 'src/compiler/api/compiler_api.cpp'
--- src/compiler/api/compiler_api.cpp 2013-03-24 20:40:03 +0000
+++ src/compiler/api/compiler_api.cpp 2013-03-25 17:34:24 +0000
@@ -128,18 +128,19 @@
128********************************************************************************/128********************************************************************************/
129bool XQueryCompiler::getLanguageMode(std::stringstream& s) const129bool XQueryCompiler::getLanguageMode(std::stringstream& s) const
130{130{
131 char lPeek[6];131 const size_t lPeekSize = 7;
132 s.get(lPeek, 7, ' ');132 char lPeek[lPeekSize];
133 s.get(lPeek, lPeekSize);
133 s.clear();134 s.clear();
134 s.seekg(0, s.beg);135 s.seekg(0, s.beg);
135136
136 bool lXQueryMode;137 bool lXQueryMode;
137138
138 if (strncmp(lPeek, "jsoniq", 6) == 0)139 if (strncmp(lPeek, "jsoniq", lPeekSize - 1) == 0)
139 {140 {
140 lXQueryMode = false;141 lXQueryMode = false;
141 }142 }
142 else if (strncmp(lPeek, "xquery", 6) == 0)143 else if (strncmp(lPeek, "xquery", lPeekSize - 1) == 0)
143 {144 {
144 lXQueryMode = true;145 lXQueryMode = true;
145 }146 }

Subscribers

People subscribed via source and target branches