Fix subtle bug when src & dst agree on sparsity but have different dimensions
Remove unused var "total"
Declare vars as locally as possible
Merge pull request #415 from asmaloney:cvCopyHist-fix