diff options
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/bitmap.c | 21 | ||||
-rw-r--r-- | riscos/gui.c | 25 |
2 files changed, 27 insertions, 19 deletions
diff --git a/riscos/bitmap.c b/riscos/bitmap.c index 5ab2f20e5..486019396 100644 --- a/riscos/bitmap.c +++ b/riscos/bitmap.c @@ -252,7 +252,7 @@ void bitmap_overlay_sprite(struct bitmap *bitmap, const osspriteop_header *s) assert(sprite_bpp(s) == 8); if ((unsigned)s->mode & 0x80000000U) - alpha = true; + alpha = true; error = xosspriteop_read_sprite_info(osspriteop_PTR, (osspriteop_area *)0x100, @@ -376,7 +376,7 @@ bool bitmap_initialise(struct bitmap *bitmap) void bitmap_set_opaque(struct bitmap *bitmap, bool opaque) { assert(bitmap); - + if (opaque) bitmap->state |= BITMAP_OPAQUE; else @@ -459,7 +459,7 @@ char *bitmap_get_buffer(struct bitmap *bitmap) bitmap->previous = NULL; bitmap_head = bitmap; } - + /* dynamically create the buffer */ if (!(bitmap->state & BITMAP_READY)) { if (!bitmap_initialise(bitmap)) @@ -592,8 +592,8 @@ void bitmap_set_suspendable(struct bitmap *bitmap, void *private_word, void (*invalidate)(struct bitmap *bitmap, void *private_word)) { bitmap->private_word = private_word; bitmap->invalidate = invalidate; - bitmap_suspendable++; -} + bitmap_suspendable++; +} /** @@ -644,7 +644,7 @@ void bitmap_maintain(void) bitmap_maintenance_priority = false; return; } - + /* the fastest and easiest way to release memory is by suspending * images. as such, we try to do this first for as many images as * possible, potentially freeing up large amounts of memory */ @@ -659,7 +659,7 @@ void bitmap_maintain(void) bitmap_direct_used -= 16 + 44 + bitmap->width * bitmap->height * 4; bitmap_suspended++; - } + } } return; } @@ -892,7 +892,7 @@ void bitmap_save_file(struct bitmap *bitmap) os_error *error; struct bitmap_compressed_header *header; - assert(bitmap->compressed || bitmap->sprite_area); + assert(bitmap && (bitmap->compressed || bitmap->sprite_area)); /* unmodified bitmaps will still have their file available */ if ((!(bitmap->state & BITMAP_MODIFIED)) && bitmap->filename[0]) { @@ -907,6 +907,11 @@ void bitmap_save_file(struct bitmap *bitmap) /* dump the data (compressed or otherwise) to disk */ filename = filename_request(); + if (!filename) { + LOG(("filename_request failed")); + return; + } + strcpy(bitmap->filename, filename); sprintf(bitmap_unixname, "%s/%s", TEMP_FILENAME_PREFIX, bitmap->filename); diff --git a/riscos/gui.c b/riscos/gui.c index b6f74f79b..925659265 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -2164,20 +2164,22 @@ void ro_gui_view_source(struct content *content) message.file_name[211] = '\0'; free(temp_name); } else { - /* We cannot release the requested filename until after it has finished - being used. As we can't easily find out when this is, we simply don't - bother releasing it and simply allow it to be re-used next time NetSurf - is started. The memory overhead from doing this is under 1 byte per - filename. */ - temp_name = filename_request(); - if (!temp_name) { + /* We cannot release the requested filename until after it + * has finished being used. As we can't easily find out when + * this is, we simply don't bother releasing it and simply + * allow it to be re-used next time NetSurf is started. The + * memory overhead from doing this is under 1 byte per + * filename. */ + const char *filename = filename_request(); + if (!filename) { warn_user("NoMemory", 0); return; } - snprintf(full_name, 256, "%s/%s", TEMP_FILENAME_PREFIX, temp_name); + snprintf(full_name, 256, "%s/%s", TEMP_FILENAME_PREFIX, + filename); full_name[255] = '\0'; - r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX, message.file_name, - 212, 0); + r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX, + message.file_name, 212, 0); if (r == 0) { LOG(("__riscosify failed")); return; @@ -2205,7 +2207,8 @@ void ro_gui_view_source(struct content *content) message.pos.y = 0; message.est_size = 0; message.file_type = 0xfff; - ro_message_send_message(wimp_USER_MESSAGE_RECORDED, (wimp_message*)&message, 0, + ro_message_send_message(wimp_USER_MESSAGE_RECORDED, + (wimp_message*)&message, 0, ro_gui_view_source_bounce); } |