Fidelity and entanglement fidelity for infinite-dimensional quantum systems