[gn][fidl] Fix sign and shortening warnings in visitor_unittests

The upcoming zircon gn build is less lenient and reports:

../system/utest/fidl-compiler/visitor_unittests.cpp:70:32: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    int expected_end = (i + 10 < strlen(expected)) ? i + 10 : strlen(expected) - 1;
                        ~~~~~~ ^ ~~~~~~~~~~~~~~~~
../system/utest/fidl-compiler/visitor_unittests.cpp:70:80: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    int expected_end = (i + 10 < strlen(expected)) ? i + 10 : strlen(expected) - 1;
        ~~~~~~~~~~~~                                          ~~~~~~~~~~~~~~~~~^~~
../system/utest/fidl-compiler/visitor_unittests.cpp:71:30: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    int actual_end = (i + 10 < strlen(actual)) ? i + 10 : strlen(actual) - 1;
                      ~~~~~~ ^ ~~~~~~~~~~~~~~
../system/utest/fidl-compiler/visitor_unittests.cpp:71:74: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    int actual_end = (i + 10 < strlen(actual)) ? i + 10 : strlen(actual) - 1;
        ~~~~~~~~~~                                        ~~~~~~~~~~~~~~~^~~
../system/utest/fidl-compiler/visitor_unittests.cpp:95:72: warning: implicit conversion loses integer precision: 'std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >::size_type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
        std::string d = targeted_diff(expected.c_str(), actual, output.size());
                        ~~~~~~~~~~~~~                           ~~~~~~~^~~~~~

As far as I could tell, I don't think any of these intend to be
negative, and now it's (somewhat) more clear that negative values will
not be passed to the string() constructor.

ZX-3415 #comment [gn][fidl] Fix sign and shortening warnings in visitor_unittests

Test: CQ
Change-Id: I83d71e95394ba1b6874a43c62c00e57f0d33e8de
1 file changed
tree: 3be6b53adc7dd46ac8e813263e68e07aa27798a3
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. garnet/
  7. peridot/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. zircon/
  13. .clang-format
  14. .dir-locals.el
  15. .gitattributes
  16. .gitignore
  17. AUTHORS
  18. CODE_OF_CONDUCT.md
  19. CONTRIBUTING.md
  20. LICENSE
  21. OWNERS
  22. PATENTS
  23. README.md
  24. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See the documentation.