ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.xs
(Generate patch)

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.27 by root, Thu Apr 19 13:18:31 2012 UTC vs.
Revision 1.29 by root, Thu Apr 19 13:51:36 2012 UTC

144 return 0; 144 return 0;
145 145
146 if (SvROK (sv) && SvTYPE (SvRV (sv)) == SVt_PVAV) 146 if (SvROK (sv) && SvTYPE (SvRV (sv)) == SVt_PVAV)
147 { 147 {
148 AV *av = (AV *)SvRV (sv); 148 AV *av = (AV *)SvRV (sv);
149 int i, len = av_len (av); 149 int i, len = av_len (av) + 1;
150 cl_context_properties *p = tmpbuf (sizeof (cl_context_properties) * (len + extracount + 1)); 150 cl_context_properties *p = tmpbuf (sizeof (cl_context_properties) * (len + extracount + 1));
151 cl_context_properties *l = p; 151 cl_context_properties *l = p;
152 152
153 if (len & 1) 153 if (len & 1)
154 croak ("%s: %s is not a property list (must be even number of elements)", func, svname); 154 croak ("%s: %s is not a property list (must be even number of elements)", func, svname);
156 while (extracount--) 156 while (extracount--)
157 *l++ = *extra++; 157 *l++ = *extra++;
158 158
159 for (i = 0; i < len; i += 2) 159 for (i = 0; i < len; i += 2)
160 { 160 {
161 cl_context_properties t = SvIV (*av_fetch (av, i, 0)); 161 cl_context_properties t = SvIV (*av_fetch (av, i , 0));
162 SV *p_sv = *av_fetch (av, i + 1, 0);
162 cl_context_properties v; 163 cl_context_properties v;
163 164
164 switch (t) 165 switch (t)
165 { 166 {
166 default: 167 default:
167 /* unknown property, treat as int */ 168 /* unknown property, treat as int */
168 v = SvIV (*av_fetch (av, i, 0)); 169 v = SvIV (p_sv);
169 break; 170 break;
170 } 171 }
171 172
172 *l++ = t; 173 *l++ = t;
173 *l++ = v; 174 *l++ = v;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines