llvolumemessage.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /**
  2. * @file llvolumemessage.cpp
  3. * @brief LLVolumeMessage base class
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  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
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #include "linden_common.h"
  33. #include "llvolumemessage.h"
  34. #include "lldatapacker.h"
  35. #include "llmessage.h"
  36. //static
  37. bool LLVolumeMessage::sIgnoreBadRatio = false;
  38. //static
  39. bool LLVolumeMessage::packProfileParams(const LLProfileParams* params,
  40. LLMessageSystem* mesgsys)
  41. {
  42. // Default to cylinder
  43. static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0),
  44. U16(0), U16(0));
  45. if (!params)
  46. {
  47. params = &defaultparams;
  48. }
  49. U8 tempU8 = params->getCurveType();
  50. mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8);
  51. U16 tempU16 = (U16)ll_round(params->getBegin() / CUT_QUANTA);
  52. mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16);
  53. tempU16 = 50000 - (U16)ll_round(params->getEnd() / CUT_QUANTA);
  54. mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16);
  55. tempU16 = (U16)ll_round(params->getHollow() / HOLLOW_QUANTA);
  56. mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16);
  57. return true;
  58. }
  59. //static
  60. bool LLVolumeMessage::packProfileParams(const LLProfileParams* params,
  61. LLDataPacker& dp)
  62. {
  63. // Default to cylinder
  64. static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0),
  65. U16(0), U16(0));
  66. if (!params)
  67. {
  68. params = &defaultparams;
  69. }
  70. U8 tempU8 = params->getCurveType();
  71. dp.packU8(tempU8, "Curve");
  72. U16 tempU16 = (U16)ll_round(params->getBegin() / CUT_QUANTA);
  73. dp.packU16(tempU16, "Begin");
  74. tempU16 = 50000 - (U16)ll_round(params->getEnd() / CUT_QUANTA);
  75. dp.packU16(tempU16, "End");
  76. tempU16 = (U16)ll_round(params->getHollow() / HOLLOW_QUANTA);
  77. dp.packU16(tempU16, "Hollow");
  78. return true;
  79. }
  80. //static
  81. bool LLVolumeMessage::unpackProfileParams(LLProfileParams* params,
  82. LLMessageSystem* mesgsys,
  83. char const* block_name,
  84. S32 block_num)
  85. {
  86. bool ok = true;
  87. U8 temp_u8;
  88. mesgsys->getU8Fast(block_name, _PREHASH_ProfileCurve, temp_u8, block_num);
  89. params->setCurveType(temp_u8);
  90. U16 temp_u16;
  91. mesgsys->getU16Fast(block_name, _PREHASH_ProfileBegin, temp_u16,
  92. block_num);
  93. F32 temp_f32 = temp_u16 * CUT_QUANTA;
  94. if (temp_f32 > 1.f)
  95. {
  96. llwarns << "Profile begin out of range: " << temp_f32
  97. << ". Clamping to 0.0." << llendl;
  98. temp_f32 = 0.f;
  99. ok = false;
  100. }
  101. params->setBegin(temp_f32);
  102. mesgsys->getU16Fast(block_name, _PREHASH_ProfileEnd, temp_u16, block_num);
  103. temp_f32 = temp_u16 * CUT_QUANTA;
  104. if (temp_f32 > 1.f)
  105. {
  106. llwarns << "Profile end out of range: " << 1.f - temp_f32
  107. << ". Clamping to 1.0." << llendl;
  108. temp_f32 = 1.f;
  109. ok = false;
  110. }
  111. params->setEnd(1.f - temp_f32);
  112. mesgsys->getU16Fast(block_name, _PREHASH_ProfileHollow, temp_u16, block_num);
  113. temp_f32 = temp_u16 * HOLLOW_QUANTA;
  114. if (temp_f32 > 1.f)
  115. {
  116. llwarns << "Profile hollow out of range: " << temp_f32
  117. << ". Clamping to 0.0." << llendl;
  118. temp_f32 = 0.f;
  119. ok = false;
  120. }
  121. params->setHollow(temp_f32);
  122. return ok;
  123. }
  124. //static
  125. bool LLVolumeMessage::unpackProfileParams(LLProfileParams* params,
  126. LLDataPacker& dp)
  127. {
  128. bool ok = true;
  129. U8 temp_u8;
  130. dp.unpackU8(temp_u8, "Curve");
  131. params->setCurveType(temp_u8);
  132. U16 temp_u16;
  133. dp.unpackU16(temp_u16, "Begin");
  134. F32 temp_f32 = temp_u16 * CUT_QUANTA;
  135. if (temp_f32 > 1.f)
  136. {
  137. llwarns << "Profile begin out of range: " << temp_f32 << llendl;
  138. llwarns << "Clamping to 0.0" << llendl;
  139. temp_f32 = 0.f;
  140. ok = false;
  141. }
  142. params->setBegin(temp_f32);
  143. dp.unpackU16(temp_u16, "End");
  144. temp_f32 = temp_u16 * CUT_QUANTA;
  145. if (temp_f32 > 1.f)
  146. {
  147. llwarns << "Profile end out of range: " << 1.f - temp_f32 << llendl;
  148. llwarns << "Clamping to 1.0" << llendl;
  149. temp_f32 = 1.f;
  150. ok = false;
  151. }
  152. params->setEnd(1.f - temp_f32);
  153. dp.unpackU16(temp_u16, "Hollow");
  154. temp_f32 = temp_u16 * HOLLOW_QUANTA;
  155. if (temp_f32 > 1.f)
  156. {
  157. llwarns << "Profile hollow out of range: " << temp_f32 << llendl;
  158. llwarns << "Clamping to 0.0" << llendl;
  159. temp_f32 = 0.f;
  160. ok = false;
  161. }
  162. params->setHollow(temp_f32);
  163. return ok;
  164. }
  165. // Quantization:
  166. // For cut begin, range is 0 to 1, quanta is 0.005, 0 maps to 0
  167. // For cut end, range is 0 to 1, quanta is 0.005, 1 maps to 0
  168. // For scale, range is 0 to 1, quanta is 0.01, 0 maps to 0, 1 maps to 100
  169. // For shear, range is -0.5 to 0.5, quanta is 0.01, 0 maps to 0
  170. // For taper, range is -1 to 1, quanta is 0.01, 0 maps to 0
  171. //static
  172. bool LLVolumeMessage::packPathParams(const LLPathParams* params,
  173. LLMessageSystem* mesgsys)
  174. {
  175. // Default to cylinder with no cut, top same size as bottom, no shear, no
  176. // twist
  177. static LLPathParams defaultparams(LL_PCODE_PATH_LINE, U8(0), U8(0), U8(0),
  178. U8(0), U8(0), U8(0), U8(0), U8(0), U8(0),
  179. U8(0), U8(0), U8(0), 0);
  180. if (!params)
  181. {
  182. params = &defaultparams;
  183. }
  184. U8 curve = params->getCurveType();
  185. mesgsys->addU8Fast(_PREHASH_PathCurve, curve);
  186. U16 begin = (U16)ll_round(params->getBegin() / CUT_QUANTA);
  187. mesgsys->addU16Fast(_PREHASH_PathBegin, begin);
  188. U16 end = 50000 - (U16)ll_round(params->getEnd() / CUT_QUANTA);
  189. mesgsys->addU16Fast(_PREHASH_PathEnd, end);
  190. // Avoid truncation problem with direct F32->U8 cast.
  191. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
  192. U8 pack_scale_x = 200 - (U8)ll_round(params->getScaleX() / SCALE_QUANTA);
  193. mesgsys->addU8Fast(_PREHASH_PathScaleX, pack_scale_x);
  194. U8 pack_scale_y = 200 - (U8)ll_round(params->getScaleY() / SCALE_QUANTA);
  195. mesgsys->addU8Fast(_PREHASH_PathScaleY, pack_scale_y);
  196. U8 pack_shear_x = (U8)ll_round(params->getShearX() / SHEAR_QUANTA);
  197. mesgsys->addU8Fast(_PREHASH_PathShearX, pack_shear_x);
  198. U8 pack_shear_y = (U8)ll_round(params->getShearY() / SHEAR_QUANTA);
  199. mesgsys->addU8Fast(_PREHASH_PathShearY, pack_shear_y);
  200. S8 twist = (S8)ll_round(params->getTwistEnd() / SCALE_QUANTA);
  201. mesgsys->addS8Fast(_PREHASH_PathTwist, twist);
  202. S8 twist_begin = (S8)ll_round(params->getTwistBegin() / SCALE_QUANTA);
  203. mesgsys->addS8Fast(_PREHASH_PathTwistBegin, twist_begin);
  204. S8 radius_offset = (S8)ll_round(params->getRadiusOffset() / SCALE_QUANTA);
  205. mesgsys->addS8Fast(_PREHASH_PathRadiusOffset, radius_offset);
  206. S8 taper_x = (S8)ll_round(params->getTaperX() / TAPER_QUANTA);
  207. mesgsys->addS8Fast(_PREHASH_PathTaperX, taper_x);
  208. S8 taper_y = (S8)ll_round(params->getTaperY() / TAPER_QUANTA);
  209. mesgsys->addS8Fast(_PREHASH_PathTaperY, taper_y);
  210. U8 revolutions = (U8)ll_round((params->getRevolutions() - 1.0f) / REV_QUANTA);
  211. mesgsys->addU8Fast(_PREHASH_PathRevolutions, revolutions);
  212. S8 skew = (S8)ll_round(params->getSkew() / SCALE_QUANTA);
  213. mesgsys->addS8Fast(_PREHASH_PathSkew, skew);
  214. return true;
  215. }
  216. //static
  217. bool LLVolumeMessage::packPathParams(const LLPathParams* params,
  218. LLDataPacker& dp)
  219. {
  220. // Default to cylinder with no cut, top same size as bottom, no shear, no
  221. // twist
  222. static LLPathParams defaultparams(LL_PCODE_PATH_LINE, U8(0), U8(0), U8(0),
  223. U8(0), U8(0), U8(0), U8(0), U8(0), U8(0),
  224. U8(0), U8(0), U8(0), 0);
  225. if (!params)
  226. {
  227. params = &defaultparams;
  228. }
  229. U8 curve = params->getCurveType();
  230. dp.packU8(curve, "Curve");
  231. U16 begin = (U16)ll_round(params->getBegin() / CUT_QUANTA);
  232. dp.packU16(begin, "Begin");
  233. U16 end = 50000 - (U16)ll_round(params->getEnd() / CUT_QUANTA);
  234. dp.packU16(end, "End");
  235. // Avoid truncation problem with direct F32->U8 cast.
  236. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
  237. U8 pack_scale_x = 200 - (U8)ll_round(params->getScaleX() / SCALE_QUANTA);
  238. dp.packU8(pack_scale_x, "ScaleX");
  239. U8 pack_scale_y = 200 - (U8)ll_round(params->getScaleY() / SCALE_QUANTA);
  240. dp.packU8(pack_scale_y, "ScaleY");
  241. S8 pack_shear_x = (S8)ll_round(params->getShearX() / SHEAR_QUANTA);
  242. dp.packU8(*(U8*)&pack_shear_x, "ShearX");
  243. S8 pack_shear_y = (S8)ll_round(params->getShearY() / SHEAR_QUANTA);
  244. dp.packU8(*(U8*)&pack_shear_y, "ShearY");
  245. S8 twist = (S8)ll_round(params->getTwistEnd() / SCALE_QUANTA);
  246. dp.packU8(*(U8*)&twist, "Twist");
  247. S8 twist_begin = (S8)ll_round(params->getTwistBegin() / SCALE_QUANTA);
  248. dp.packU8(*(U8*)&twist_begin, "TwistBegin");
  249. S8 radius_offset = (S8)ll_round(params->getRadiusOffset() / SCALE_QUANTA);
  250. dp.packU8(*(U8*)&radius_offset, "RadiusOffset");
  251. S8 taper_x = (S8)ll_round(params->getTaperX() / TAPER_QUANTA);
  252. dp.packU8(*(U8*)&taper_x, "TaperX");
  253. S8 taper_y = (S8)ll_round(params->getTaperY() / TAPER_QUANTA);
  254. dp.packU8(*(U8*)&taper_y, "TaperY");
  255. U8 revolutions = (U8)ll_round((params->getRevolutions() - 1.0f) / REV_QUANTA);
  256. dp.packU8(*(U8*)&revolutions, "Revolutions");
  257. S8 skew = (S8)ll_round(params->getSkew() / SCALE_QUANTA);
  258. dp.packU8(*(U8*)&skew, "Skew");
  259. return true;
  260. }
  261. //static
  262. bool LLVolumeMessage::unpackPathParams(LLPathParams* params,
  263. LLMessageSystem* mesgsys,
  264. char const* block_name, S32 block_num)
  265. {
  266. U8 curve;
  267. mesgsys->getU8Fast(block_name, _PREHASH_PathCurve, curve, block_num);
  268. params->setCurveType(curve);
  269. U16 begin;
  270. mesgsys->getU16Fast(block_name, _PREHASH_PathBegin, begin, block_num);
  271. params->setBegin((F32)(begin * CUT_QUANTA));
  272. U16 end;
  273. mesgsys->getU16Fast(block_name, _PREHASH_PathEnd, end, block_num);
  274. params->setEnd((F32)((50000 - end) * CUT_QUANTA));
  275. U8 pack_scale_x, pack_scale_y;
  276. mesgsys->getU8Fast(block_name, _PREHASH_PathScaleX, pack_scale_x,
  277. block_num);
  278. mesgsys->getU8Fast(block_name, _PREHASH_PathScaleY, pack_scale_y,
  279. block_num);
  280. F32 x = (F32)(200 - pack_scale_x) * SCALE_QUANTA;
  281. F32 y = (F32)(200 - pack_scale_y) * SCALE_QUANTA;
  282. params->setScale(x, y);
  283. S8 shear_x_quant, shear_y_quant;
  284. mesgsys->getS8Fast(block_name, _PREHASH_PathShearX, shear_x_quant,
  285. block_num);
  286. mesgsys->getS8Fast(block_name, _PREHASH_PathShearY, shear_y_quant,
  287. block_num);
  288. F32 shear_x = (F32)shear_x_quant * SHEAR_QUANTA;
  289. F32 shear_y = (F32)shear_y_quant * SHEAR_QUANTA;
  290. params->setShear(shear_x, shear_y);
  291. S8 twist;
  292. mesgsys->getS8Fast(block_name, _PREHASH_PathTwist, twist, block_num);
  293. params->setTwistEnd((F32)(twist * SCALE_QUANTA));
  294. S8 twist_begin;
  295. mesgsys->getS8Fast(block_name, _PREHASH_PathTwistBegin, twist_begin,
  296. block_num);
  297. params->setTwistBegin((F32)(twist_begin * SCALE_QUANTA));
  298. S8 radius_offset;
  299. mesgsys->getS8Fast(block_name, _PREHASH_PathRadiusOffset, radius_offset,
  300. block_num);
  301. params->setRadiusOffset((F32)(radius_offset * SCALE_QUANTA));
  302. S8 taper_x_quant, taper_y_quant;
  303. mesgsys->getS8Fast(block_name, _PREHASH_PathTaperX, taper_x_quant, block_num);
  304. mesgsys->getS8Fast(block_name, _PREHASH_PathTaperY, taper_y_quant, block_num);
  305. F32 taper_x = (F32)(taper_x_quant * TAPER_QUANTA);
  306. F32 taper_y = (F32)(taper_y_quant * TAPER_QUANTA);
  307. params->setTaper(taper_x, taper_y);
  308. U8 revolutions;
  309. mesgsys->getU8Fast(block_name, _PREHASH_PathRevolutions, revolutions,
  310. block_num);
  311. params->setRevolutions((F32)(revolutions * REV_QUANTA + 1.0f));
  312. S8 skew;
  313. mesgsys->getS8Fast(block_name, _PREHASH_PathSkew, skew, block_num);
  314. params->setSkew((F32)(skew * SCALE_QUANTA));
  315. return true;
  316. }
  317. //static
  318. bool LLVolumeMessage::unpackPathParams(LLPathParams* params, LLDataPacker& dp)
  319. {
  320. U8 value;
  321. dp.unpackU8(value, "Curve");
  322. params->setCurveType(value);
  323. U16 temp_u16;
  324. dp.unpackU16(temp_u16, "Begin");
  325. params->setBegin((F32)(temp_u16 * CUT_QUANTA));
  326. dp.unpackU16(temp_u16, "End");
  327. params->setEnd((F32)((50000 - temp_u16) * CUT_QUANTA));
  328. dp.unpackU8(value, "ScaleX");
  329. F32 x = (F32)(200 - value) * SCALE_QUANTA;
  330. dp.unpackU8(value, "ScaleY");
  331. F32 y = (F32)(200 - value) * SCALE_QUANTA;
  332. params->setScale(x, y);
  333. dp.unpackU8(value, "ShearX");
  334. S8 svalue = *(S8*)&value;
  335. F32 shear_x = (F32)svalue * SHEAR_QUANTA;
  336. dp.unpackU8(value, "ShearY");
  337. svalue = *(S8*)&value;
  338. F32 shear_y = (F32)svalue * SHEAR_QUANTA;
  339. params->setShear(shear_x, shear_y);
  340. dp.unpackU8(value, "Twist");
  341. svalue = *(S8*)&value;
  342. params->setTwistEnd((F32)(svalue * SCALE_QUANTA));
  343. dp.unpackU8(value, "TwistBegin");
  344. svalue = *(S8*)&value;
  345. params->setTwistBegin((F32)(svalue * SCALE_QUANTA));
  346. dp.unpackU8(value, "RadiusOffset");
  347. svalue = *(S8*)&value;
  348. params->setRadiusOffset((F32)(svalue * SCALE_QUANTA));
  349. dp.unpackU8(value, "TaperX");
  350. svalue = *(S8*)&value;
  351. params->setTaperX((F32)(svalue * TAPER_QUANTA));
  352. dp.unpackU8(value, "TaperY");
  353. svalue = *(S8*)&value;
  354. params->setTaperY((F32)(svalue * TAPER_QUANTA));
  355. dp.unpackU8(value, "Revolutions");
  356. params->setRevolutions((F32)(value * REV_QUANTA + 1.0f));
  357. dp.unpackU8(value, "Skew");
  358. svalue = *(S8*)&value;
  359. params->setSkew((F32)(svalue * SCALE_QUANTA));
  360. return true;
  361. }
  362. //static
  363. bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params)
  364. {
  365. // This is called immediately after an unpack. feed the raw data through
  366. // the checked setters to constraint it to a valid set of volume params.
  367. U32 bad = params.setType(params.getProfileParams().getCurveType(),
  368. params.getPathParams().getCurveType()) ? 0 : 1;
  369. bad |= params.setBeginAndEndS(params.getProfileParams().getBegin(),
  370. params.getProfileParams().getEnd()) ? 0 : 2;
  371. bad |= params.setBeginAndEndT(params.getPathParams().getBegin(),
  372. params.getPathParams().getEnd()) ? 0 : 4;
  373. bad |= params.setHollow(params.getProfileParams().getHollow()) ? 0 : 8;
  374. bad |= params.setTwistBegin(params.getPathParams().getTwistBegin()) ? 0
  375. : 0x10;
  376. bad |= params.setTwistEnd(params.getPathParams().getTwistEnd()) ? 0 : 0x20;
  377. bad |= params.setRatio(params.getPathParams().getScaleX(),
  378. params.getPathParams().getScaleY()) ? 0 : 0x40;
  379. bad |= params.setShear(params.getPathParams().getShearX(),
  380. params.getPathParams().getShearY()) ? 0 : 0x80;
  381. bad |= params.setTaper(params.getPathParams().getTaperX(),
  382. params.getPathParams().getTaperY()) ? 0 : 0x100;
  383. bad |= params.setRevolutions(params.getPathParams().getRevolutions()) ? 0
  384. : 0x200;
  385. bad |= params.setRadiusOffset(params.getPathParams().getRadiusOffset()) ? 0
  386. : 0x400;
  387. bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800;
  388. if (bad)
  389. {
  390. LL_DEBUGS("VolumeMessage") << "Forced to constrain bad incoming volume param: "
  391. << llformat("0x%04x", bad) << LL_ENDL;
  392. }
  393. return bad == 0 || (sIgnoreBadRatio && bad == 0x40);
  394. }
  395. //static
  396. bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params,
  397. LLMessageSystem* mesgsys)
  398. {
  399. if (params)
  400. {
  401. packPathParams(&params->getPathParams(), mesgsys);
  402. packProfileParams(&params->getProfileParams(), mesgsys);
  403. }
  404. else
  405. {
  406. packPathParams(0, mesgsys);
  407. packProfileParams(0, mesgsys);
  408. }
  409. return true;
  410. }
  411. //static
  412. bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params,
  413. LLDataPacker& dp)
  414. {
  415. if (params)
  416. {
  417. packPathParams(&params->getPathParams(), dp);
  418. packProfileParams(&params->getProfileParams(), dp);
  419. }
  420. else
  421. {
  422. packPathParams(0, dp);
  423. packProfileParams(0, dp);
  424. }
  425. return true;
  426. }
  427. //static
  428. bool LLVolumeMessage::unpackVolumeParams(LLVolumeParams* params,
  429. LLMessageSystem* mesgsys,
  430. char const* block_name,
  431. S32 block_num)
  432. {
  433. bool ok = unpackPathParams(&params->getPathParams(), mesgsys, block_name,
  434. block_num);
  435. ok &= unpackProfileParams(&params->getProfileParams(), mesgsys, block_name,
  436. block_num);
  437. ok &= constrainVolumeParams(*params);
  438. return ok;
  439. }
  440. //static
  441. bool LLVolumeMessage::unpackVolumeParams(LLVolumeParams* params,
  442. LLDataPacker& dp)
  443. {
  444. bool ok = unpackPathParams(&params->getPathParams(), dp);
  445. ok &= unpackProfileParams(&params->getProfileParams(), dp);
  446. ok &= constrainVolumeParams(*params);
  447. return ok;
  448. }