diff options
author | Greg Kaiser <gkaiser@google.com> | 2016-08-01 12:46:22 -0700 |
---|---|---|
committer | Greg Kaiser <gkaiser@google.com> | 2016-08-08 06:55:10 -0700 |
commit | c9b23cbb541824ae6bd94fc1d5839050e864bab8 (patch) | |
tree | 4fab862dee19b7c0adc546a8ff827c60431350ab /libutils/Unicode.cpp | |
parent | 9cd828b8589a64e79cbd6aa7dc324fcdba75dd73 (diff) |
SharedBuffer: Fix bug in return value of release()
Since the equality operator '==' has higher precedence than the
assignment operator '=', we were assigning 'prev' to the result of
our comparison and not the result of mRefs.fetch_sub().
This means that 'prev' would only receive the values 0 or 1. In
the cases where fetch_sub() returned 0 or 1, we were happening to
get the correct value. But if fetch_sub() was greator than 1,
we would return to the user 0, instead of the previous reference
count.
We fix this by properly adding parentheses. We also adjust the
whitespace a little to hopefully make the groupings of the logic
easier to see.
Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
Diffstat (limited to 'libutils/Unicode.cpp')
0 files changed, 0 insertions, 0 deletions