Measurement of branching fractions and CP-violating charge asymmetries for B-meson decays to D(*)¯¯¯D(*), and implications for the Cabibbo-Kobayashi-Maskawa angle γ