diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-03-17 21:55:12 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-03-17 22:00:54 +0000 |
commit | d15ab96a51287469082e8d9068e2608a386f9e5f (patch) | |
tree | 346fb22044567be929d9f0dc47f62732f4633815 /windows | |
parent | 232cda5317ae39d54852f741fbbd09c9618143cd (diff) | |
download | netsurf-d15ab96a51287469082e8d9068e2608a386f9e5f.tar.gz netsurf-d15ab96a51287469082e8d9068e2608a386f9e5f.tar.bz2 |
Fix size_t printf formatting
The printf formatting for size_t is set in c99 as %zu but in windows
it is %Iu this is solved by adding and inttypes style PRI macro for size_t
This also uses this macro everywhere size_t is formatted.
Diffstat (limited to 'windows')
-rw-r--r-- | windows/bitmap.c | 17 | ||||
-rw-r--r-- | windows/window.c | 10 |
2 files changed, 17 insertions, 10 deletions
diff --git a/windows/bitmap.c b/windows/bitmap.c index 68dd955dd..e86f95bfe 100644 --- a/windows/bitmap.c +++ b/windows/bitmap.c @@ -57,6 +57,7 @@ void *win32_bitmap_create(int width, int height, unsigned int state) if (pbmi == NULL) { return NULL; } + pbmi->bV5Size = sizeof(BITMAPV5HEADER); pbmi->bV5Width = width; pbmi->bV5Height = -height; @@ -71,7 +72,6 @@ void *win32_bitmap_create(int width, int height, unsigned int state) windib = CreateDIBSection(NULL, (BITMAPINFO *)pbmi, DIB_RGB_COLORS, (void **)&pixdata, NULL, 0); - if (windib == NULL) { free(pbmi); return NULL; @@ -286,11 +286,13 @@ struct bitmap *bitmap_scale(struct bitmap *prescale, int width, int height) * transfer */ if (ret == NULL) return NULL; + retpixdata = malloc(width * height * 4); if (retpixdata == NULL) { free(ret); return NULL; } + inpixdata = (uint32_t *)prescale->pixdata; ret->pixdata = (uint8_t *)retpixdata; ret->height = height; @@ -307,8 +309,11 @@ struct bitmap *bitmap_scale(struct bitmap *prescale, int width, int height) } -struct bitmap *bitmap_pretile(struct bitmap *untiled, int width, int height, - bitmap_flags_t flags) +struct bitmap * +bitmap_pretile(struct bitmap *untiled, + int width, + int height, + bitmap_flags_t flags) { struct bitmap *ret = malloc(sizeof(struct bitmap)); if (ret == NULL) @@ -352,7 +357,8 @@ struct bitmap *bitmap_pretile(struct bitmap *untiled, int width, int height, return ret; } -static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) +static nserror +bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) { int width; int height; @@ -368,7 +374,8 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte height = ((width * bitmap->height) + (bitmap->width / 2)) / bitmap->width; - LOG("bitmap %p for content %p width %d, height %d", bitmap, content, width, height); + LOG("bitmap %p for content %p width %d, height %d", + bitmap, content, width, height); /* create two memory device contexts to put the bitmaps in */ bufferdc = CreateCompatibleDC(NULL); diff --git a/windows/window.c b/windows/window.c index 455e6e5f5..d3f2c99c5 100644 --- a/windows/window.c +++ b/windows/window.c @@ -1451,16 +1451,16 @@ win32_window_update_box(struct gui_window *gw, const struct rect *rect) -static void win32_window_get_dimensions(struct gui_window *w, int *width, int *height, +static void win32_window_get_dimensions(struct gui_window *gw, int *width, int *height, bool scaled) { - if (w == NULL) + if (gw == NULL) return; - LOG("get dimensions %p w=%d h=%d", w, w->width, w->height); + LOG("get dimensions %p w=%d h=%d", gw, gw->width, gw->height); - *width = w->width; - *height = w->height; + *width = gw->width; + *height = gw->height; } static void win32_window_update_extent(struct gui_window *w) |