Sync from master in preparation of v1.2

Squashed commit of the following:
commit 2dbb757d3009acdbf7acbaf0d211e7e6efb212f3
Merge: 34cb0d6 6a2a4ef
Author: ruil2 <ruil2@cisco.com>
Date:   Fri Oct 24 15:18:55 2014 +0800

    Merge pull request #1451 from sijchen/for_format

    Fixes and change naming

commit 34cb0d60aa957e320f3b4dde8e5572a37f47e5d0
Merge: 468fce0 f0c6891
Author: sijchen <sijchen@cisco.com>
Date:   Fri Oct 24 14:41:51 2014 +0800

    Merge pull request #1450 from mstorsjo/avoid-warnings

    Add casts to avoid warnings about comparison between signed and unsigned

commit 6a2a4efef66f625a4fe15be1bff7dc5caaf5c4c8
Author: Sijia Chen <sijchen@cisco.com>
Date:   Fri Oct 24 14:39:50 2014 +0800

    fix names to keep consistent of style
    improve UT to cover more cases under GetStatistics

commit ea9b80adb39ef55185a282cfd68b423bb5a3f036
Author: Sijia Chen <sijchen@cisco.com>
Date:   Fri Oct 24 14:12:53 2014 +0800

    fix a wrong range clip

commit 468fce0887a1f88d880cd7030ed13967e3f72360
Merge: ac290d6 50fd617
Author: sijchen <sijchen@cisco.com>
Date:   Fri Oct 24 14:12:40 2014 +0800

    Merge pull request #1448 from sijchen/for_format

    roll back the file which is mis-formatted by astyle

commit f0c6891627df3ccacf8ad409522c51b5442df1d1
Author: Martin Storsjö <martin@martin.st>
Date:   Fri Oct 24 09:05:32 2014 +0300

    Add casts to avoid warnings about comparison between signed and unsigned

commit 50fd617e86b60d9a01dccd02edec5d9994552fe8
Author: Sijia Chen <sijchen@cisco.com>
Date:   Fri Oct 24 13:04:35 2014 +0800

    roll back the file which is mis-formatted by astyle

commit ac290d65c7b6993f18285a73784933356001b05a
Merge: dcdcc7f 3cce92e
Author: ruil2 <ruil2@cisco.com>
Date:   Fri Oct 24 12:50:07 2014 +0800

    Merge pull request #1446 from sijchen/for_format

    [Encoder] fix a small range of slice idx