diff --git a/repos/gems/include/gems/animated_geometry.h b/repos/gems/include/gems/animated_geometry.h index 346ef9e00c..8d9af66c57 100644 --- a/repos/gems/include/gems/animated_geometry.h +++ b/repos/gems/include/gems/animated_geometry.h @@ -60,8 +60,8 @@ class Genode::Animated_rect : private Animator::Item, Noncopyable } } - int x() const { return _x >> 10; } - int y() const { return _y >> 10; } + int x() const { return (int)(_x >> 10); } + int y() const { return (int)(_y >> 10); } }; Animated_point _p1 { }, _p2 { }; diff --git a/repos/gems/include/gems/color_hsv.h b/repos/gems/include/gems/color_hsv.h index a49ec5db49..aab713cd18 100644 --- a/repos/gems/include/gems/color_hsv.h +++ b/repos/gems/include/gems/color_hsv.h @@ -21,16 +21,17 @@ */ static inline Genode::Color color_from_hsv(unsigned h, unsigned s, unsigned v) { - typedef Genode::Color Color; + using Color = Genode::Color; + using uint8_t = Genode::uint8_t; if (s == 0) return Color(v, v, v); - unsigned char const region = h / 43; - unsigned char const remainder = (h - (region*43)) * 6; - unsigned char const p = (v*(255 - s)) >> 8, - q = (v*(255 - ((s*remainder) >> 8))) >> 8, - t = (v*(255 - ((s*(255 - remainder)) >> 8))) >> 8; + uint8_t const region = (uint8_t)(h / 43); + uint8_t const remainder = (uint8_t)((h - (region*43)) * 6); + uint8_t const p = (uint8_t)((v*(255 - s)) >> 8), + q = (uint8_t)((v*(255 - ((s*remainder) >> 8))) >> 8), + t = (uint8_t)((v*(255 - ((s*(255 - remainder)) >> 8))) >> 8); switch (region) { case 0: return Color(v, t, p); diff --git a/repos/gems/include/gems/gui_buffer.h b/repos/gems/include/gems/gui_buffer.h index 283a0467f7..716a951e6c 100644 --- a/repos/gems/include/gems/gui_buffer.h +++ b/repos/gems/include/gems/gui_buffer.h @@ -39,6 +39,8 @@ struct Gui_buffer typedef Genode::Attached_ram_dataspace Ram_ds; + using size_t = Genode::size_t; + Genode::Ram_allocator &ram; Genode::Region_map &rm; @@ -116,7 +118,7 @@ struct Gui_buffer Pixel_rgb888 const gray(127, 127, 127, 255); - for (unsigned n = num_pixels; n; n--) + for (size_t n = num_pixels; n; n--) *dst++ = gray; } @@ -134,7 +136,7 @@ struct Gui_buffer void _update_input_mask() { - unsigned const num_pixels = size().count(); + size_t const num_pixels = size().count(); unsigned char * const alpha_base = fb_ds.local_addr() + mode.bytes_per_pixel()*num_pixels; diff --git a/repos/gems/include/gems/lru_cache.h b/repos/gems/include/gems/lru_cache.h index 3d92d0784c..6f27a752ec 100644 --- a/repos/gems/include/gems/lru_cache.h +++ b/repos/gems/include/gems/lru_cache.h @@ -40,11 +40,11 @@ class Genode::Lru_cache : Noncopyable struct Time { unsigned value; }; - Allocator &_alloc; - unsigned const _max_elements; - unsigned _used_elements = 0; - Time _now { 0 }; - Stats _stats { }; + Allocator &_alloc; + size_t const _max_elements; + size_t _used_elements = 0; + Time _now { 0 }; + Stats _stats { }; class Tag { diff --git a/repos/gems/include/gems/png_image.h b/repos/gems/include/gems/png_image.h index 6112ab1c6c..9f93fc0997 100644 --- a/repos/gems/include/gems/png_image.h +++ b/repos/gems/include/gems/png_image.h @@ -18,7 +18,10 @@ #include /* libpng include */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include +#pragma GCC diagnostic pop /* restore -Wconversion warnings */ /* gems includes */ #include @@ -65,7 +68,7 @@ class Png_image png_bytep const data; /* read position, maintained by 'read_callback' */ - unsigned pos = 0; + unsigned long pos = 0; static void callback(png_structp png_ptr, png_bytep dst, png_size_t len) { diff --git a/repos/gems/include/gems/texture_utils.h b/repos/gems/include/gems/texture_utils.h index edd7d7313d..39f566a769 100644 --- a/repos/gems/include/gems/texture_utils.h +++ b/repos/gems/include/gems/texture_utils.h @@ -45,10 +45,10 @@ static void scale(Genode::Texture const &src, Genode::Texture &dst, PT const pixel = pixel_line[pixel_offset]; unsigned char const alpha = alpha_line[pixel_offset]; - *d++ = pixel.r(); - *d++ = pixel.g(); - *d++ = pixel.b(); - *d++ = alpha; + *d++ = (unsigned char)pixel.r(); + *d++ = (unsigned char)pixel.g(); + *d++ = (unsigned char)pixel.b(); + *d++ = (unsigned char)alpha; } dst.rgba(row, dst.size().w(), y); @@ -83,10 +83,10 @@ static void convert_pixel_format(Genode::Texture const &src, unsigned char *d = row; for (unsigned x = 0; x < w; x++, src_pixel++, src_alpha++) { - *d++ = src_pixel->r(); - *d++ = src_pixel->g(); - *d++ = src_pixel->b(); - *d++ = (*src_alpha * alpha) >> 8; + *d++ = (unsigned char)src_pixel->r(); + *d++ = (unsigned char)src_pixel->g(); + *d++ = (unsigned char)src_pixel->b(); + *d++ = (unsigned char)((*src_alpha * alpha) >> 8); } /* assign row to destination texture */ diff --git a/repos/gems/include/gems/vfs_font.h b/repos/gems/include/gems/vfs_font.h index d2c4716759..ccbac1acb7 100644 --- a/repos/gems/include/gems/vfs_font.h +++ b/repos/gems/include/gems/vfs_font.h @@ -43,7 +43,7 @@ class Genode::Vfs_font : public Text_painter::Font float _advance() const { - float value = 256.0*_advance_decimal + _advance_fractional; + float value = 256.0f*_advance_decimal + _advance_fractional; return value/256; } @@ -83,7 +83,7 @@ class Genode::Vfs_font : public Text_painter::Font { Allocator &_alloc; - unsigned const num_bytes; + size_t const num_bytes; Glyph_header &header; diff --git a/repos/gems/include/polygon_gfx/interpolate_rgba.h b/repos/gems/include/polygon_gfx/interpolate_rgba.h index eeb127f0f1..82d2c7589e 100644 --- a/repos/gems/include/polygon_gfx/interpolate_rgba.h +++ b/repos/gems/include/polygon_gfx/interpolate_rgba.h @@ -57,7 +57,7 @@ static inline void Polygon::interpolate_rgba(Polygon::Color start, /* combine current color value with existing pixel via alpha blending */ *dst = PT::mix(*dst, PT(r>>16, g>>16, b>>16), a>>16); - *dst_alpha += ((255 - *dst_alpha)*a) >> (16 + 8); + *dst_alpha += (unsigned char)(((255 - *dst_alpha)*a) >> (16 + 8)); /* increment color-component values by ascent */ r += r_ascent; diff --git a/repos/gems/include/polygon_gfx/line_painter.h b/repos/gems/include/polygon_gfx/line_painter.h index a858633488..65df7f621a 100644 --- a/repos/gems/include/polygon_gfx/line_painter.h +++ b/repos/gems/include/polygon_gfx/line_painter.h @@ -43,8 +43,8 @@ struct Line_painter static Fixpoint from_int(long v) { return Fixpoint(v << FRAC_BITS); } static Fixpoint from_raw(long v) { return Fixpoint(v); } - long integer() const { return value >> FRAC_BITS; } - long fractional() const { return value & FRAC_MASK; } + int integer() const { return (int)(value >> FRAC_BITS); } + int fractional() const { return (int)(value & FRAC_MASK); } }; /** @@ -58,7 +58,7 @@ struct Line_painter { auto fill_segment = [&] (long x1, long y1, long x2, long) { - for (long i = x1; i < x2; i++) value[i] = y1; + for (long i = x1; i < x2; i++) value[i] = (unsigned char)y1; }; int const v = 210; diff --git a/repos/gems/include/polygon_gfx/texturize_rgba.h b/repos/gems/include/polygon_gfx/texturize_rgba.h index 9aa9a7bf82..e1e9a7a671 100644 --- a/repos/gems/include/polygon_gfx/texturize_rgba.h +++ b/repos/gems/include/polygon_gfx/texturize_rgba.h @@ -58,7 +58,7 @@ static inline void Polygon::texturize_rgba(Genode::Point<> start, Genode::Point< int const a = alpha_base[src_offset]; *dst = texture_base[src_offset]; - *dst_alpha += ((255 - *dst_alpha)*a) >> 8; + *dst_alpha += (unsigned char)(((255 - *dst_alpha)*a) >> 8); /* walk through texture */ tx += tx_ascent; diff --git a/repos/gems/lib/mk/spec/x86_64/vfs_cbe_crypto_memcopy.mk b/repos/gems/lib/mk/spec/x86_64/vfs_cbe_crypto_memcopy.mk index 7532b0449f..0427316618 100644 --- a/repos/gems/lib/mk/spec/x86_64/vfs_cbe_crypto_memcopy.mk +++ b/repos/gems/lib/mk/spec/x86_64/vfs_cbe_crypto_memcopy.mk @@ -5,3 +5,5 @@ vpath vfs.cc $(REP_DIR)/src/lib/vfs/cbe_crypto/ vpath %.cc $(REP_DIR)/src/lib/vfs/cbe_crypto/memcopy SHARED_LIB = yes + +CC_CXX_WARN_STRICT_CONVERSION = diff --git a/repos/gems/src/app/backdrop/main.cc b/repos/gems/src/app/backdrop/main.cc index 126f2b8b1f..42b34e2675 100644 --- a/repos/gems/src/app/backdrop/main.cc +++ b/repos/gems/src/app/backdrop/main.cc @@ -101,8 +101,11 @@ struct Backdrop::Main void flush_surface() { /* blit back to front buffer */ - blit(surface_ds.local_addr(), surface_num_bytes(), - fb_ds.local_addr(), surface_num_bytes(), surface_num_bytes(), 1); + blit(surface_ds.local_addr(), + (unsigned)surface_num_bytes(), + fb_ds.local_addr(), + (unsigned)surface_num_bytes(), + (unsigned)surface_num_bytes(), 1); } }; diff --git a/repos/gems/src/app/cbe_tester/target.mk b/repos/gems/src/app/cbe_tester/target.mk index 6c1dffe287..8f557e2fd0 100644 --- a/repos/gems/src/app/cbe_tester/target.mk +++ b/repos/gems/src/app/cbe_tester/target.mk @@ -8,3 +8,5 @@ SRC_CC += vfs_utilities.cc INC_DIR := $(PRG_DIR) LIBS += base cbe_cxx cbe_init_cxx cbe_check_cxx cbe_dump_cxx vfs + +CC_CXX_WARN_STRICT_CONVERSION = diff --git a/repos/gems/src/app/cpu_load_display/target.mk b/repos/gems/src/app/cpu_load_display/target.mk index 31797990e1..0746828d3c 100644 --- a/repos/gems/src/app/cpu_load_display/target.mk +++ b/repos/gems/src/app/cpu_load_display/target.mk @@ -2,3 +2,5 @@ TARGET = cpu_load_display SRC_CC = main.cc LIBS = base INC_DIR += $(PRG_DIR) + +CC_CXX_WARN_STRICT_CONVERSION = diff --git a/repos/gems/src/app/decorator/config.h b/repos/gems/src/app/decorator/config.h index f6412302c8..3b0a6da96f 100644 --- a/repos/gems/src/app/decorator/config.h +++ b/repos/gems/src/app/decorator/config.h @@ -156,7 +156,7 @@ class Decorator::Config * We always report at least one window control. Even if none * was configured, we present a title. */ - return Genode::max(_num_window_controls, 1UL); + return Genode::max(_num_window_controls, 1U); } /** @@ -178,11 +178,11 @@ class Decorator::Config /** * Return gradient intensity in percent */ - int gradient_percent(Window_title const &title) const + unsigned gradient_percent(Window_title const &title) const { - unsigned long result = - _buffered_config->xml().attribute_value("gradient", 32UL); - + unsigned result = + _buffered_config->xml().attribute_value("gradient", 32U); + try { Genode::Session_policy policy(title, _buffered_config->xml()); result = policy.attribute_value("gradient", result); diff --git a/repos/gems/src/app/decorator/main.cc b/repos/gems/src/app/decorator/main.cc index bcb9c1ed76..4440d51551 100644 --- a/repos/gems/src/app/decorator/main.cc +++ b/repos/gems/src/app/decorator/main.cc @@ -185,7 +185,7 @@ struct Decorator::Main : Window_factory_base for (;;) { try { return new (_heap) - Window(window_node.attribute_value("id", 0UL), + Window(window_node.attribute_value("id", 0U), _gui, _animator, _decorator_config); } catch (Genode::Out_of_ram) { diff --git a/repos/gems/src/app/depot_download_manager/main.cc b/repos/gems/src/app/depot_download_manager/main.cc index a3adc27bef..2b29f57d0d 100644 --- a/repos/gems/src/app/depot_download_manager/main.cc +++ b/repos/gems/src/app/depot_download_manager/main.cc @@ -43,7 +43,7 @@ struct Depot_download_manager::Child_exit_state exists = true; if (child.has_attribute("exited")) { exited = true; - code = child.attribute_value("exited", 0L); + code = (int)child.attribute_value("exited", 0L); } } }); diff --git a/repos/gems/src/app/driver_manager/main.cc b/repos/gems/src/app/driver_manager/main.cc index 72c7ae63b2..577ba95b38 100644 --- a/repos/gems/src/app/driver_manager/main.cc +++ b/repos/gems/src/app/driver_manager/main.cc @@ -466,8 +466,8 @@ void Driver_manager::Main::_handle_pci_devices_update() _pci_devices.xml().for_each_sub_node([&] (Xml_node device) { - uint16_t const vendor_id = device.attribute_value("vendor_id", 0UL); - uint16_t const class_code = device.attribute_value("class_code", 0UL) >> 8; + uint16_t const vendor_id = (uint16_t)device.attribute_value("vendor_id", 0U); + uint16_t const class_code = (uint16_t)(device.attribute_value("class_code", 0U) >> 8); enum { VENDOR_VBOX = 0x80EEU, diff --git a/repos/gems/src/app/file_vault/child_exit_state.h b/repos/gems/src/app/file_vault/child_exit_state.h index 6ab3af6b76..3e6b5c9e45 100644 --- a/repos/gems/src/app/file_vault/child_exit_state.h +++ b/repos/gems/src/app/file_vault/child_exit_state.h @@ -52,7 +52,7 @@ class File_vault::Child_exit_state if (child.has_attribute("exited")) { _exited = true; - _code = child.attribute_value("exited", 0L); + _code = (int)child.attribute_value("exited", 0L); } _responsive = (child.attribute_value("skipped_heartbeats", 0U) <= 2); diff --git a/repos/gems/src/app/file_vault/sync_to_cbe_vfs_init/main.cc b/repos/gems/src/app/file_vault/sync_to_cbe_vfs_init/main.cc index 087b0291f3..a0e6a001e1 100644 --- a/repos/gems/src/app/file_vault/sync_to_cbe_vfs_init/main.cc +++ b/repos/gems/src/app/file_vault/sync_to_cbe_vfs_init/main.cc @@ -13,10 +13,13 @@ /* libC includes */ extern "C" { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include #include +#pragma GCC diagnostic pop /* restore -Wconversion warnings */ } int main(int, char **) diff --git a/repos/gems/src/app/gpt_write/target.mk b/repos/gems/src/app/gpt_write/target.mk index 21e6aa13df..2459ac23a7 100644 --- a/repos/gems/src/app/gpt_write/target.mk +++ b/repos/gems/src/app/gpt_write/target.mk @@ -2,3 +2,5 @@ TARGET := gpt_write LIBS := base jitterentropy SRC_CC := main.cc util.cc INC_DIR := $(PRG_DIR) + +CC_CXX_WARN_STRICT_CONVERSION = diff --git a/repos/gems/src/app/menu_view/depgraph_widget.h b/repos/gems/src/app/menu_view/depgraph_widget.h index da0f3724be..dfdd0bb801 100644 --- a/repos/gems/src/app/menu_view/depgraph_widget.h +++ b/repos/gems/src/app/menu_view/depgraph_widget.h @@ -673,7 +673,7 @@ struct Menu_view::Depgraph_widget : Widget y4 = p2.y(); /* subdivide the curve depending on the size of its bounding box */ - unsigned const levels = max(log2(max(abs(x4 - x1), abs(y4 - y1)) >> 2), 3); + unsigned const levels = (unsigned)max(log2(max(abs(x4 - x1), abs(y4 - y1)) >> 2), 3); bezier(x1 << 8, y1 << 8, x2 << 8, y2 << 8, x3 << 8, y3 << 8, x4 << 8, y4 << 8, draw_segment, levels); diff --git a/repos/gems/src/app/menu_view/main.cc b/repos/gems/src/app/menu_view/main.cc index 24e0a2d80e..77fbf497f8 100644 --- a/repos/gems/src/app/menu_view/main.cc +++ b/repos/gems/src/app/menu_view/main.cc @@ -231,8 +231,8 @@ void Menu_view::Main::_handle_dialog_update() _position = Decorator::point_attribute(config); - _configured_size = Area(config.attribute_value("width", 0UL), - config.attribute_value("height", 0UL)); + _configured_size = Area(config.attribute_value("width", 0U), + config.attribute_value("height", 0U)); } catch (...) { } _dialog_rom.update(); diff --git a/repos/gems/src/app/menu_view/scratch_surface.h b/repos/gems/src/app/menu_view/scratch_surface.h index 9e1a436e5d..76ad1941b7 100644 --- a/repos/gems/src/app/menu_view/scratch_surface.h +++ b/repos/gems/src/app/menu_view/scratch_surface.h @@ -40,7 +40,7 @@ struct Menu_view::Additive_alpha template static void transfer(TPT const &, int src_a, int alpha, PT &dst) { - dst.pixel += (alpha*src_a) >> 8; + dst.pixel += (uint8_t)((alpha*src_a) >> 8); } static Surface_base::Pixel_format format() { return Surface_base::UNKNOWN; } diff --git a/repos/gems/src/app/nano3d/main.cc b/repos/gems/src/app/nano3d/main.cc index 3ce911e6db..06004e07c4 100644 --- a/repos/gems/src/app/nano3d/main.cc +++ b/repos/gems/src/app/nano3d/main.cc @@ -60,7 +60,7 @@ class Scene : public Nano3d::Scene int const radius = Nano3d::sqrt(dx*dx + dy*dy); - alpha[y][x] = 250 - (radius*250)/r_max; + alpha[y][x] = (unsigned char)(250 - (radius*250)/r_max); if ((x&4) ^ (y&4)) alpha[y][x] = 0; diff --git a/repos/gems/src/app/sculpt_manager/graph.cc b/repos/gems/src/app/sculpt_manager/graph.cc index 8d4d1a4423..b9337f5314 100644 --- a/repos/gems/src/app/sculpt_manager/graph.cc +++ b/repos/gems/src/app/sculpt_manager/graph.cc @@ -302,12 +302,12 @@ Dialog::Hover_result Graph::hover(Xml_node hover) if (!dialog.has_type("dialog")) return Rect(); auto point_from_xml = [] (Xml_node node) { - return Point(node.attribute_value("xpos", 0L), - node.attribute_value("ypos", 0L)); }; + return Point((int)node.attribute_value("xpos", 0L), + (int)node.attribute_value("ypos", 0L)); }; auto area_from_xml = [] (Xml_node node) { - return Area(node.attribute_value("width", 0UL), - node.attribute_value("height", 0UL)); }; + return Area(node.attribute_value("width", 0U), + node.attribute_value("height", 0U)); }; if (!dialog.has_sub_node("depgraph")) return Rect(); Xml_node const depgraph = dialog.sub_node("depgraph"); diff --git a/repos/gems/src/app/sculpt_manager/main.cc b/repos/gems/src/app/sculpt_manager/main.cc index d4baba6379..e5399a69cb 100644 --- a/repos/gems/src/app/sculpt_manager/main.cc +++ b/repos/gems/src/app/sculpt_manager/main.cc @@ -107,7 +107,7 @@ struct Sculpt::Main : Input_event_handler, dir.for_each_sub_node("dir", [&] (Xml_node type) { if (type.attribute_value("name", String<16>()) == "text") { type.for_each_sub_node("ttf", [&] (Xml_node ttf) { - float const px = ttf.attribute_value("size_px", 0.0); + double const px = ttf.attribute_value("size_px", 0.0); if (px > 0.0) _font_size_px = px; }); } }); } }); }); @@ -380,7 +380,7 @@ struct Sculpt::Main : Input_event_handler, Settings _settings { }; - float _font_size_px = 14; + double _font_size_px = 14; Area _screen_size { }; @@ -1169,10 +1169,10 @@ void Sculpt::Main::_handle_window_layout() Xml_node const floating = node.sub_node("floating"); - top = floating.attribute_value("top", 0UL); - bottom = floating.attribute_value("bottom", 0UL); - left = floating.attribute_value("left", 0UL); - right = floating.attribute_value("right", 0UL); + top = floating.attribute_value("top", 0U); + bottom = floating.attribute_value("bottom", 0U); + left = floating.attribute_value("left", 0U); + right = floating.attribute_value("right", 0U); } }; @@ -1199,8 +1199,8 @@ void Sculpt::Main::_handle_window_layout() Xml_node const window_list = _window_list.xml(); auto win_size = [&] (Xml_node win) { - return Area(win.attribute_value("width", 0UL), - win.attribute_value("height", 0UL)); }; + return Area(win.attribute_value("width", 0U), + win.attribute_value("height", 0U)); }; unsigned panel_height = 0; _with_window(window_list, panel_view_label, [&] (Xml_node win) { @@ -1393,7 +1393,7 @@ void Sculpt::Main::_handle_gui_mode() if (!_settings.manual_fonts_config) { - _font_size_px = (float)mode.area.h() / 60.0; + _font_size_px = (double)mode.area.h() / 60.0; /* * Limit lower bound of font size. Otherwise, the glyph rendering @@ -1413,7 +1413,7 @@ void Sculpt::Main::_handle_gui_mode() gen_named_node(xml, "dir", "fonts", [&] () { auto gen_ttf_dir = [&] (char const *dir_name, - char const *ttf_path, float size_px) { + char const *ttf_path, double size_px) { gen_named_node(xml, "dir", dir_name, [&] () { gen_named_node(xml, "ttf", "regular", [&] () { @@ -1450,7 +1450,7 @@ void Sculpt::Main::_handle_gui_mode() _screen_size = mode.area; _panel_menu_view.min_width = _screen_size.w(); - unsigned const menu_width = max(_font_size_px*21, 320.0); + unsigned const menu_width = max((unsigned)(_font_size_px*21.0), 320u); _main_menu_view.min_width = menu_width; _network.min_dialog_width(menu_width); diff --git a/repos/gems/src/app/sculpt_manager/model/access_point.h b/repos/gems/src/app/sculpt_manager/model/access_point.h index 4d32189769..6fde683457 100644 --- a/repos/gems/src/app/sculpt_manager/model/access_point.h +++ b/repos/gems/src/app/sculpt_manager/model/access_point.h @@ -71,7 +71,7 @@ struct Sculpt::Access_point_update_policy : List_model::Update_pol void update_element(Access_point &ap, Xml_node node) { - ap.quality = node.attribute_value("quality", 0UL); + ap.quality = node.attribute_value("quality", 0U); } static bool element_matches_xml_node(Access_point const &elem, Xml_node node) diff --git a/repos/gems/src/app/sculpt_manager/model/child_exit_state.h b/repos/gems/src/app/sculpt_manager/model/child_exit_state.h index c176bc284f..b5989c2d5d 100644 --- a/repos/gems/src/app/sculpt_manager/model/child_exit_state.h +++ b/repos/gems/src/app/sculpt_manager/model/child_exit_state.h @@ -43,7 +43,7 @@ struct Sculpt::Child_exit_state if (child.has_attribute("exited")) { exited = true; - code = child.attribute_value("exited", 0L); + code = (int)child.attribute_value("exited", 0L); } responsive = (child.attribute_value("skipped_heartbeats", 0U) <= 2); diff --git a/repos/gems/src/app/sculpt_manager/model/partition.h b/repos/gems/src/app/sculpt_manager/model/partition.h index 9a0657e813..34397d7577 100644 --- a/repos/gems/src/app/sculpt_manager/model/partition.h +++ b/repos/gems/src/app/sculpt_manager/model/partition.h @@ -108,7 +108,7 @@ struct Sculpt::Partition : List_model::Element Number const number = node.attribute_value("number", Number()); unsigned long const block_size = - node.attribute_value("block_size", 512ULL); + node.attribute_value("block_size", 512UL); unsigned long long const expandable = node.attribute_value("expandable", 0ULL); diff --git a/repos/gems/src/app/sculpt_manager/runtime.h b/repos/gems/src/app/sculpt_manager/runtime.h index 3b3efc5932..e61cc092d1 100644 --- a/repos/gems/src/app/sculpt_manager/runtime.h +++ b/repos/gems/src/app/sculpt_manager/runtime.h @@ -51,7 +51,7 @@ namespace Sculpt { void gen_launcher_query_start_content(Xml_generator &); void gen_runtime_view_start_content(Xml_generator &, Child_state const &, - float font_size); + double font_size); struct Inspect_view_version { unsigned value; }; void gen_inspect_view(Xml_generator &, Storage_devices const &, diff --git a/repos/gems/src/app/sculpt_manager/runtime/runtime_view.cc b/repos/gems/src/app/sculpt_manager/runtime/runtime_view.cc index fc3289c909..8e48b9b4b0 100644 --- a/repos/gems/src/app/sculpt_manager/runtime/runtime_view.cc +++ b/repos/gems/src/app/sculpt_manager/runtime/runtime_view.cc @@ -20,7 +20,7 @@ void Sculpt::gen_runtime_view_start_content(Xml_generator &xml, Child_state const &state, - float font_size) + double font_size) { state.gen_start_node_content(xml); diff --git a/repos/gems/src/app/sculpt_manager/view/download_status.h b/repos/gems/src/app/sculpt_manager/view/download_status.h index 267a3b3189..57d3c8d7b3 100644 --- a/repos/gems/src/app/sculpt_manager/view/download_status.h +++ b/repos/gems/src/app/sculpt_manager/view/download_status.h @@ -42,9 +42,9 @@ void Sculpt::gen_download_status(Xml_generator &xml, Xml_node state) typedef String<16> Info; - Info info = archive.attribute_value("state", Info()); - float const total = archive.attribute_value("total", 0.0); - float const now = archive.attribute_value("now", 0.0); + Info info = archive.attribute_value("state", Info()); + double const total = archive.attribute_value("total", 0.0d); + double const now = archive.attribute_value("now", 0.0d); if (info == "download") { if (total > 0.0) diff --git a/repos/gems/src/app/text_area/dynamic_array.h b/repos/gems/src/app/text_area/dynamic_array.h index 2db0574db7..04ced3ba4b 100644 --- a/repos/gems/src/app/text_area/dynamic_array.h +++ b/repos/gems/src/app/text_area/dynamic_array.h @@ -41,7 +41,7 @@ struct Text_area::Dynamic_array Element *_array = nullptr; - unsigned _capacity = 0; + size_t _capacity = 0; unsigned _upper_bound = 0; /* index after last used element */ bool _index_valid(Index at) const diff --git a/repos/gems/src/app/themed_decorator/main.cc b/repos/gems/src/app/themed_decorator/main.cc index 1a0346403a..a8d1f05b70 100644 --- a/repos/gems/src/app/themed_decorator/main.cc +++ b/repos/gems/src/app/themed_decorator/main.cc @@ -173,7 +173,7 @@ struct Decorator::Main : Window_factory_base for (;;) { try { return new (_heap) - Window(_env, window_node.attribute_value("id", 0UL), + Window(_env, window_node.attribute_value("id", 0U), _gui, _animator, _theme, _decorator_config); } catch (Out_of_ram) { diff --git a/repos/gems/src/app/themed_decorator/theme.cc b/repos/gems/src/app/themed_decorator/theme.cc index 248bd81846..8b55f595ba 100644 --- a/repos/gems/src/app/themed_decorator/theme.cc +++ b/repos/gems/src/app/themed_decorator/theme.cc @@ -124,10 +124,10 @@ struct Margins_from_metadata : Decorator::Theme::Margins Decorator::Theme::Margins() { Genode::Xml_node aura = metadata(alloc).sub_node(sub_node); - top = aura.attribute_value("top", 0UL); - bottom = aura.attribute_value("bottom", 0UL); - left = aura.attribute_value("left", 0UL); - right = aura.attribute_value("right", 0UL); + top = aura.attribute_value("top", 0U); + bottom = aura.attribute_value("bottom", 0U); + left = aura.attribute_value("left", 0U); + right = aura.attribute_value("right", 0U); } }; diff --git a/repos/gems/src/app/vfs_replay/component.cc b/repos/gems/src/app/vfs_replay/component.cc index 91f5889cd9..0eb37e595d 100644 --- a/repos/gems/src/app/vfs_replay/component.cc +++ b/repos/gems/src/app/vfs_replay/component.cc @@ -48,7 +48,7 @@ class Vfs_replay Xml_node _replay_node; Xml_node _request_node { "" }; - unsigned _num_requests { 0 }; + size_t _num_requests { 0 }; unsigned _curr_request_id { 0 }; bool _finished { false }; diff --git a/repos/gems/src/app/window_layouter/assign.h b/repos/gems/src/app/window_layouter/assign.h index 7d30a047e4..840177db0e 100644 --- a/repos/gems/src/app/window_layouter/assign.h +++ b/repos/gems/src/app/window_layouter/assign.h @@ -134,7 +134,7 @@ class Window_layouter::Assign : public List_model::Element bool suffix_matches = false; if (label.length() >= _label_suffix.length()) { - unsigned const offset = label.length() - _label_suffix.length(); + unsigned const offset = (unsigned)(label.length() - _label_suffix.length()); suffix_matches = !strcmp(_label.string() + offset, _label_suffix.string()); } diff --git a/repos/gems/src/app/window_layouter/decorator_margins.h b/repos/gems/src/app/window_layouter/decorator_margins.h index ad21e6b1af..1539b135f9 100644 --- a/repos/gems/src/app/window_layouter/decorator_margins.h +++ b/repos/gems/src/app/window_layouter/decorator_margins.h @@ -26,10 +26,10 @@ struct Window_layouter::Decorator_margins Decorator_margins(Xml_node node) : - top (node.attribute_value("top", 0UL)), - bottom(node.attribute_value("bottom", 0UL)), - left (node.attribute_value("left", 0UL)), - right (node.attribute_value("right", 0UL)) + top (node.attribute_value("top", 0U)), + bottom(node.attribute_value("bottom", 0U)), + left (node.attribute_value("left", 0U)), + right (node.attribute_value("right", 0U)) { } /** diff --git a/repos/gems/src/app/window_layouter/main.cc b/repos/gems/src/app/window_layouter/main.cc index 97168a61c8..c4bf536a07 100644 --- a/repos/gems/src/app/window_layouter/main.cc +++ b/repos/gems/src/app/window_layouter/main.cc @@ -594,7 +594,7 @@ void Window_layouter::Main::_handle_hover() try { Xml_node const hover_window_xml = _hover.xml().sub_node("window"); - _user_state.hover(hover_window_xml.attribute_value("id", 0UL), + _user_state.hover(hover_window_xml.attribute_value("id", 0U), _element_from_hover_model(hover_window_xml)); } @@ -632,7 +632,7 @@ void Window_layouter::Main::_handle_focus_request() { _focus_request.update(); - int const id = _focus_request.xml().attribute_value("id", 0L); + int const id = (int)_focus_request.xml().attribute_value("id", 0L); /* don't apply the same focus request twice */ if (id == _handled_focus_request_id) diff --git a/repos/gems/src/app/window_layouter/target.h b/repos/gems/src/app/window_layouter/target.h index 6ae9b1cb8c..b0f48eeece 100644 --- a/repos/gems/src/app/window_layouter/target.h +++ b/repos/gems/src/app/window_layouter/target.h @@ -40,7 +40,7 @@ class Window_layouter::Target : Noncopyable Target(Xml_node target, Rect geometry, Visible visible) : _name (target.attribute_value("name", Name())), - _layer(target.attribute_value("layer", 9999UL)), + _layer(target.attribute_value("layer", 9999U)), _geometry(geometry), _visible(visible == Visible::YES) { } diff --git a/repos/gems/src/app/window_layouter/target_list.h b/repos/gems/src/app/window_layouter/target_list.h index 5797758641..df44e2f9eb 100644 --- a/repos/gems/src/app/window_layouter/target_list.h +++ b/repos/gems/src/app/window_layouter/target_list.h @@ -42,22 +42,22 @@ class Window_layouter::Target_list void _process_rec(Xml_node node, Rect avail, bool row, Target::Visible visible) { - unsigned long const avail_px = row ? avail.w() : avail.h(); + unsigned const avail_px = row ? avail.w() : avail.h(); char const *sub_node_type = row ? "column" : "row"; char const *px_size_attr = row ? "width" : "height"; - unsigned long px_pos = row ? avail.x1() : avail.y1(); + unsigned px_pos = row ? avail.x1() : avail.y1(); - unsigned long const default_weight = 1; + unsigned const default_weight = 1; /* * Determinine space reserved in pixels, the total weight, and * number of weighted rows/columns. */ - unsigned long preserved_pixels = 0; - unsigned long total_weight = 0; - unsigned long num_weighted = 0; + unsigned preserved_pixels = 0; + unsigned total_weight = 0; + unsigned num_weighted = 0; /* ignore weight if pixel size is provided */ auto weight_attr_value = [&] (Xml_node node) { @@ -65,7 +65,7 @@ class Window_layouter::Target_list ? 0 : node.attribute_value("weight", default_weight); }; node.for_each_sub_node(sub_node_type, [&] (Xml_node child) { - preserved_pixels += child.attribute_value(px_size_attr, 0UL); + preserved_pixels += child.attribute_value(px_size_attr, 0U); total_weight += weight_attr_value(child); num_weighted += child.has_attribute(px_size_attr) ? 0 : 1; }); @@ -76,26 +76,26 @@ class Window_layouter::Target_list } /* amount of pixels we can use for weighed columns */ - unsigned long const weigthed_avail = avail_px - preserved_pixels; + unsigned const weigthed_avail = avail_px - preserved_pixels; /* * Calculate positions */ - unsigned long count_weighted = 0; - unsigned long used_weighted = 0; + unsigned count_weighted = 0; + unsigned used_weighted = 0; node.for_each_sub_node(sub_node_type, [&] (Xml_node child) { auto calc_px_size = [&] () { - unsigned long const px = child.attribute_value(px_size_attr, 0UL); + unsigned const px = child.attribute_value(px_size_attr, 0U); if (px) return px; - unsigned long const weight = weight_attr_value(child); + unsigned const weight = weight_attr_value(child); if (weight && total_weight) return (((weight << 16)*weigthed_avail)/total_weight) >> 16; - return 0UL; + return 0U; }; bool const weighted = !child.has_attribute(px_size_attr); @@ -107,9 +107,9 @@ class Window_layouter::Target_list bool const last_weighted = weighted && (count_weighted == num_weighted); - unsigned long const px_size = last_weighted - ? (weigthed_avail - used_weighted) - : calc_px_size(); + unsigned const px_size = last_weighted + ? (weigthed_avail - used_weighted) + : calc_px_size(); if (weighted) used_weighted += px_size; diff --git a/repos/gems/src/app/window_layouter/window_list.h b/repos/gems/src/app/window_layouter/window_list.h index a6fd89bf83..6945de0cf7 100644 --- a/repos/gems/src/app/window_layouter/window_list.h +++ b/repos/gems/src/app/window_layouter/window_list.h @@ -71,8 +71,8 @@ class Window_layouter::Window_list Window &create_element(Xml_node node) { - unsigned long const id = node.attribute_value("id", 0UL); - Area const initial_size = area_attribute(node); + unsigned const id = node.attribute_value("id", 0U); + Area const initial_size = area_attribute(node); Window::Label const label = node.attribute_value("label",Window::Label()); @@ -94,7 +94,7 @@ class Window_layouter::Window_list static bool element_matches_xml_node(Window const &elem, Xml_node node) { - return elem.has_id(node.attribute_value("id", 0UL)); + return elem.has_id(node.attribute_value("id", 0U)); } }; diff --git a/repos/gems/src/lib/ttf_font/ttf_font.cc b/repos/gems/src/lib/ttf_font/ttf_font.cc index 17c7a4918e..7f91b735b9 100644 --- a/repos/gems/src/lib/ttf_font/ttf_font.cc +++ b/repos/gems/src/lib/ttf_font/ttf_font.cc @@ -26,6 +26,9 @@ * STB TrueType library */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" + static void *local_malloc(Genode::size_t, void *); static void local_free(void *, void *); #define STBTT_malloc local_malloc @@ -38,6 +41,8 @@ static void local_free(void *, void *); #define STB_TRUETYPE_IMPLEMENTATION #include "stb_truetype.h" +#pragma GCC diagnostic pop /* restore -Wconversion warnings */ + static void *STBTT_malloc(size_t size, void *userdata) { return ((Genode::Allocator *)userdata)->alloc(size); @@ -83,7 +88,7 @@ struct Ttf_font::Glyph_buffer { auto fill_segment = [&] (long x1, long y1, long x2, long) { for (long i = x1>>8; i < x2>>8; i++) - value[i] = Genode::min(255, y1>>8); }; + value[i] = (unsigned char)Genode::min(255l, y1>>8); }; bezier(0, 0, 0, 130<<8, 256<<8, 260<<8, fill_segment, 7); value[0] = 0; @@ -198,7 +203,7 @@ Ttf_font::Glyph_buffer::render_shifted(Codepoint const c, return Glyph { .width = width, .height = height, .vpos = (unsigned)((int)baseline + y0), - .advance = scale*advance, + .advance = scale * (float)advance, .values = _values + _headroom }; } @@ -214,13 +219,14 @@ static Text_painter::Area obtain_bounding_box(stbtt_fontinfo const &font, float int x0 = 0, y0 = 0, x1 = 0, y1 = 0; stbtt_GetFontBoundingBox(&font, &x0, &y0, &x1, &y1); - int const w = x1 - x0 + 1, - h = y1 - y0 + 1; + float const w = (float)(x1 - x0 + 1), + h = (float)(y1 - y0 + 1); if (w < 1 || h < 1) throw Ttf_font::Unsupported_data(); - return Text_painter::Area(w*scale + 2*PAD_X, h*scale + 2*PAD_Y); + return Text_painter::Area((unsigned)(w*scale) + 2*PAD_X, + (unsigned)(h*scale) + 2*PAD_Y); } @@ -229,7 +235,7 @@ static unsigned obtain_baseline(stbtt_fontinfo const &font, float scale) int ascent = 0; stbtt_GetFontVMetrics(&font, &ascent, 0, 0); - return (unsigned)(ascent*scale); + return (unsigned)((float)ascent*scale); } @@ -253,7 +259,7 @@ Ttf_font::Ttf_font(Allocator &alloc, void const *ttf, float px) _px(px), _scale(stbtt_ScaleForPixelHeight(&_stbtt_font_info, px)), _baseline(obtain_baseline(_stbtt_font_info, _scale)), - _height(px + 0.5 /* round to integer */), + _height((unsigned)(px + 0.5)), _bounding_box(obtain_bounding_box(_stbtt_font_info, _scale)), _glyph_buffer(*new (alloc) Glyph_buffer(alloc, _bounding_box)) { } @@ -284,7 +290,7 @@ void Ttf_font::_apply_glyph(Codepoint c, Apply_fn const &fn) const float best_shift_y = 0; { unsigned sharpest = 0; - for (float shift_y = -0.3; shift_y < 0.3; shift_y += 0.066) { + for (float shift_y = -0.3f; shift_y < 0.3f; shift_y += 0.066f) { Glyph const glyph = _glyph_buffer.render_shifted(c, _stbtt_font_info, _scale, @@ -311,7 +317,9 @@ Text_painter::Font::Advance_info Ttf_font::advance_info(Codepoint c) const int advance = 0, lsb = 0; stbtt_GetCodepointHMetrics(&_stbtt_font_info, c.value, &advance, &lsb); - return Font::Advance_info { .width = (unsigned)(_scale*advance), - .advance = _scale*advance }; + float const scaled_advance = _scale * (float)advance; + + return Font::Advance_info { .width = (unsigned)scaled_advance, + .advance = scaled_advance }; } diff --git a/repos/gems/src/lib/vfs/cbe_crypto/vfs.cc b/repos/gems/src/lib/vfs/cbe_crypto/vfs.cc index 9251b1ddb9..ba2d41a45a 100644 --- a/repos/gems/src/lib/vfs/cbe_crypto/vfs.cc +++ b/repos/gems/src/lib/vfs/cbe_crypto/vfs.cc @@ -529,7 +529,7 @@ class Vfs_cbe_crypto::Keys_file_system : public Vfs::File_system } try { - Key_file_system const &fs = _key_reg.by_index(index); + Key_file_system const &fs = _key_reg.by_index((unsigned)index); Genode::String<32> name { fs.key_id() }; out = { diff --git a/repos/gems/src/lib/vfs/cbe_trust_anchor/aes_256.cc b/repos/gems/src/lib/vfs/cbe_trust_anchor/aes_256.cc index ca24e5e243..31ee54c03a 100644 --- a/repos/gems/src/lib/vfs/cbe_trust_anchor/aes_256.cc +++ b/repos/gems/src/lib/vfs/cbe_trust_anchor/aes_256.cc @@ -60,7 +60,7 @@ void Aes_256::encrypt_with_zeroed_iv(unsigned char *ciphertext_base, size_t key_size) { Openssl::AES_KEY aes_key; - if (AES_set_encrypt_key(key_base, key_size * 8, &aes_key)) { + if (AES_set_encrypt_key(key_base, (int)(key_size * 8), &aes_key)) { class Failed_to_set_key { }; throw Failed_to_set_key { }; } @@ -82,7 +82,7 @@ void Aes_256::decrypt_with_zeroed_iv(unsigned char *plaintext_base, size_t key_size) { Openssl::AES_KEY aes_key; - if (AES_set_decrypt_key(key_base, key_size * 8, &aes_key)) { + if (AES_set_decrypt_key(key_base, (int)(key_size * 8), &aes_key)) { class Failed_to_set_key { }; throw Failed_to_set_key { }; } diff --git a/repos/gems/src/lib/vfs/trace/vfs.cc b/repos/gems/src/lib/vfs/trace/vfs.cc index 6f96afe5a5..c6b02a6668 100644 --- a/repos/gems/src/lib/vfs/trace/vfs.cc +++ b/repos/gems/src/lib/vfs/trace/vfs.cc @@ -128,7 +128,7 @@ class Vfs_trace::Trace_buffer_file_system : public Single_file_system out_count = 0; _entries.for_each_new_entry([&](Trace::Buffer::Entry entry) { file_size size = min(count - out_count, entry.length()); - memcpy(dst + out_count, entry.data(), size); + memcpy(dst + out_count, entry.data(), (size_t)size); out_count += size; if (out_count == count) @@ -351,7 +351,7 @@ struct Vfs_trace::Local_factory : File_system_factory Trace::Connection _trace; enum { MAX_SUBJECTS = 128 }; Trace::Subject_id _subjects[MAX_SUBJECTS]; - unsigned _subject_count { 0 }; + size_t _subject_count { 0 }; Trace::Policy_id _policy_id { 0 }; Directory_tree _tree { _env.alloc() }; @@ -402,7 +402,7 @@ struct Vfs_trace::Local_factory : File_system_factory } } - for (unsigned i = 0; i < _subject_count; i++) { + for (size_t i = 0; i < _subject_count; i++) { _tree.insert(_trace.subject_info(_subjects[i]), _subjects[i]); } diff --git a/repos/gems/src/lib/vfs/ttf/glyphs_file_system.h b/repos/gems/src/lib/vfs/ttf/glyphs_file_system.h index ed1fb10395..cd752119a6 100644 --- a/repos/gems/src/lib/vfs/ttf/glyphs_file_system.h +++ b/repos/gems/src/lib/vfs/ttf/glyphs_file_system.h @@ -73,7 +73,7 @@ class Vfs::Glyphs_file_system : public Vfs::Single_file_system Glyph_header const header(glyph); char const * const src = (char const *)&header + byte_offset; - size_t const len = min(sizeof(header) - byte_offset, count); + size_t const len = min(sizeof(header) - (size_t)byte_offset, (size_t)count); memcpy(dst, src, len); dst += len; @@ -87,12 +87,12 @@ class Vfs::Glyphs_file_system : public Vfs::Single_file_system * continue working with 'alpha_offset', which is the first * offset of interest within the array of alpha values. */ - size_t const alpha_offset = byte_offset - sizeof(Glyph_header); + size_t const alpha_offset = (size_t)byte_offset - sizeof(Glyph_header); size_t const alpha_values_len = 4*glyph.width*glyph.height; if (alpha_offset < alpha_values_len) { char const * const src = (char const *)glyph.values + alpha_offset; - size_t const len = min(alpha_values_len - alpha_offset, count); + size_t const len = min(alpha_values_len - alpha_offset, (size_t)count); memcpy(dst, src, len); out_count += len; } diff --git a/repos/gems/src/lib/vfs/ttf/vfs.cc b/repos/gems/src/lib/vfs/ttf/vfs.cc index faded3df1f..f6af223dda 100644 --- a/repos/gems/src/lib/vfs/ttf/vfs.cc +++ b/repos/gems/src/lib/vfs/ttf/vfs.cc @@ -77,7 +77,7 @@ struct Vfs_ttf::Local_factory : File_system_factory, Watch_response_handler Font_config(Xml_node const &config) : path(config.attribute_value("path", Directory::Path())), - size(config.attribute_value("size_px", 16.0)), + size((float)config.attribute_value("size_px", 16.0d)), cache_limit({config.attribute_value("cache", Number_of_bytes())}) { } } _font_config; diff --git a/repos/gems/src/server/file_terminal/main.cc b/repos/gems/src/server/file_terminal/main.cc index e36002b038..03e2465dcd 100644 --- a/repos/gems/src/server/file_terminal/main.cc +++ b/repos/gems/src/server/file_terminal/main.cc @@ -22,11 +22,14 @@ #include /* libc includes */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include #include #include +#pragma GCC diagnostic pop /* restore -Wconversion warnings */ class Open_file diff --git a/repos/gems/src/server/gui_fader/alpha_dither_painter.h b/repos/gems/src/server/gui_fader/alpha_dither_painter.h index c54b212ab2..dbe018f496 100644 --- a/repos/gems/src/server/gui_fader/alpha_dither_painter.h +++ b/repos/gems/src/server/gui_fader/alpha_dither_painter.h @@ -49,9 +49,11 @@ struct Alpha_dither_painter for (dst = dst_line, w = clipped.w(); w--; dst++, x++) { - int const v = Genode::Dither_matrix::value(x, y) << 13; + using namespace Genode; - dst->pixel = Genode::min(255, Genode::max(0, (fade - v) >> 16)); + int const v = Dither_matrix::value(x, y) << 13; + + dst->pixel = (uint8_t)min(255, max(0, (fade - v) >> 16)); } y++; @@ -88,15 +90,17 @@ struct Alpha_dither_painter for (dst = dst_line, src = src_line, w = clipped.w(); w--; dst++, src++, x++) { + using namespace Genode; + /* * Multiply texture alpha value with fade value, dither the * result. */ int const a = (((int)src->pixel)*fade); - int const v = Genode::Dither_matrix::value(x, y) << 13; + int const v = Dither_matrix::value(x, y) << 13; - dst->pixel = Genode::min(255, Genode::max(0, (a - v) >> 16)); + dst->pixel = (uint8_t)min(255, max(0, (a - v) >> 16)); } y++; diff --git a/repos/gems/src/server/gui_fader/main.cc b/repos/gems/src/server/gui_fader/main.cc index ad85ab5a06..655259fdf0 100644 --- a/repos/gems/src/server/gui_fader/main.cc +++ b/repos/gems/src/server/gui_fader/main.cc @@ -441,14 +441,14 @@ struct Gui_fader::Main enum { PERIOD = 20 }; - unsigned long alpha = 0; + unsigned alpha = 0; - unsigned long fade_in_steps = 0; - unsigned long fade_out_steps = 0; + unsigned fade_in_steps = 0; + unsigned fade_out_steps = 0; bool initial_fade_in = true; - unsigned long initial_fade_in_steps = 0; + unsigned initial_fade_in_steps = 0; Genode::uint64_t curr_frame() const { return timer.elapsed_ms() / PERIOD; } @@ -471,7 +471,7 @@ struct Gui_fader::Main void handle_timer() { Genode::uint64_t frame = curr_frame(); - if (gui_session.animate(frame - last_frame)) + if (gui_session.animate((unsigned)(frame - last_frame))) timer.trigger_once(PERIOD); last_frame = frame; @@ -502,7 +502,7 @@ void Gui_fader::Main::handle_config_update() Genode::Xml_node config_xml = config.xml(); - unsigned long new_alpha = alpha; + unsigned new_alpha = alpha; if (config_xml.has_attribute("alpha")) config_xml.attribute("alpha").value(new_alpha); @@ -515,7 +515,7 @@ void Gui_fader::Main::handle_config_update() bool const fade_in = (new_alpha > alpha); - int const steps = + unsigned const steps = fade_in ? (initial_fade_in ? initial_fade_in_steps : fade_in_steps) : fade_out_steps; diff --git a/repos/gems/src/server/terminal/session.h b/repos/gems/src/server/terminal/session.h index 50547ed420..74c4d0cc87 100644 --- a/repos/gems/src/server/terminal/session.h +++ b/repos/gems/src/server/terminal/session.h @@ -100,9 +100,9 @@ class Terminal::Session_component : public Rpc_object(); - unsigned const max = min(num_bytes, _io_buffer.size()); + size_t const max = min(num_bytes, _io_buffer.size()); - unsigned i = 0; + size_t i = 0; for (Utf8_ptr utf8(src); utf8.complete() && i < max; ) { _character_consumer.consume_character( @@ -121,7 +121,7 @@ class Terminal::Session_component : public Rpc_object, case Command::OP_TITLE: { - unsigned long id = 0; + unsigned id = 0; Genode::ascii_to(cmd.title.title.string(), id); if (id > 0) diff --git a/repos/gems/src/server/wm/main.cc b/repos/gems/src/server/wm/main.cc index 43b456178d..92bb23d329 100644 --- a/repos/gems/src/server/wm/main.cc +++ b/repos/gems/src/server/wm/main.cc @@ -73,7 +73,7 @@ struct Wm::Main : Pointer::Tracker if (!focus_rom.valid()) return; - unsigned long win_id = 0; + unsigned win_id = 0; Xml_node(focus_rom.local_addr()).sub_node("window") .attribute("id").value(win_id); @@ -97,10 +97,10 @@ struct Wm::Main : Pointer::Tracker resize_request_rom.xml().for_each_sub_node("window", [&] (Xml_node window) { - unsigned long const - win_id = window.attribute_value("id", 0UL), - width = window.attribute_value("width", 0UL), - height = window.attribute_value("height", 0UL); + unsigned const + win_id = window.attribute_value("id", 0U), + width = window.attribute_value("width", 0U), + height = window.attribute_value("height", 0U); gui_root.request_resize(win_id, Area(width, height)); }); diff --git a/repos/gems/src/server/wm/window_registry.h b/repos/gems/src/server/wm/window_registry.h index 10465726e9..586e9e7b6e 100644 --- a/repos/gems/src/server/wm/window_registry.h +++ b/repos/gems/src/server/wm/window_registry.h @@ -213,7 +213,7 @@ class Wm::Window_registry Id create() { - Window * const win = new (_alloc) Window(_window_ids.alloc()); + Window * const win = new (_alloc) Window((unsigned)_window_ids.alloc()); _windows.insert(win); diff --git a/repos/gems/src/test/magic_ring_buffer/main.cc b/repos/gems/src/test/magic_ring_buffer/main.cc index deb94bdfff..ef3663ebab 100644 --- a/repos/gems/src/test/magic_ring_buffer/main.cc +++ b/repos/gems/src/test/magic_ring_buffer/main.cc @@ -26,23 +26,22 @@ void Component::construct(Genode::Env &env) log("--- magic ring buffer test, ", ring_buffer.capacity(), " int ring ---"); + size_t const count = ring_buffer.capacity()/3; - int const count = ring_buffer.capacity()/3; + size_t total = 0; - int total = 0; - - for (int j = 0; j < 99; ++j) { - for (int i = 0; i < count; ++i) { - ring_buffer.write_addr()[i] = i; + for (size_t j = 0; j < 99; ++j) { + for (size_t i = 0; i < count; ++i) { + ring_buffer.write_addr()[i] = (int)i; } ring_buffer.fill(count); - for (int i = 0; i < count; ++i) { - if (ring_buffer.read_addr()[i] != i) { + for (size_t i = 0; i < count; ++i) { + if (ring_buffer.read_addr()[i] != (int)i) { error("ring buffer corruption, ", ring_buffer.read_addr()[i], " != ", i); - env.parent().exit(total+i); + env.parent().exit((int)(total + i)); return; } } diff --git a/repos/gems/src/test/text_painter/main.cc b/repos/gems/src/test/text_painter/main.cc index 856de2a57a..dd93ab1640 100644 --- a/repos/gems/src/test/text_painter/main.cc +++ b/repos/gems/src/test/text_painter/main.cc @@ -111,8 +111,9 @@ struct Test::Main /* test horizontal subpixel positioning */ _surface.clip(Rect(Point(90, 15), Area(100, 300))); Box_painter::paint(_surface, Rect(Point(0, 0), _size), Color(150, 20, 10)); + float const font_3_h = (float)_font_3.bounding_box().h(); - for (float x = 90, y = -30; y < (int)_size.h() + 30; x += 0.2, y += _font_3.bounding_box().h()) + for (float x = 90, y = -30; y < (float)_size.h() + 30; x += 0.2f, y += font_3_h) Text_painter::paint(_surface, Text_painter::Position(x, y), _font_3, Color(255, 255, 255), @@ -121,7 +122,7 @@ struct Test::Main _surface.clip(Rect(Point(90, 320), Area(100, 300))); Box_painter::paint(_surface, Rect(Point(0, 0), _size), Color(255, 255, 255)); - for (float x = 90, y = 300; y < (int)_size.h() + 30; x += 0.2, y += _font_3.bounding_box().h()) + for (float x = 90, y = 300; y < (float)_size.h() + 30; x += 0.2f, y += font_3_h) Text_painter::paint(_surface, Text_painter::Position(x, y), _font_3, Color(0, 0, 0), @@ -136,7 +137,8 @@ struct Test::Main { auto fill_segment = [&] (long x1, long y1, long x2, long) { - for (long i = x1>>8; i < x2>>8; i++) value[i] = min(255, y1>>8); + for (long i = x1>>8; i < x2>>8; i++) + value[i] = (unsigned char)min(255L, y1>>8); }; bezier(0, 0, 0, 130<<8, 256<<8, 260<<8, fill_segment, 7); @@ -170,7 +172,7 @@ struct Test::Main Genode::uint64_t const end_us = timer.elapsed_us(); unsigned long num_glyphs = strlen(vfs_text_string)*ITERATIONS; - log("uncached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph"); + log("uncached painting: ", (float)(end_us - start_us)/(float)num_glyphs, " us/glyph"); _refresh(); } @@ -188,13 +190,13 @@ struct Test::Main Text_painter::paint(_surface, Text_painter::Position(260 + (i*83 % 500), 320 + (i*153 % 400)), - cached_font, Color(30, limit_kib, 150 + i*73), + cached_font, Color(30, (int)limit_kib, 150 + i*73), "Glyphs obtained from VFS"); Genode::uint64_t const end_us = timer.elapsed_us(); unsigned long num_glyphs = strlen(vfs_text_string)*iterations; - log("cached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph" + log("cached painting: ", (float)(end_us - start_us)/(float)num_glyphs, " us/glyph" " (", cached_font.stats(), ")"); _refresh(); }