MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / dump

Method dump

src/common/classes/SafeArg.cpp:265–306  ·  view source on GitHub ↗

Dump the parameters to the target buffer. Note that parameters of type pointer (void*) and counted_string may crash the caller if not prepared to handle them. Therefore, counted_string is being converted to null pointer and void* to TEXT*. Supposedly, the caller has information on the real types of the values. This can be done with a loop using getCount() and getCell() and looking at the safe_cell

Source from the content-addressed store, hash-verified

263// information on the real types of the values. This can be done with a loop
264// using getCount() and getCell() and looking at the safe_cell's type data member.
265void SafeArg::dump(const TEXT* target[], FB_SIZE_T v_size) const
266{
267 for (FB_SIZE_T i = 0; i < v_size; ++i)
268 {
269 if (i >= m_count)
270 {
271 target[i] = 0;
272 continue;
273 }
274
275 switch (m_arguments[i].type)
276 {
277 case safe_cell::at_char:
278 target[i] = reinterpret_cast<TEXT*>((IPTR) m_arguments[i].c_value);
279 break;
280 case safe_cell::at_uchar:
281 target[i] = reinterpret_cast<TEXT*>((U_IPTR) m_arguments[i].c_value);
282 break;
283 case safe_cell::at_int64:
284 target[i] = reinterpret_cast<TEXT*>((IPTR) m_arguments[i].i_value);
285 break;
286 case safe_cell::at_uint64:
287 target[i] = reinterpret_cast<TEXT*>((U_IPTR) m_arguments[i].i_value);
288 break;
289 case safe_cell::at_int128:
290 target[i] = reinterpret_cast<TEXT*>((IPTR) m_arguments[i].i128_value.high);
291 break;
292 case safe_cell::at_double:
293 target[i] = reinterpret_cast<TEXT*>((IPTR) m_arguments[i].d_value);
294 break;
295 case safe_cell::at_str:
296 target[i] = m_arguments[i].st_value.s_string;
297 break;
298 case safe_cell::at_ptr:
299 target[i] = static_cast<TEXT*>(m_arguments[i].p_value);
300 break;
301 default: // safe_cell::at_none and whatever out of range.
302 target[i] = 0;
303 break;
304 }
305 }
306}
307
308// Get one specific cell. If out of range, a cell with invalid type (at_none)
309// is returned.

Callers 1

fb_msg_formatFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected