Fix minor issues detected by cppcheck

:Release Notes:
Fix too wide scope of local variables, useless initialization, and
other minor issues.

:Detailed Notes:

:Testing Performed:
Unit tests on desktop

:QA Notes:

:Issues Addressed:
[ANG-849] pbnjson: Investigate and fix issues found by cppcheck

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I62f3e9981df73db2012dcbfaa1ede0fd4790776e
Reviewed-on: https://g2g.palm.com/4666
Reviewed-by: DCO Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>