On Wed, May 15, 2013 at 03:00:39PM +0200, Kevin Wolf wrote:
> @@ -355,6 +364,17 @@ static void test_bmdma_teardown(void)
>      ide_test_quit();
>  }
>  
> +static void string_cpu_to_be16(uint16_t *s, size_t bytes)
> +{
> +    g_assert((bytes & 1) == 0);
> +    bytes /= 2;
> +
> +    while (bytes--) {
> +        *s = cpu_to_be16(*s);
> +        s++;
> +    }
> +}
> +
>  static void test_identify(void)
>  {
>      uint8_t data;
> @@ -389,10 +409,12 @@ static void test_identify(void)
>      assert_bit_clear(data, BSY | DF | ERR | DRQ);
>  
>      /* Check serial number/version in the buffer */
> -    ret = memcmp(&buf[10], "ettsidks            ", 20);
> +    string_cpu_to_be16(&buf[10], 20);
> +    ret = memcmp(&buf[10], "testdisk            ", 20);
>      g_assert(ret == 0);
>  
> -    ret = memcmp(&buf[23], "evsroi n", 8);
> +    string_cpu_to_be16(&buf[23], 8);
> +    ret = memcmp(&buf[23], "version ", 8);

It would have been simpler to specify string_cpu_to_be16() length in
"elements" instead of bytes.  Then you can drop the assertion and
conversion.  Not a problem though.

Anthony: Please take this patch without a pull request.  I think me
sending pull requests for a single late-rc fix doesn't add value.

Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>

Reply via email to