Merge lp:~zorba-coders/zorba/bug-1070722 into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Sorin Marian Nasoi
Approved revision: 11123
Merged at revision: 11124
Proposed branch: lp:~zorba-coders/zorba/bug-1070722
Merge into: lp:zorba
Diff against target: 102 lines (+31/-31)
1 file modified
src/types/casting.cpp (+31/-31)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1070722
Reviewer Review Type Date Requested Status
Sorin Marian Nasoi Approve
Markos Zaharioudakis Approve
Review via email: mp+133492@code.launchpad.net

Commit message

Fixing typo in the casting code which leads to a crash (confusion between type and code).

Description of the change

Fixing typo in the casting code which leads to a crash (confusion between type and code).

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

Validation queue job bug-1070722-2012-11-08T14-57-42.185Z 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: 2 Approve, 1 Pending.

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
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 bug-1070722-2012-11-08T15-48-44.053Z 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 'src/types/casting.cpp'
2--- src/types/casting.cpp 2012-10-08 12:09:36 +0000
3+++ src/types/casting.cpp 2012-11-08 14:46:49 +0000
4@@ -2206,7 +2206,7 @@
5 bool GenericCast::castToAtomic(
6 store::Item_t& result,
7 store::Item_t& item,
8- store::SchemaTypeCode targetType,
9+ store::SchemaTypeCode targetTypeCode,
10 const TypeManager* tm,
11 namespace_context* nsCtx,
12 const QueryLoc& loc)
13@@ -2214,43 +2214,43 @@
14 store::ItemFactory* factory = GENV_ITEMFACTORY;
15 zstring sourceString;
16
17- store::SchemaTypeCode sourceType = item->getTypeCode();
18+ store::SchemaTypeCode sourceTypeCode = item->getTypeCode();
19
20- if (sourceType == targetType)
21+ if (sourceTypeCode == targetTypeCode)
22 {
23 result.transfer(item);
24 return true;
25 }
26
27- ErrorInfo errorInfo(sourceType, targetType, loc);
28-
29- if (targetType == store::XS_NOTATION ||
30- targetType == store::XS_ANY_ATOMIC)
31- {
32- RAISE_ERROR(err::XPST0080, loc, ERROR_PARAMS(*errorInfo.theTargetType));
33- }
34-
35- if (sourceType == store::XS_ANY_ATOMIC)
36- {
37- throwTypeException(err::XPTY0004, errorInfo);
38- }
39-
40- if (targetType == store::XS_NCNAME &&
41- sourceType != store::XS_STRING &&
42- sourceType != store::XS_NCNAME &&
43- sourceType != store::XS_UNTYPED_ATOMIC)
44- {
45- throwTypeException(err::XPTY0004, errorInfo);
46- }
47-
48- CastFunc castFunc = theCastMatrix[theMapping[sourceType]]
49- [theMapping[targetType]];
50+ ErrorInfo errorInfo(sourceTypeCode, targetTypeCode, loc);
51+
52+ if (targetTypeCode == store::XS_NOTATION ||
53+ targetTypeCode == store::XS_ANY_ATOMIC)
54+ {
55+ RAISE_ERROR(err::XPST0080, loc, ERROR_PARAMS(errorInfo.theTargetTypeCode));
56+ }
57+
58+ if (sourceTypeCode == store::XS_ANY_ATOMIC)
59+ {
60+ throwTypeException(err::XPTY0004, errorInfo);
61+ }
62+
63+ if (targetTypeCode == store::XS_NCNAME &&
64+ sourceTypeCode != store::XS_STRING &&
65+ sourceTypeCode != store::XS_NCNAME &&
66+ sourceTypeCode != store::XS_UNTYPED_ATOMIC)
67+ {
68+ throwTypeException(err::XPTY0004, errorInfo);
69+ }
70+
71+ CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
72+ [theMapping[targetTypeCode]];
73 if (castFunc == 0)
74 {
75 throwTypeException(err::XPTY0004, errorInfo);
76 }
77
78- if (theMapping[sourceType] == theMapping[store::XS_STRING])
79+ if (theMapping[sourceTypeCode] == theMapping[store::XS_STRING])
80 {
81 item->getStringValue2(sourceString);
82 }
83@@ -2262,15 +2262,15 @@
84 nsCtx,
85 errorInfo);
86
87- DownCastFunc downCastFunc = theDownCastMatrix[theMapping[targetType]];
88+ DownCastFunc downCastFunc = theDownCastMatrix[theMapping[targetTypeCode]];
89
90 if (downCastFunc != 0 &&
91- targetType != store::XS_STRING &&
92- targetType != store::XS_INTEGER)
93+ targetTypeCode != store::XS_STRING &&
94+ targetTypeCode != store::XS_INTEGER)
95 {
96 valid = (*downCastFunc)(result,
97 &*result,
98- targetType,
99+ targetTypeCode,
100 factory,
101 errorInfo);
102 }

Subscribers

People subscribed via source and target branches