diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llmessage/llsdmessagebuilder.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llmessage/llsdmessagebuilder.cpp')
-rwxr-xr-x | linden/indra/llmessage/llsdmessagebuilder.cpp | 126 |
1 files changed, 121 insertions, 5 deletions
diff --git a/linden/indra/llmessage/llsdmessagebuilder.cpp b/linden/indra/llmessage/llsdmessagebuilder.cpp index d709f91..21937f0 100755 --- a/linden/indra/llmessage/llsdmessagebuilder.cpp +++ b/linden/indra/llmessage/llsdmessagebuilder.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -267,10 +268,125 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) | |||
267 | 268 | ||
268 | for(; dit != dend; ++dit) | 269 | for(; dit != dend; ++dit) |
269 | { | 270 | { |
270 | //const LLMsgVarData& mvci = *dit; | 271 | const LLMsgVarData& mvci = *dit; |
271 | 272 | const char* varname = mvci.getName(); | |
272 | // TODO: Copy mvci data in to block: | 273 | |
273 | // (*mCurrentBlock)[varname] = v; | 274 | switch(mvci.getType()) |
275 | { | ||
276 | case MVT_FIXED: | ||
277 | addBinaryData(varname, mvci.getData(), mvci.getSize()); | ||
278 | break; | ||
279 | |||
280 | case MVT_VARIABLE: | ||
281 | { | ||
282 | const char end = ((const char*)mvci.getData())[mvci.getSize()-1]; // Ensure null terminated | ||
283 | if (mvci.getDataSize() == 1 && end == 0) | ||
284 | { | ||
285 | addString(varname, (const char*)mvci.getData()); | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | addBinaryData(varname, mvci.getData(), mvci.getSize()); | ||
290 | } | ||
291 | break; | ||
292 | } | ||
293 | |||
294 | case MVT_U8: | ||
295 | addU8(varname, *(U8*)mvci.getData()); | ||
296 | break; | ||
297 | |||
298 | case MVT_U16: | ||
299 | addU16(varname, *(U16*)mvci.getData()); | ||
300 | break; | ||
301 | |||
302 | case MVT_U32: | ||
303 | addU32(varname, *(U32*)mvci.getData()); | ||
304 | break; | ||
305 | |||
306 | case MVT_U64: | ||
307 | addU64(varname, *(U64*)mvci.getData()); | ||
308 | break; | ||
309 | |||
310 | case MVT_S8: | ||
311 | addS8(varname, *(S8*)mvci.getData()); | ||
312 | break; | ||
313 | |||
314 | case MVT_S16: | ||
315 | addS16(varname, *(S16*)mvci.getData()); | ||
316 | break; | ||
317 | |||
318 | case MVT_S32: | ||
319 | addS32(varname, *(S32*)mvci.getData()); | ||
320 | break; | ||
321 | |||
322 | // S64 not supported in LLSD so we just truncate it | ||
323 | case MVT_S64: | ||
324 | addS32(varname, *(S64*)mvci.getData()); | ||
325 | break; | ||
326 | |||
327 | case MVT_F32: | ||
328 | addF32(varname, *(F32*)mvci.getData()); | ||
329 | break; | ||
330 | |||
331 | case MVT_F64: | ||
332 | addF64(varname, *(F64*)mvci.getData()); | ||
333 | break; | ||
334 | |||
335 | case MVT_LLVector3: | ||
336 | addVector3(varname, *(LLVector3*)mvci.getData()); | ||
337 | break; | ||
338 | |||
339 | case MVT_LLVector3d: | ||
340 | addVector3d(varname, *(LLVector3d*)mvci.getData()); | ||
341 | break; | ||
342 | |||
343 | case MVT_LLVector4: | ||
344 | addVector4(varname, *(LLVector4*)mvci.getData()); | ||
345 | break; | ||
346 | |||
347 | case MVT_LLQuaternion: | ||
348 | { | ||
349 | LLVector3 v = *(LLVector3*)mvci.getData(); | ||
350 | LLQuaternion q; | ||
351 | q.unpackFromVector3(v); | ||
352 | addQuat(varname, q); | ||
353 | break; | ||
354 | } | ||
355 | |||
356 | case MVT_LLUUID: | ||
357 | addUUID(varname, *(LLUUID*)mvci.getData()); | ||
358 | break; | ||
359 | |||
360 | case MVT_BOOL: | ||
361 | addBOOL(varname, *(BOOL*)mvci.getData()); | ||
362 | break; | ||
363 | |||
364 | case MVT_IP_ADDR: | ||
365 | addIPAddr(varname, *(U32*)mvci.getData()); | ||
366 | break; | ||
367 | |||
368 | case MVT_IP_PORT: | ||
369 | addIPPort(varname, *(U16*)mvci.getData()); | ||
370 | break; | ||
371 | |||
372 | case MVT_U16Vec3: | ||
373 | //treated as an array of 6 bytes | ||
374 | addBinaryData(varname, mvci.getData(), 6); | ||
375 | break; | ||
376 | |||
377 | case MVT_U16Quat: | ||
378 | //treated as an array of 8 bytes | ||
379 | addBinaryData(varname, mvci.getData(), 8); | ||
380 | break; | ||
381 | |||
382 | case MVT_S16Array: | ||
383 | addBinaryData(varname, mvci.getData(), mvci.getSize()); | ||
384 | break; | ||
385 | |||
386 | default: | ||
387 | llwarns << "Unknown type in conversion of message to LLSD" << llendl; | ||
388 | break; | ||
389 | } | ||
274 | } | 390 | } |
275 | } | 391 | } |
276 | } | 392 | } |