Reconnection layers in two-dimensional magnetohydrodynamics and comparison with the one-dimensional Riemann problem