summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2010-04-21 00:49:40 -0400
committerBehdad Esfahbod <behdad@behdad.org>2010-04-21 00:49:40 -0400
commit140cfe4b4a40f95a379c1b78881b1edf12f72145 (patch)
tree39c89ff9b18d32798f2eb51ead4121b7fff1c868
parent4eca6bc0c98b573cc28005413e40790af8b10930 (diff)
downloadpango-140cfe4b4a40f95a379c1b78881b1edf12f72145.tar.gz
[HB] Improve comments
-rw-r--r--pango/opentype/hb-open-type-private.hh22
1 files changed, 14 insertions, 8 deletions
diff --git a/pango/opentype/hb-open-type-private.hh b/pango/opentype/hb-open-type-private.hh
index 994f6d8d..9e99175a 100644
--- a/pango/opentype/hb-open-type-private.hh
+++ b/pango/opentype/hb-open-type-private.hh
@@ -510,11 +510,14 @@ struct GenericArrayOf
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false;
- /* Note:
- * for non-recursive types, this is not much needed.
- * But we keep the code to make sure the objects pointed to
- * do have a simple sanitize(). */
+ /* Note: for structs that do not reference other structs,
+ * we do not need to call their sanitize() as we already did
+ * a bound check on the aggregate array size, hence the return.
+ */
return true;
+ /* We do keep this code though to make sure the structs pointed
+ * to do have a simple sanitize(), ie. they do not reference
+ * other structs. */
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (!SANITIZE (array()[i]))
@@ -613,11 +616,14 @@ struct HeadlessArrayOf
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false;
- /* Note:
- * for non-recursive types, this is not much needed.
- * But we keep the code to make sure the objects pointed to
- * do have a simple sanitize(). */
+ /* Note: for structs that do not reference other structs,
+ * we do not need to call their sanitize() as we already did
+ * a bound check on the aggregate array size, hence the return.
+ */
return true;
+ /* We do keep this code though to make sure the structs pointed
+ * to do have a simple sanitize(), ie. they do not reference
+ * other structs. */
unsigned int count = len ? len - 1 : 0;
Type *a = array();
for (unsigned int i = 0; i < count; i++)