/* Returns: a signed 16-bit/2-byte value read from @stream or %0 if an error occurred.  */
gint16 g_data_input_stream_read_int16(GDataInputStream *stream, GCancellable *cancellable, GError **error)
/* Returns: a signed 16-bit/2-byte value read from @stream or %0 if an error occurred.  */
gint16 g_data_input_stream_read_int16(GDataInputStream *stream, GCancellable *cancellable, GError **error)
{
  gint16 v;
  g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), 0);
  if (read_data (stream, &v, 2, cancellable, error))
    {
      switch (stream->priv->byte_order)
	{
	case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN:
	  v = GINT16_FROM_BE (v);
	  break;
	case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN:
	  v = GINT16_FROM_LE (v);
	  break;
	case G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN:
	default:
	  break;
	}
      return v;
    }
  return 0;
}