diff --git a/libr/core/graph.c b/libr/core/graph.c index c391bcba57..d954266082 100644 --- a/libr/core/graph.c +++ b/libr/core/graph.c @@ -213,10 +213,10 @@ static void normal_ANode_print(const AGraph *g, const ANode *n, int cur) { n->y + MARGIN_TEXT_Y + delta_y + center_y - delta_txt_y)) { unsigned int text_x = center_x >= delta_x ? 0 : delta_x - center_x; unsigned int text_y = center_y >= delta_y ? 0 : delta_y - center_y; - unsigned int text_h = BORDER_HEIGHT >= n->h ? 0 : n->h - BORDER_HEIGHT; + unsigned int text_h = BORDER_HEIGHT >= n->h ? 1 : n->h - BORDER_HEIGHT; if (g->zoom < ZOOM_DEFAULT) text_h--; - if (text_y <= text_h - 1) { + if (text_y + 1 <= text_h) { text = r_str_crop (n->text, text_x, text_y, n->w - BORDER_WIDTH, diff --git a/libr/include/r_util.h b/libr/include/r_util.h index 6d466b1dce..1837eb6f6f 100644 --- a/libr/include/r_util.h +++ b/libr/include/r_util.h @@ -480,7 +480,7 @@ R_API const char *r_str_pad(const char ch, int len); R_API const char *r_str_rchr(const char *base, const char *p, int ch); R_API const char *r_str_closer_chr (const char *b, const char *s); R_API int r_str_bounds(const char *str, int *h); -R_API char *r_str_crop(const char *str, int x, int y, int w, int h); +R_API char *r_str_crop(const char *str, unsigned int x, unsigned int y, unsigned int w, unsigned int h); R_API int r_str_len_utf8 (const char *s); R_API int r_str_len_utf8char (const char *s, int left); R_API void r_str_filter_zeroline(char *str, int len); diff --git a/libr/util/str.c b/libr/util/str.c index 3f7829af82..0b081d2aa5 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -1706,9 +1706,9 @@ R_API int r_str_bounds(const char *_str, int *h) { } #endif -R_API char *r_str_crop(const char *str, int x, int y, int w, int h) { +R_API char *r_str_crop(const char *str, unsigned int x, unsigned int y, unsigned int w, unsigned int h) { char *r, *ret; - int ch = 0, cw = 0; + unsigned int ch = 0, cw = 0; if (w<1 || h<1) return strdup (""); r = ret = strdup (str);