| 148 | |
| 149 | |
| 150 | void |
| 151 | OSOReaderQuery::parameter_done () |
| 152 | { |
| 153 | if (m_reading_param && m_query.nparams() > 0) { |
| 154 | // Make sure all value defaults have the right number of elements in |
| 155 | // case they were only partially initialized. |
| 156 | OSLQuery::Parameter &p (m_query.m_params.back()); |
| 157 | int nvalues; |
| 158 | if (p.varlenarray) |
| 159 | nvalues = m_default_values; |
| 160 | else |
| 161 | nvalues = p.type.numelements() * p.type.aggregate; |
| 162 | if (p.type.basetype == TypeDesc::INT) { |
| 163 | p.idefault.resize (nvalues, 0); |
| 164 | p.data = &p.idefault[0]; |
| 165 | } |
| 166 | else if (p.type.basetype == TypeDesc::FLOAT) { |
| 167 | p.fdefault.resize (nvalues, 0); |
| 168 | p.data = &p.fdefault[0]; |
| 169 | } |
| 170 | else if (p.type.basetype == TypeDesc::STRING) { |
| 171 | p.sdefault.resize (nvalues, ustring()); |
| 172 | p.data = &p.sdefault[0]; |
| 173 | } |
| 174 | if (p.spacename.size()) |
| 175 | p.spacename.resize (p.type.numelements(), ustring()); |
| 176 | } |
| 177 | |
| 178 | m_reading_param = false; |
| 179 | } |
| 180 | |
| 181 | |
| 182 |
nothing calls this directly
no test coverage detected