diff options
author | Stephen Hines <srhines@google.com> | 2011-04-27 17:38:53 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-27 17:38:53 -0700 |
commit | 5ac02e73c313935b1af8a536e47f74b616986dfe (patch) | |
tree | b0583ce4c34ab403a4295f0b6972dcd779840795 | |
parent | c4791bd65cdf2e487c87da0d863140337e5141cb (diff) | |
parent | 697f8b331bb339e4db716efbb96e2182aac40255 (diff) | |
download | frameworks_base-5ac02e73c313935b1af8a536e47f74b616986dfe.zip frameworks_base-5ac02e73c313935b1af8a536e47f74b616986dfe.tar.gz frameworks_base-5ac02e73c313935b1af8a536e47f74b616986dfe.tar.bz2 |
am 697f8b33: am 00df8e23: Merge "Check setName() for null string + fix rsRand()." into honeycomb-mr1
* commit '697f8b331bb339e4db716efbb96e2182aac40255':
Check setName() for null string + fix rsRand().
-rw-r--r-- | graphics/java/android/renderscript/BaseObj.java | 14 | ||||
-rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java index 669beac..8ce1d9a 100644 --- a/graphics/java/android/renderscript/BaseObj.java +++ b/graphics/java/android/renderscript/BaseObj.java @@ -75,11 +75,17 @@ class BaseObj { * @param name The name to assign to the object. */ public void setName(String name) { + if (name == null) { + throw new RSIllegalArgumentException( + "setName requires a string of non-zero length."); + } if(name.length() < 1) { - throw new RSIllegalArgumentException("setName does not accept a zero length string."); + throw new RSIllegalArgumentException( + "setName does not accept a zero length string."); } if(mName != null) { - throw new RSIllegalArgumentException("setName object already has a name."); + throw new RSIllegalArgumentException( + "setName object already has a name."); } try { @@ -106,9 +112,9 @@ class BaseObj { } /** - * destroy disconnects the object from the native object effectivly + * destroy disconnects the object from the native object effectively * rendering this java object dead. The primary use is to force immediate - * cleanup of resources when its believed the GC will not respond quickly + * cleanup of resources when it is believed the GC will not respond quickly * enough. */ synchronized public void destroy() { diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp index 23230a6..8a4789a 100644 --- a/libs/rs/rsScriptC_Lib.cpp +++ b/libs/rs/rsScriptC_Lib.cpp @@ -76,13 +76,15 @@ static float SC_cosf_fast(float x) { static float SC_randf(float max) { float r = (float)rand(); r *= max; - return r / RAND_MAX; + r /= RAND_MAX; + return r; } static float SC_randf2(float min, float max) { float r = (float)rand(); + r /= RAND_MAX; r = r * (max - min) + min; - return r / RAND_MAX; + return r; } static int SC_randi(int max) { |