  The extremely high brightness temperatures of pulsars and fast radio bursts
(FRBs) require their radiation mechanisms to be coherent. Coherent curvature
radiation by bunches has been long discussed as the mechanism for radio pulsars
and recently for FRBs. Assuming that bunches are already generated in pulsar
magnetospheres, we calculate the spectrum of coherent curvature radiation under
a three-dimensional magnetic field geometry. Different from previous works
assuming parallel trajectories and a mono-energetic energy distribution of
electrons, we consider a bunch characterized by its length, curvature radius of
the trajectory family, bunch opening angle, and electron energy distribution.
We find that the curvature radiation spectra of the bunches are characterized
by a multi-segment broken power law, with the break frequencies depending on
bunch properties and trajectory configuration. We also emphasize that in a
pulsar magnetosphere only the fluctuation of net charges with respect to the
background (Goldreich-Julian) outflow can make a contribution to coherent
radiation. We apply this model to constrain the observed spectra of pulsars and
FRBs. For a typical pulsar ($B_p=10^{12}~{\rm G}$, $P=0.1~{\rm s}$), a small
fluctuation of the net charge $\delta n_{\rm GJ}\sim 0.1 n_{\rm GJ}$ can
provide the observable flux. For FRBs, the fluctuating net charge may be larger
due to its abrupt nature. For $\delta n_{\rm GJ}\sim n_{\rm GJ}$, a neutron
star with a strong magnetic field and fast rotation is required to power an FRB
in the spindown-powered model. The requirement is less stringent in the cosmic
comb model thanks to the larger cross section and compressed charge density of
the bunch made by the external astrophysical stream that combs the
magnetosphere.
