Use Allegro's ASSERT() instead of assert().

This commit is contained in:
David Capello 2010-08-03 23:33:44 -03:00
parent 8d73ad011a
commit 4e72997a02
87 changed files with 638 additions and 704 deletions

View File

@ -40,14 +40,12 @@ const char* msgids_get(const char* id); // src/intl/msgids.[ch]
#define _(msgid) (msgids_get(msgid))
// Asserts
#include <cassert>
#include <math.h>
#undef PI
#define PI 3.14159265358979323846
#include <allegro/base.h>
#include <allegro/debug.h> // ASSERT
typedef uint8_t ase_uint8;
typedef uint16_t ase_uint16;

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
/* #include <allegro/internal/aintern.h> */
#include <memory>
#include <stdarg.h>
@ -122,7 +121,7 @@ App::App()
: m_modules(NULL)
, m_legacy(NULL)
{
assert(m_instance == NULL);
ASSERT(m_instance == NULL);
m_instance = this;
// create private implementation data
@ -307,7 +306,7 @@ int App::run()
App::~App()
{
try {
assert(m_instance == this);
ASSERT(m_instance == this);
// Remove ASE handlers
PRINTF("ASE: Uninstalling\n");
@ -334,7 +333,7 @@ App::~App()
ToolBox* App::get_toolbox()
{
assert(m_modules != NULL);
ASSERT(m_modules != NULL);
return &m_modules->m_toolbox;
}
@ -343,7 +342,7 @@ ToolBox* App::get_toolbox()
*/
void app_refresh_screen(const Sprite* sprite)
{
assert(screen != NULL);
ASSERT(screen != NULL);
if (sprite)
set_current_palette(sprite->getCurrentPalette(), false);
@ -427,7 +426,7 @@ bool app_realloc_recent_list()
int app_get_current_image_type()
{
Context* context = UIContext::instance();
assert(context != NULL);
ASSERT(context != NULL);
Sprite* sprite = context->get_current_sprite();
if (sprite != NULL)

View File

@ -64,7 +64,7 @@ static bool onionskin_check_change_hook(JWidget widget, void *data);
// Slot for App::Exit signal
static void on_exit_delete_this_widget()
{
assert(window != NULL);
ASSERT(window != NULL);
jwidget_free(window);
}
@ -283,7 +283,7 @@ static bool brush_preview_msg_proc(JWidget widget, JMessage msg)
->getToolSettings(current_tool)
->getPen();
assert(pen_settings != NULL);
ASSERT(pen_settings != NULL);
Pen* pen = new Pen(pen_settings->getType(),
pen_settings->getSize(),

View File

@ -69,7 +69,7 @@ void GotoPreviousLayerCommand::onExecute(Context* context)
sprite->setCurrentLayer(sprite->indexToLayer(i));
// Flash the current layer
assert(current_editor != NULL); // Cannot be null when we have a current sprite
ASSERT(current_editor != NULL && "Current editor cannot be null when we have a current sprite");
current_editor->flashCurrentLayer();
app_get_statusbar()
@ -118,7 +118,7 @@ void GotoNextLayerCommand::onExecute(Context* context)
sprite->setCurrentLayer(sprite->indexToLayer(i));
// Flash the current layer
assert(current_editor != NULL); // Cannot be null when we have a current sprite
ASSERT(current_editor != NULL && "Current editor cannot be null when we have a current sprite");
current_editor->flashCurrentLayer();
app_get_statusbar()

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro/config.h>
#include <allegro/unicode.h>
@ -164,7 +163,7 @@ void NewFileCommand::onExecute(Context* context)
// If the background color isn't transparent, we have to
// convert the `Layer 1' in a `Background'
if (color_type(color) != COLOR_TYPE_MASK) {
assert(sprite->getCurrentLayer() && sprite->getCurrentLayer()->is_image());
ASSERT(sprite->getCurrentLayer() && sprite->getCurrentLayer()->is_image());
static_cast<LayerImage*>(sprite->getCurrentLayer())->configure_as_background();
image_clear(sprite->getCurrentImage(), get_color_for_image(imgtype, color));
@ -188,9 +187,9 @@ void NewFileCommand::onExecute(Context* context)
*/
static Sprite* new_sprite(Context* context, int imgtype, int w, int h, int ncolors)
{
assert(imgtype == IMAGE_RGB || imgtype == IMAGE_GRAYSCALE || imgtype == IMAGE_INDEXED);
assert(w >= 1 && w <= 9999);
assert(h >= 1 && h <= 9999);
ASSERT(imgtype == IMAGE_RGB || imgtype == IMAGE_GRAYSCALE || imgtype == IMAGE_INDEXED);
ASSERT(w >= 1 && w <= 9999);
ASSERT(h >= 1 && h <= 9999);
return Sprite::createWithLayer(imgtype, w, h, ncolors);
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include "jinete/jinete.h"
#include "commands/command.h"

View File

@ -21,7 +21,6 @@
#include <allegro.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <vector>
#include "Vaca/Bind.h"
@ -60,7 +59,7 @@ static bool redraw_all = false;
// Slot for App::Exit signal
static void on_exit_delete_this_widget()
{
assert(window != NULL);
ASSERT(window != NULL);
jmanager_remove_timer(redraw_timer_id);
redraw_timer_id = -1;
@ -648,7 +647,7 @@ static bool sort_by_criteria(Palette* palette, int from, int to, JList selected_
channel = SortPalette::RGB_Blue;
}
else
assert(false);
ASSERT(false);
}
else if (item_text.find("HSV") != std::string::npos) {
if (item_text.find("Hue") != std::string::npos) {
@ -661,31 +660,31 @@ static bool sort_by_criteria(Palette* palette, int from, int to, JList selected_
channel = SortPalette::HSV_Value;
}
else
assert(false);
ASSERT(false);
}
else if (item_text.find("HSL") != std::string::npos) {
if (item_text.find("Lightness") != std::string::npos) {
channel = SortPalette::HSL_Lightness;
}
else
assert(false);
ASSERT(false);
}
else if (item_text.find("YUV") != std::string::npos) {
if (item_text.find("Luma") != std::string::npos) {
channel = SortPalette::YUV_Luma;
}
else
assert(false);
ASSERT(false);
}
else
assert(false);
ASSERT(false);
if (item_text.find("Ascending") != std::string::npos)
ascending = true;
else if (item_text.find("Descending") != std::string::npos)
ascending = false;
else
assert(false);
ASSERT(false);
SortPalette* chain = new SortPalette(channel, ascending);
if (sort_palette)

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro/debug.h>
#include <allegro/unicode.h>
@ -95,7 +94,7 @@ void SelectFileCommand::onExecute(Context* context)
{
if (m_sprite_id > 0) {
GfxObj* gfxobj = gfxobj_find(m_sprite_id);
assert(gfxobj != NULL);
ASSERT(gfxobj != NULL);
set_sprite_in_more_reliable_editor((Sprite*)gfxobj);
}

View File

@ -93,7 +93,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
imgtype_text = buf;
break;
default:
assert(false);
ASSERT(false);
imgtype_text = "Unknown";
break;
}

View File

@ -39,7 +39,7 @@ CommandsModule* CommandsModule::m_instance = NULL;
CommandsModule::CommandsModule()
{
assert(m_instance == NULL);
ASSERT(m_instance == NULL);
m_instance = this;
#undef FOR_EACH_COMMAND
@ -52,7 +52,7 @@ CommandsModule::CommandsModule()
CommandsModule::~CommandsModule()
{
assert(m_instance == this);
ASSERT(m_instance == this);
for (CommandsList::iterator
it = m_commands.begin(); it != m_commands.end(); ++it) {
@ -65,7 +65,7 @@ CommandsModule::~CommandsModule()
CommandsModule* CommandsModule::instance()
{
assert(m_instance != NULL);
ASSERT(m_instance != NULL);
return m_instance;
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <algorithm>
#include "console.h"
@ -59,7 +58,7 @@ Sprite* Context::get_first_sprite() const
Sprite* Context::get_next_sprite(Sprite* sprite) const
{
assert(sprite != NULL);
ASSERT(sprite != NULL);
SpriteList::const_iterator it = std::find(m_sprites.begin(), m_sprites.end(), sprite);
@ -76,7 +75,7 @@ Sprite* Context::get_next_sprite(Sprite* sprite) const
*/
void Context::add_sprite(Sprite* sprite)
{
assert(sprite != NULL);
ASSERT(sprite != NULL);
m_sprites.push_front(sprite);
@ -86,10 +85,10 @@ void Context::add_sprite(Sprite* sprite)
void Context::remove_sprite(Sprite* sprite)
{
assert(sprite != NULL);
ASSERT(sprite != NULL);
SpriteList::iterator it = std::find(m_sprites.begin(), m_sprites.end(), sprite);
assert(it != m_sprites.end());
ASSERT(it != m_sprites.end());
// remove the item from the sprites list
m_sprites.erase(it);
@ -104,10 +103,10 @@ void Context::remove_sprite(Sprite* sprite)
void Context::send_sprite_to_top(Sprite* sprite)
{
assert(sprite);
ASSERT(sprite);
SpriteList::iterator it = std::find(m_sprites.begin(), m_sprites.end(), sprite);
assert(it != m_sprites.end());
ASSERT(it != m_sprites.end());
// remove the item from the sprites list
m_sprites.erase(it);
@ -132,7 +131,7 @@ void Context::execute_command(Command* command, Params* params)
{
Console console;
assert(command != NULL);
ASSERT(command != NULL);
PRINTF("Executing '%s' command.\n", command->short_name());

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <allegro.h>
#include "jinete/jbase.h"
@ -217,14 +216,14 @@ int color_get_red(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
return _rgba_getr(get_current_palette()->getEntry(i));
}
}
assert(false);
ASSERT(false);
return -1;
}
@ -252,14 +251,14 @@ int color_get_green(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
return _rgba_getg(get_current_palette()->getEntry(i));
}
}
assert(false);
ASSERT(false);
return -1;
}
@ -287,14 +286,14 @@ int color_get_blue(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
return _rgba_getb(get_current_palette()->getEntry(i));
}
}
assert(false);
ASSERT(false);
return -1;
}
@ -322,7 +321,7 @@ int color_get_hue(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
ase_uint32 c = get_current_palette()->getEntry(i);
int r = _rgba_getr(c);
@ -334,7 +333,7 @@ int color_get_hue(color_t color)
}
assert(false);
ASSERT(false);
return -1;
}
@ -362,7 +361,7 @@ int color_get_saturation(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
ase_uint32 c = get_current_palette()->getEntry(i);
int r = _rgba_getr(c);
@ -374,7 +373,7 @@ int color_get_saturation(color_t color)
}
assert(false);
ASSERT(false);
return -1;
}
@ -402,7 +401,7 @@ int color_get_value(color_t color)
case COLOR_TYPE_INDEX: {
size_t i = GET_COLOR_DATA_INDEX(color);
assert(i >= 0 && i < get_current_palette()->size());
ASSERT(i >= 0 && i < get_current_palette()->size());
ase_uint32 c = get_current_palette()->getEntry(i);
int r = _rgba_getr(c);
@ -414,7 +413,7 @@ int color_get_value(color_t color)
}
assert(false);
ASSERT(false);
return -1;
}
@ -427,12 +426,12 @@ int color_get_index(color_t color)
case COLOR_TYPE_RGB:
PRINTF("Getting `index' from a RGB color\n"); /* TODO */
assert(false);
ASSERT(false);
break;
case COLOR_TYPE_HSV:
PRINTF("Getting `index' from a HSV color\n"); /* TODO */
assert(false);
ASSERT(false);
break;
case COLOR_TYPE_GRAY:
@ -443,7 +442,7 @@ int color_get_index(color_t color)
}
assert(false);
ASSERT(false);
return -1;
}
@ -530,7 +529,7 @@ int get_color_for_allegro(int depth, color_t color)
case COLOR_TYPE_INDEX:
c = GET_COLOR_DATA_INDEX(color);
if (depth != 8) {
assert(c >= 0 && c < (int)get_current_palette()->size());
ASSERT(c >= 0 && c < (int)get_current_palette()->size());
ase_uint32 _c = get_current_palette()->getEntry(c);
c = makeacol_depth(depth,
@ -771,7 +770,7 @@ void color_to_formalstring(int imgtype, color_t color,
break;
default:
assert(false);
ASSERT(false);
break;
}
}
@ -830,7 +829,7 @@ void color_to_formalstring(int imgtype, color_t color,
break;
default:
assert(false);
ASSERT(false);
break;
}
}

View File

@ -23,7 +23,6 @@
#include "config.h"
#include <cassert>
#include <cstdio>
#include <vector>
#include <map>
@ -259,7 +258,7 @@ FileItem* get_root_fileitem()
if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl) != S_OK) {
// TODO do something better
assert(false);
ASSERT(false);
exit(1);
}
fileitem->pidl = pidl;
@ -341,15 +340,15 @@ FileItem* get_fileitem_from_path(const jstring& path)
bool fileitem_is_folder(FileItem* fileitem)
{
assert(fileitem);
ASSERT(fileitem);
return IS_FOLDER(fileitem);
}
bool fileitem_is_browsable(FileItem* fileitem)
{
assert(fileitem);
assert(fileitem->filename != NOTINITIALIZED);
ASSERT(fileitem);
ASSERT(fileitem->filename != NOTINITIALIZED);
#ifdef USE_PIDLS
return IS_FOLDER(fileitem)
@ -363,43 +362,43 @@ bool fileitem_is_browsable(FileItem* fileitem)
jstring fileitem_get_keyname(FileItem* fileitem)
{
assert(fileitem);
assert(fileitem->keyname != NOTINITIALIZED);
ASSERT(fileitem);
ASSERT(fileitem->keyname != NOTINITIALIZED);
return fileitem->keyname;
}
jstring fileitem_get_filename(FileItem* fileitem)
{
assert(fileitem);
assert(fileitem->filename != NOTINITIALIZED);
ASSERT(fileitem);
ASSERT(fileitem->filename != NOTINITIALIZED);
return fileitem->filename;
}
jstring fileitem_get_displayname(FileItem* fileitem)
{
assert(fileitem);
assert(fileitem->displayname != NOTINITIALIZED);
ASSERT(fileitem);
ASSERT(fileitem->displayname != NOTINITIALIZED);
return fileitem->displayname;
}
FileItem* fileitem_get_parent(FileItem* fileitem)
{
assert(fileitem);
ASSERT(fileitem);
if (fileitem == rootitem)
return NULL;
else {
assert(fileitem->parent);
ASSERT(fileitem->parent);
return fileitem->parent;
}
}
const FileItemList& fileitem_get_children(FileItem* fileitem)
{
assert(fileitem);
ASSERT(fileitem);
/* is the file-item a folder? */
if (IS_FOLDER(fileitem) &&
@ -473,7 +472,7 @@ const FileItemList& fileitem_get_children(FileItem* fileitem)
put_fileitem(child);
}
else {
assert(child->parent == fileitem);
ASSERT(child->parent == fileitem);
free_pidl(fullpidl);
free_pidl(itempidl[c]);
}
@ -534,15 +533,15 @@ const FileItemList& fileitem_get_children(FileItem* fileitem)
bool fileitem_has_extension(FileItem* fileitem, const jstring& csv_extensions)
{
assert(fileitem);
assert(fileitem->filename != NOTINITIALIZED);
ASSERT(fileitem);
ASSERT(fileitem->filename != NOTINITIALIZED);
return fileitem->filename.has_extension(csv_extensions);
}
BITMAP* fileitem_get_thumbnail(FileItem* fileitem)
{
assert(fileitem);
ASSERT(fileitem);
ThumbnailMap::iterator it = thumbnail_map->find(fileitem->filename);
if (it != thumbnail_map->end())
@ -553,7 +552,7 @@ BITMAP* fileitem_get_thumbnail(FileItem* fileitem)
void fileitem_set_thumbnail(FileItem* fileitem, BITMAP* thumbnail)
{
assert(fileitem);
ASSERT(fileitem);
// destroy the current thumbnail of the file (if exists)
ThumbnailMap::iterator it = thumbnail_map->find(fileitem->filename);
@ -695,7 +694,7 @@ static void update_by_pidl(FileItem* fileitem)
if (fileitem == rootitem)
pFolder = shl_idesktop;
else {
assert(fileitem->parent);
ASSERT(fileitem->parent);
shl_idesktop->BindToObject(fileitem->parent->fullpidl,
NULL,
IID_IShellFolder,
@ -751,8 +750,8 @@ static LPITEMIDLIST concat_pidl(LPITEMIDLIST pidlHead, LPITEMIDLIST pidlTail)
LPITEMIDLIST pidlNew;
UINT cb1, cb2;
assert(pidlHead);
assert(pidlTail);
ASSERT(pidlHead);
ASSERT(pidlTail);
cb1 = get_pidl_size(pidlHead) - sizeof(pidlHead->mkid.cb);
cb2 = get_pidl_size(pidlTail);
@ -943,12 +942,12 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_
*/
static void put_fileitem(FileItem* fileitem)
{
assert(fileitem->filename != NOTINITIALIZED);
assert(fileitem->keyname == NOTINITIALIZED);
ASSERT(fileitem->filename != NOTINITIALIZED);
ASSERT(fileitem->keyname == NOTINITIALIZED);
fileitem->keyname = get_key_for_pidl(fileitem->fullpidl);
assert(fileitem->keyname != NOTINITIALIZED);
ASSERT(fileitem->keyname != NOTINITIALIZED);
// insert this file-item in the hash-table
fileitems_map->insert(std::make_pair(fileitem->keyname, fileitem));
@ -1015,7 +1014,7 @@ static void for_each_child_callback(const char *filename, int attrib, int param)
child = get_fileitem_by_path(filename, false);
if (!child) {
assert(fileitem != NULL);
ASSERT(fileitem != NULL);
child = new FileItem(fileitem);
child->filename = filename;
@ -1025,7 +1024,7 @@ static void for_each_child_callback(const char *filename, int attrib, int param)
put_fileitem(child);
}
else {
assert(child->parent == fileitem);
ASSERT(child->parent == fileitem);
}
fileitem->insert_child_sorted(child);
@ -1066,12 +1065,12 @@ static jstring get_key_for_filename(const jstring& filename)
static void put_fileitem(FileItem* fileitem)
{
assert(fileitem->filename != NOTINITIALIZED);
assert(fileitem->keyname == NOTINITIALIZED);
ASSERT(fileitem->filename != NOTINITIALIZED);
ASSERT(fileitem->keyname == NOTINITIALIZED);
fileitem->keyname = get_key_for_filename(fileitem->filename);
assert(fileitem->keyname != NOTINITIALIZED);
ASSERT(fileitem->keyname != NOTINITIALIZED);
// insert this file-item in the hash-table
fileitems_map->insert(std::make_pair(fileitem->keyname, fileitem));

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
#include "jinete/jinete.h"
@ -611,7 +610,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg)
anieditor->hot_layer >= 0 &&
anieditor->hot_layer < anieditor->nlayers) {
Layer* layer = anieditor->layers[anieditor->clk_layer];
assert(layer != NULL);
ASSERT(layer != NULL);
layer->set_readable(!layer->is_readable());
}
break;
@ -621,7 +620,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg)
anieditor->hot_layer >= 0 &&
anieditor->hot_layer < anieditor->nlayers) {
Layer* layer = anieditor->layers[anieditor->clk_layer];
assert(layer != NULL);
ASSERT(layer != NULL);
layer->set_writable(!layer->is_writable());
}
break;

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <iterator>
#include <set>
@ -149,7 +148,7 @@ jstring ase_file_selector(const jstring& message,
JWidget goup = jwidget_find_name(window, "goup");
JWidget location = jwidget_find_name(window, "location");
filetype = dynamic_cast<ComboBox*>(jwidget_find_name(window, "filetype"));
assert(filetype != NULL);
ASSERT(filetype != NULL);
filename_entry = jwidget_find_name(window, "filename");
jwidget_focusrest(goback, false);
@ -190,7 +189,7 @@ jstring ase_file_selector(const jstring& message,
else {
fileview = jwidget_find_name(window, "fileview");
filetype = dynamic_cast<ComboBox*>(jwidget_find_name(window, "filetype"));
assert(filetype != NULL);
ASSERT(filetype != NULL);
filename_entry = jwidget_find_name(window, "filename");
jwidget_signal_off(fileview);
@ -237,7 +236,7 @@ again:
window->get_killer() == fileview) {
// open the selected file
FileItem *folder = fileview_get_current_folder(fileview);
assert(folder);
ASSERT(folder);
jstring fn = filename_entry->getText();
jstring buf;
@ -363,7 +362,7 @@ static void update_location(JWidget window)
{
JWidget fileview = jwidget_find_name(window, "fileview");
ComboBox* location = dynamic_cast<ComboBox*>(jwidget_find_name(window, "location"));
assert(location != NULL);
ASSERT(location != NULL);
FileItem* current_folder = fileview_get_current_folder(fileview);
FileItem* fileitem = current_folder;
@ -466,7 +465,7 @@ static void update_navigation_buttons(JWidget window)
static void add_in_navigation_history(FileItem *folder)
{
assert(fileitem_is_folder(folder));
ASSERT(fileitem_is_folder(folder));
/* remove the history from the current position */
if (navigation_position) {
@ -495,7 +494,7 @@ static void select_filetype_from_filename(JWidget window)
{
JWidget entry = jwidget_find_name(window, "filename");
ComboBox* filetype = dynamic_cast<ComboBox*>(jwidget_find_name(window, "filetype"));
assert(filetype != NULL);
ASSERT(filetype != NULL);
const char *filename = entry->getText();
char *p = get_extension(filename);
@ -599,7 +598,7 @@ static bool location_msg_proc(JWidget widget, JMessage msg)
{
if (msg->type == JM_SIGNAL) {
ComboBox* combobox = dynamic_cast<ComboBox*>(widget);
assert(combobox != NULL);
ASSERT(combobox != NULL);
switch (msg->signal.num) {
@ -637,7 +636,7 @@ static bool filetype_msg_proc(JWidget widget, JMessage msg)
{
if (msg->type == JM_SIGNAL) {
ComboBox* combobox = dynamic_cast<ComboBox*>(widget);
assert(combobox != NULL);
ASSERT(combobox != NULL);
switch (msg->signal.num) {

View File

@ -146,7 +146,7 @@ spline_eval(int n, float x[], float y[], float y2[], float val)
h = x[k_hi] - x[k_lo];
/* TODO */
/* assert(h > 0.0); */
/* ASSERT(h > 0.0); */
a = (x[k_hi] - val) / h;
b = (val - x[k_lo]) / h;

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <cassert>
#include "jinete/jlist.h"
#include "effect/effect.h"
@ -60,7 +58,7 @@ static ImageRef* images_ref_get_from_layer(Sprite* sprite, Layer* layer, int tar
last_image = images; \
} \
else { \
assert(last_image != NULL); \
ASSERT(last_image != NULL); \
last_image->next = images; \
} \
\

View File

@ -885,7 +885,7 @@ static void read_compressed_image(FILE* f, Image* image, size_t chunk_end, FileO
if (ftell(f)+compressed.size() > chunk_end) {
input_bytes = chunk_end - ftell(f); // Remaining bytes
assert(input_bytes < compressed.size());
ASSERT(input_bytes < compressed.size());
if (input_bytes == 0)
break; // Done, we consumed all chunk

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <string.h>
#include <allegro.h>
@ -451,8 +450,8 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
*/
void fop_operate(FileOp *fop)
{
assert(fop != NULL);
assert(!fop_is_done(fop));
ASSERT(fop != NULL);
ASSERT(!fop_is_done(fop));
/* load ***********************************************************/
if (fop->type == FileOpLoad &&
@ -608,7 +607,7 @@ void fop_operate(FileOp *fop)
fop->format->save != NULL) {
/* save a sequence */
if (fop->seq.filename_list != NULL) {
assert(fop->format->flags & FILE_SUPPORT_SEQUENCES);
ASSERT(fop->format->flags & FILE_SUPPORT_SEQUENCES);
/* create a temporary bitmap */
fop->seq.image = image_new(fop->sprite->getImgType(),
@ -717,7 +716,7 @@ void fop_free(FileOp *fop)
void fop_sequence_set_format_options(FileOp *fop, FormatOptions *format_options)
{
assert(fop->seq.format_options == NULL);
ASSERT(fop->seq.format_options == NULL);
fop->seq.format_options = format_options;
}

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <assert.h>
#include "jinete/jbase.h"
#include "file/format_options.h"
@ -28,7 +26,7 @@ FormatOptions* format_options_new(int type, int size)
{
FormatOptions* format_options;
assert(size >= (int)sizeof(FormatOptions));
ASSERT(size >= (int)sizeof(FormatOptions));
format_options = (FormatOptions*)jmalloc0(size);
if (format_options == NULL)
@ -42,7 +40,7 @@ FormatOptions* format_options_new(int type, int size)
void format_options_free(FormatOptions* format_options)
{
assert(format_options != NULL);
ASSERT(format_options != NULL);
jfree(format_options);
}

View File

@ -1,4 +1,5 @@
#include <assert.h>
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -65,7 +66,7 @@ read_palette (FILE * file, GIF_PALETTE *palette)
static int lzw_read_pixel (int pos, unsigned char *data)
{
unsigned char *bitmap = data;
assert(pos >= 0);
ASSERT(pos >= 0);
return bitmap[pos];
}
@ -74,8 +75,8 @@ static int lzw_read_pixel (int pos, unsigned char *data)
static void lzw_write_pixel (int pos, int c, unsigned char *data)
{
unsigned char *bitmap = data;
assert(pos >= 0);
assert(c >= 0 && c <= 255);
ASSERT(pos >= 0);
ASSERT(c >= 0 && c <= 255);
bitmap[pos] = c;
}

View File

@ -158,7 +158,7 @@ void ComboBox::insertItem(int itemIndex, const std::string& text)
void ComboBox::removeItem(int itemIndex)
{
assert(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
Item* item = m_items[itemIndex];
@ -192,7 +192,7 @@ std::string ComboBox::getItemText(int itemIndex)
void ComboBox::setItemText(int itemIndex, const std::string& text)
{
assert(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
Item* item = m_items[itemIndex];
item->text = text;
@ -245,7 +245,7 @@ void* ComboBox::getItemData(int itemIndex)
void ComboBox::setItemData(int itemIndex, void* data)
{
assert(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
Item* item = m_items[itemIndex];
item->data = data;

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <allegro/internal/aintern.h>

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -301,7 +300,7 @@ static JWidget convert_xmlelement_to_widget(TiXmlElement* elem)
/* TODO add translatable support */
/* TODO here we need jxmlelem_get_text(elem) */
/* widget = jtextbox_new(tag->text, wordwrap ? JI_WORDWRAP: 0); */
assert(false);
ASSERT(false);
}
/* view */
else if (ustrcmp(elem_name, "view") == 0) {

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <allegro/internal/aintern.h>
#include <errno.h>
@ -625,7 +624,7 @@ static bool check_extension(const char *filename_ext)
JLink link;
int len;
assert(extensions != NULL);
ASSERT(extensions != NULL);
if (jlist_empty(extensions))
return true; /* all extensions */

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -85,7 +84,7 @@ JWidget jgrid_new(int columns, bool same_width_columns)
Grid *grid = jnew(Grid, 1);
int col;
assert(columns > 0);
ASSERT(columns > 0);
grid->same_width_columns = same_width_columns;
grid->cols = columns;
@ -133,8 +132,8 @@ void jgrid_add_child(JWidget widget, JWidget child,
{
Grid* grid = reinterpret_cast<Grid*>(jwidget_get_data(widget, JI_GRID));
assert(hspan > 0);
assert(vspan > 0);
ASSERT(hspan > 0);
ASSERT(vspan > 0);
jwidget_add_child(widget, child);
@ -360,7 +359,7 @@ static void grid_calculate_size(JWidget widget)
\
if (cell->child != NULL && cell->parent == NULL && \
cell->p_size > 0) { \
assert(cell->p_span > 0); \
ASSERT(cell->p_span > 0); \
\
if (cell->p_span == current_span) { \
expand = 0; \
@ -467,7 +466,7 @@ static void grid_distribute_size(JWidget widget, JRect rect)
for (i=0; i<grid->p_cols; ++i) { \
if (grid->p_colstrip[i].expand_count == expand_count || \
p_same_width) { \
assert(wantmore_count > 0); \
ASSERT(wantmore_count > 0); \
\
grid->p_colstrip[i].size += extra_foreach; \
extra_total -= extra_foreach; \
@ -478,8 +477,8 @@ static void grid_distribute_size(JWidget widget, JRect rect)
} \
} \
} \
assert(wantmore_count == 0); \
assert(extra_total == 0); \
ASSERT(wantmore_count == 0); \
ASSERT(extra_total == 0); \
} \
}
@ -513,8 +512,8 @@ static bool grid_put_widget_in_cell(JWidget widget, JWidget child, int hspan, in
/* if these asserts fails, it's really possible that you
specified bad values for hspan or vspan (they are
overlapping with other cells) */
assert(cell->parent == NULL);
assert(cell->child == NULL);
ASSERT(cell->parent == NULL);
ASSERT(cell->child == NULL);
cell->parent = parentcell;
cell->child = child;
@ -526,8 +525,8 @@ static bool grid_put_widget_in_cell(JWidget widget, JWidget child, int hspan, in
for (col=colbeg; col<colend; ++col) {
cell = grid->cells[row]+col;
assert(cell->parent == NULL);
assert(cell->child == NULL);
ASSERT(cell->parent == NULL);
ASSERT(cell->child == NULL);
cell->parent = parentcell;
cell->child = child;

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <vector>
#include "jinete/jmanager.h"
@ -54,7 +53,7 @@ void _ji_widgets_exit()
JWidget _ji_get_widget_by_id(JID widget_id)
{
assert((widget_id >= 0) && (widget_id < widgets->size()));
ASSERT((widget_id >= 0) && (widget_id < widgets->size()));
return (*widgets)[widget_id];
}
@ -99,7 +98,7 @@ void _ji_add_widget(JWidget widget)
void _ji_remove_widget(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
(*widgets)[widget->id] = NULL;
}

View File

@ -38,7 +38,6 @@
#include <stdio.h>
#endif
#include <assert.h>
#include <allegro.h>
#include "jinete/jinete.h"
@ -210,7 +209,7 @@ void jmanager_free(JWidget widget)
JLink link;
int c;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
/* there are some messages in queue? */
jmanager_dispatch_messages(widget);
@ -571,7 +570,7 @@ void jmanager_dispatch_messages(JWidget manager)
{
JMessage msg;
assert(manager != NULL);
ASSERT(manager != NULL);
/* add the "Queue Processing" message for the manager */
msg = new_mouse_msg(JM_QUEUEPROCESSING, manager);
@ -590,7 +589,7 @@ int jmanager_add_timer(JWidget widget, int interval)
Timer *timer;
int c, new_id = -1;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
for (c=0; c<n_timers; ++c) {
/* there are an empty slot */
@ -619,8 +618,8 @@ void jmanager_remove_timer(int timer_id)
JMessage message;
JLink link, next;
assert(timer_id >= 0 && timer_id < n_timers);
assert(timers[timer_id] != NULL);
ASSERT(timer_id >= 0 && timer_id < n_timers);
ASSERT(timers[timer_id] != NULL);
jfree(timers[timer_id]);
timers[timer_id] = NULL;
@ -640,32 +639,32 @@ void jmanager_remove_timer(int timer_id)
void jmanager_start_timer(int timer_id)
{
assert(timer_id >= 0 && timer_id < n_timers);
assert(timers[timer_id] != NULL);
ASSERT(timer_id >= 0 && timer_id < n_timers);
ASSERT(timers[timer_id] != NULL);
timers[timer_id]->last_time = ji_clock;
}
void jmanager_stop_timer(int timer_id)
{
assert(timer_id >= 0 && timer_id < n_timers);
assert(timers[timer_id] != NULL);
ASSERT(timer_id >= 0 && timer_id < n_timers);
ASSERT(timers[timer_id] != NULL);
timers[timer_id]->last_time = -1;
}
void jmanager_set_timer_interval(int timer_id, int interval)
{
assert(timer_id >= 0 && timer_id < n_timers);
assert(timers[timer_id] != NULL);
ASSERT(timer_id >= 0 && timer_id < n_timers);
ASSERT(timers[timer_id] != NULL);
timers[timer_id]->interval = interval;
}
bool jmanager_timer_is_running(int timer_id)
{
assert(timer_id >= 0 && timer_id < n_timers);
assert(timers[timer_id] != NULL);
ASSERT(timer_id >= 0 && timer_id < n_timers);
ASSERT(timers[timer_id] != NULL);
return (timers[timer_id]->last_time >= 0);
}
@ -679,8 +678,8 @@ void jmanager_enqueue_message(JMessage msg)
{
int c;
assert(msg_queue != NULL);
assert(msg != NULL);
ASSERT(msg_queue != NULL);
ASSERT(msg != NULL);
/* check if this message must be filtered by some widget before */
c = msg->type;
@ -1082,8 +1081,8 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
switch (msg->type) {
case JM_DEFERREDFREE:
assert_valid_widget(msg->deffree.widget_to_free);
assert(msg->deffree.widget_to_free != widget);
ASSERT_VALID_WIDGET(msg->deffree.widget_to_free);
ASSERT(msg->deffree.widget_to_free != widget);
jwidget_free(msg->deffree.widget_to_free);
return true;
@ -1194,7 +1193,7 @@ static void manager_pump_queue(JWidget widget_manager)
/* TODO get the msg_queue from 'widget_manager' */
assert(msg_queue != NULL);
ASSERT(msg_queue != NULL);
link = jlist_first(msg_queue);
while (link != msg_queue->end) {
@ -1268,7 +1267,7 @@ static void manager_pump_queue(JWidget widget_manager)
acquire_bitmap(ji_screen);
/* set clip */
assert(get_clip_state(ji_screen));
ASSERT(get_clip_state(ji_screen));
set_clip_rect(ji_screen,
msg->draw.rect.x1, msg->draw.rect.y1,
msg->draw.rect.x2-1, msg->draw.rect.y2-1);

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -48,31 +47,31 @@
void *jmalloc(unsigned long n_bytes)
{
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
return malloc(n_bytes);
}
void *jmalloc0(unsigned long n_bytes)
{
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
return calloc(1, n_bytes);
}
void *jrealloc(void *mem, unsigned long n_bytes)
{
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
return realloc(mem, n_bytes);
}
void jfree(void *mem)
{
assert(mem != NULL);
ASSERT(mem != NULL);
free(mem);
}
char *jstrdup(const char *string)
{
assert(string != NULL);
ASSERT(string != NULL);
return ustrdup(string);
}
@ -142,7 +141,7 @@ static Mutex mutex;
void _jmemleak_init()
{
assert(!memleak_status);
ASSERT(!memleak_status);
headslot = NULL;
mutex = new Mutex();
@ -152,7 +151,7 @@ void _jmemleak_init()
void _jmemleak_exit()
{
assert(memleak_status);
ASSERT(memleak_status);
memleak_status = false;
FILE* f = fopen("_ase_memlog.txt", "wt");
@ -221,8 +220,8 @@ static void addslot(void *ptr, unsigned long size)
slot_t* p = reinterpret_cast<slot_t*>(malloc(sizeof(slot_t)));
assert(ptr != NULL);
assert(size != 0);
ASSERT(ptr != NULL);
ASSERT(size != 0);
// __builtin_return_address is a GCC extension
#if defined(__GNUC__)
@ -250,7 +249,7 @@ static void delslot(void *ptr)
slot_t *it, *prev = NULL;
assert(ptr != NULL);
ASSERT(ptr != NULL);
ScopedLock lock(mutex);
@ -271,7 +270,7 @@ void *jmalloc(unsigned long n_bytes)
{
void *mem;
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
mem = malloc(n_bytes);
if (mem != NULL) {
@ -286,7 +285,7 @@ void *jmalloc0(unsigned long n_bytes)
{
void *mem;
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
mem = calloc(1, n_bytes);
if (mem != NULL) {
@ -301,7 +300,7 @@ void *jrealloc(void *mem, unsigned long n_bytes)
{
void *newmem;
assert(n_bytes != 0);
ASSERT(n_bytes != 0);
newmem = realloc(mem, n_bytes);
if (newmem != NULL) {
@ -317,7 +316,7 @@ void *jrealloc(void *mem, unsigned long n_bytes)
void jfree(void *mem)
{
assert(mem != NULL);
ASSERT(mem != NULL);
delslot(mem);
free(mem);
}
@ -326,7 +325,7 @@ char* jstrdup(const char *string)
{
char* mem;
assert(string != NULL);
ASSERT(string != NULL);
mem = ustrdup(string);
if (mem != NULL)

View File

@ -32,7 +32,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
@ -211,7 +210,7 @@ JWidget jmenuitem_new(const char *text)
JWidget jmenubox_get_menu(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (jlist_empty(widget->children))
return NULL;
@ -221,7 +220,7 @@ JWidget jmenubox_get_menu(JWidget widget)
JWidget jmenubar_get_menu(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return jmenubox_get_menu(widget);
}
@ -230,7 +229,7 @@ JWidget jmenuitem_get_submenu(JWidget widget)
{
MenuItem *menuitem;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
menuitem = MITEM(widget);
@ -239,14 +238,14 @@ JWidget jmenuitem_get_submenu(JWidget widget)
JAccel jmenuitem_get_accel(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return MITEM(widget)->accel;
}
bool jmenuitem_has_submenu_opened(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return MITEM(widget)->submenu_menubox != NULL;
}
@ -255,21 +254,21 @@ void jmenubox_set_menu(JWidget widget, JWidget widget_menu)
{
JWidget old_menu;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
old_menu = jmenubox_get_menu(widget);
if (old_menu)
jwidget_remove_child(widget, old_menu);
if (widget_menu) {
assert_valid_widget(widget_menu);
ASSERT_VALID_WIDGET(widget_menu);
jwidget_add_child(widget, widget_menu);
}
}
void jmenubar_set_menu(JWidget widget, JWidget widget_menu)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
jmenubox_set_menu(widget, widget_menu);
}
@ -278,7 +277,7 @@ void jmenuitem_set_submenu(JWidget widget, JWidget widget_menu)
{
MenuItem *menuitem;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
menuitem = MITEM(widget);
@ -288,7 +287,7 @@ void jmenuitem_set_submenu(JWidget widget, JWidget widget_menu)
menuitem->submenu = widget_menu;
if (menuitem->submenu) {
assert_valid_widget(widget_menu);
ASSERT_VALID_WIDGET(widget_menu);
MENU(menuitem->submenu)->menuitem = widget;
}
}
@ -304,7 +303,7 @@ void jmenuitem_set_accel(JWidget widget, JAccel accel)
{
MenuItem *menuitem;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
menuitem = MITEM(widget);
if (menuitem->accel)
@ -315,7 +314,7 @@ void jmenuitem_set_accel(JWidget widget, JAccel accel)
int jmenuitem_is_highlight(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return MITEM(widget)->highlight;
}
@ -372,14 +371,14 @@ static bool menu_msg_proc(JWidget widget, JMessage msg)
case JM_DESTROY: {
Menu *menu = MENU(widget);
assert(menu != NULL);
ASSERT(menu != NULL);
if (menu->menuitem) {
if (MITEM(menu->menuitem)->submenu == widget) {
MITEM(menu->menuitem)->submenu = NULL;
}
else {
assert(MITEM(menu->menuitem)->submenu == NULL);
ASSERT(MITEM(menu->menuitem)->submenu == NULL);
}
}
@ -469,7 +468,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
case JM_DESTROY: {
MenuBox* menubox = reinterpret_cast<MenuBox*>(jwidget_get_data(widget, JI_MENUBOX));
assert(menubox != NULL);
ASSERT(menubox != NULL);
if (menubox->base != NULL &&
menubox->base->is_filtering) {
@ -813,7 +812,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
switch (msg->type) {
case JM_DESTROY:
assert(menuitem != NULL);
ASSERT(menuitem != NULL);
if (menuitem->accel)
jaccel_free(menuitem->accel);
@ -846,9 +845,9 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
JRect pos, old_pos;
bool select_first = msg->user.a ? true: false;
assert(base != NULL);
assert(base->is_processing);
assert(HAS_SUBMENU(widget));
ASSERT(base != NULL);
ASSERT(base->is_processing);
ASSERT(HAS_SUBMENU(widget));
old_pos = jwidget_get_rect(widget->parent->parent);
@ -959,16 +958,16 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
Widget* menubox;
bool last_of_close_chain = msg->user.a ? true: false;
assert(base != NULL);
assert(base->is_processing);
ASSERT(base != NULL);
ASSERT(base->is_processing);
menubox = menuitem->submenu_menubox;
menuitem->submenu_menubox = NULL;
assert(menubox != NULL);
ASSERT(menubox != NULL);
window = (Frame*)menubox->parent;
assert(window && window->type == JI_FRAME);
ASSERT(window && window->type == JI_FRAME);
/* fetch the "menu" to avoid free it with 'jwidget_free()' */
jmenubox_set_menu(menubox, NULL);
@ -1039,7 +1038,7 @@ static void menuitem_request_size(JWidget widget, int *w, int *h)
static JWidget get_base_menubox(JWidget widget)
{
while (widget != NULL) {
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
/* we are in a menubox */
if (widget->type == JI_MENUBOX || widget->type == JI_MENUBAR) {
@ -1049,23 +1048,23 @@ static JWidget get_base_menubox(JWidget widget)
else {
JWidget menu = jmenubox_get_menu(widget);
assert(menu != NULL);
assert(MENU(menu)->menuitem != NULL);
ASSERT(menu != NULL);
ASSERT(MENU(menu)->menuitem != NULL);
widget = MENU(menu)->menuitem;
}
}
/* we are in a menuitem */
else {
assert(widget->type == JI_MENUITEM);
assert(widget->parent != NULL);
assert(widget->parent->type == JI_MENU);
ASSERT(widget->type == JI_MENUITEM);
ASSERT(widget->parent != NULL);
ASSERT(widget->parent->type == JI_MENU);
widget = widget->parent->parent;
}
}
assert(false);
ASSERT(false);
return NULL;
}
@ -1172,15 +1171,15 @@ static void open_menuitem(JWidget menuitem, bool select_first)
JLink link;
Base *base;
assert_valid_widget(menuitem);
assert(HAS_SUBMENU(menuitem));
ASSERT_VALID_WIDGET(menuitem);
ASSERT(HAS_SUBMENU(menuitem));
menu = menuitem->parent;
/* the menu item is already opened? */
assert(MITEM(menuitem)->submenu_menubox == NULL);
ASSERT(MITEM(menuitem)->submenu_menubox == NULL);
assert_valid_widget(menu);
ASSERT_VALID_WIDGET(menu);
/* close all siblings of 'menuitem' */
if (menu->parent) {
@ -1203,7 +1202,7 @@ static void open_menuitem(JWidget menuitem, bool select_first)
/* get the 'base' */
base = get_base(menuitem);
assert(base != NULL);
ASSERT(base != NULL);
/* reset flags */
base->close_all = false;
@ -1226,12 +1225,12 @@ static void close_menuitem(JWidget menuitem, bool last_of_close_chain)
JLink link;
Base *base;
assert_valid_widget(menuitem);
assert(MITEM(menuitem)->submenu_menubox != NULL);
ASSERT_VALID_WIDGET(menuitem);
ASSERT(MITEM(menuitem)->submenu_menubox != NULL);
/* first: recursively close the children */
menu = jmenubox_get_menu(MITEM(menuitem)->submenu_menubox);
assert(menu != NULL);
ASSERT(menu != NULL);
JI_LIST_FOR_EACH(menu->children, link) {
child = reinterpret_cast<JWidget>(link->data);
@ -1252,7 +1251,7 @@ static void close_menuitem(JWidget menuitem, bool last_of_close_chain)
/* get the 'base' */
base = get_base(menuitem);
assert(base != NULL);
ASSERT(base != NULL);
/* start processing */
base->is_processing = true;
@ -1272,7 +1271,7 @@ static void close_all(JWidget menu)
JLink link;
Base *base;
assert(menu != NULL);
ASSERT(menu != NULL);
while (MENU(menu)->menuitem != NULL) {
menuitem = MENU(menu)->menuitem;

View File

@ -33,7 +33,6 @@
#include <allegro/keyboard.h>
#include <string.h>
#include <assert.h>
#include "jinete/jlist.h"
#include "jinete/jmanager.h"
@ -93,7 +92,7 @@ JMessage jmessage_new_copy(const JMessage msg)
{
JMessage copy;
assert(msg != NULL);
ASSERT(msg != NULL);
copy = jnew(union jmessage, 1);
if (!copy)
@ -111,7 +110,7 @@ JMessage jmessage_new_copy_without_dests(const JMessage msg)
{
JMessage copy;
assert(msg != NULL);
ASSERT(msg != NULL);
copy = jnew(union jmessage, 1);
if (!copy)
@ -127,7 +126,7 @@ JMessage jmessage_new_copy_without_dests(const JMessage msg)
void jmessage_free(JMessage msg)
{
assert(msg != NULL);
ASSERT(msg != NULL);
jlist_free(msg->any.widgets);
jfree(msg);
@ -135,16 +134,16 @@ void jmessage_free(JMessage msg)
void jmessage_add_dest(JMessage msg, JWidget widget)
{
assert(msg != NULL);
assert_valid_widget(widget);
ASSERT(msg != NULL);
ASSERT_VALID_WIDGET(widget);
jlist_append(msg->any.widgets, widget);
}
void jmessage_add_pre_dest(JMessage msg, JWidget widget)
{
assert(msg != NULL);
assert_valid_widget(widget);
ASSERT(msg != NULL);
ASSERT_VALID_WIDGET(widget);
jlist_prepend(msg->any.widgets, widget);
}
@ -153,8 +152,8 @@ void jmessage_broadcast_to_children(JMessage msg, JWidget widget)
{
JLink link;
assert(msg != NULL);
assert_valid_widget(widget);
ASSERT(msg != NULL);
ASSERT_VALID_WIDGET(widget);
JI_LIST_FOR_EACH(widget->children, link)
jmessage_broadcast_to_children(msg, reinterpret_cast<JWidget>(link->data));
@ -164,8 +163,8 @@ void jmessage_broadcast_to_children(JMessage msg, JWidget widget)
void jmessage_broadcast_to_parents(JMessage msg, JWidget widget)
{
assert(msg != NULL);
assert_valid_widget(widget);
ASSERT(msg != NULL);
ASSERT_VALID_WIDGET(widget);
if (widget && widget->type != JI_MANAGER) {
jmessage_add_dest(msg, widget);

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include "jinete/jinete.h"
@ -79,7 +78,7 @@ PopupWindow::~PopupWindow()
*/
void PopupWindow::setHotRegion(JRegion region)
{
assert(region != NULL);
ASSERT(region != NULL);
if (m_hot_region != NULL)
jregion_free(m_hot_region);

View File

@ -43,6 +43,7 @@
#include "jinete/jbase.h"
#include "jinete/jrect.h"
#include "jinete/jregion.h"
#define Bool bool
#define BoxRec struct jrect
#define RegDataRec struct jregion_data
@ -129,5 +130,8 @@ struct ji_point { int x, y; };
#define miRegionEmpty jregion_empty
#define miRegionExtents jregion_extents
#undef assert
#define assert ASSERT
#include "miregion.cpp"

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#ifdef ALLEGRO_WINDOWS
#include <winalleg.h>
@ -167,7 +166,7 @@ void ji_add_dirty_rect(JRect rect)
{
JRegion reg1;
assert(ji_dirty_region != NULL);
ASSERT(ji_dirty_region != NULL);
reg1 = jregion_new(rect, 1);
jregion_union(ji_dirty_region, ji_dirty_region, reg1);
@ -176,7 +175,7 @@ void ji_add_dirty_rect(JRect rect)
void ji_add_dirty_region(JRegion region)
{
assert(ji_dirty_region != NULL);
ASSERT(ji_dirty_region != NULL);
jregion_union(ji_dirty_region, ji_dirty_region, region);
}
@ -186,7 +185,7 @@ void ji_flip_dirty_region()
int c, nrects;
JRect rc;
assert(ji_dirty_region != NULL);
ASSERT(ji_dirty_region != NULL);
nrects = JI_REGION_NUM_RECTS(ji_dirty_region);
@ -206,7 +205,7 @@ void ji_flip_dirty_region()
void ji_flip_rect(JRect rect)
{
assert(ji_screen != screen);
ASSERT(ji_screen != screen);
if (JI_SCREEN_W == SCREEN_W && JI_SCREEN_H == SCREEN_H) {
blit(ji_screen, screen,
@ -325,7 +324,7 @@ void jmouse_draw_cursor()
void jmouse_hide()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
if (ji_screen == screen)
scare_mouse();
@ -337,7 +336,7 @@ void jmouse_hide()
void jmouse_show()
{
assert(mouse_scares > 0);
ASSERT(mouse_scares > 0);
mouse_scares--;
if (ji_screen == screen)
@ -346,13 +345,13 @@ void jmouse_show()
bool jmouse_is_hidden()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
return mouse_scares > 0;
}
bool jmouse_is_shown()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
return mouse_scares == 0;
}
@ -493,7 +492,7 @@ static void update_mouse_position()
static void capture_covered_area()
{
if (sprite_cursor != NULL && mouse_scares == 0) {
assert(covered_area == NULL);
ASSERT(covered_area == NULL);
covered_area = create_bitmap(sprite_cursor->w, sprite_cursor->h);
covered_area_x = m_x[0]-focus_x;

View File

@ -32,7 +32,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
#include "jinete/jthread.h"

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include "jinete/jinete.h"
@ -42,7 +41,7 @@ void jwidget_add_tooltip_text(JWidget widget, const char *text)
{
TipData* tip = reinterpret_cast<TipData*>(jwidget_get_data(widget, tip_type()));
assert(text != NULL);
ASSERT(text != NULL);
if (tip == NULL) {
tip = jnew(TipData, 1);
@ -185,7 +184,7 @@ TipWindow::~TipWindow()
*/
void TipWindow::set_hotregion(JRegion region)
{
assert(region != NULL);
ASSERT(region != NULL);
if (m_hot_region != NULL)
jregion_free(m_hot_region);

View File

@ -33,7 +33,6 @@
#include "config.h"
#include <cassert>
#include <cctype>
#include <climits>
#include <cstdarg>
@ -102,7 +101,7 @@ Widget::Widget(int type)
void jwidget_free(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
delete widget;
}
@ -158,7 +157,7 @@ void jwidget_free_deferred(JWidget widget)
{
JMessage msg;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
msg = jmessage_new(JM_DEFERREDFREE);
msg->deffree.widget_to_free = widget;
@ -169,7 +168,7 @@ void jwidget_free_deferred(JWidget widget)
void jwidget_init_theme(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (widget->theme) {
widget->theme->init_widget(widget);
@ -194,7 +193,7 @@ void jwidget_add_hook(JWidget widget, int type,
{
JHook hook;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
hook = jhook_new();
hook->type = type;
@ -210,7 +209,7 @@ void jwidget_add_hook(JWidget widget, int type,
JHook jwidget_get_hook(JWidget widget, int type)
{
JLink link;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
JI_LIST_FOR_EACH(widget->hooks, link) {
if (((JHook)link->data)->type == type)
@ -225,7 +224,7 @@ JHook jwidget_get_hook(JWidget widget, int type)
void *jwidget_get_data(JWidget widget, int type)
{
register JLink link;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
JI_LIST_FOR_EACH(widget->hooks, link) {
if (((JHook)link->data)->type == type)
@ -333,7 +332,7 @@ void Widget::setFont(FONT* f)
void jwidget_magnetic(JWidget widget, bool state)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (state)
widget->flags |= JI_MAGNETIC;
@ -343,7 +342,7 @@ void jwidget_magnetic(JWidget widget, bool state)
void jwidget_expansive(JWidget widget, bool state)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (state)
widget->flags |= JI_EXPANSIVE;
@ -353,7 +352,7 @@ void jwidget_expansive(JWidget widget, bool state)
void jwidget_decorative(JWidget widget, bool state)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (state)
widget->flags |= JI_DECORATIVE;
@ -363,7 +362,7 @@ void jwidget_decorative(JWidget widget, bool state)
void jwidget_focusrest(JWidget widget, bool state)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (state)
widget->flags |= JI_FOCUSREST;
@ -373,28 +372,28 @@ void jwidget_focusrest(JWidget widget, bool state)
bool jwidget_is_magnetic(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return (widget->flags & JI_MAGNETIC) ? true: false;
}
bool jwidget_is_expansive(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return (widget->flags & JI_EXPANSIVE) ? true: false;
}
bool jwidget_is_decorative(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return (widget->flags & JI_DECORATIVE) ? true: false;
}
bool jwidget_is_focusrest(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return (widget->flags & JI_FOCUSREST) ? true: false;
}
@ -404,7 +403,7 @@ bool jwidget_is_focusrest(JWidget widget)
void jwidget_dirty(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
jwidget_invalidate(widget);
}
@ -508,8 +507,8 @@ bool Widget::isSelected() const
void jwidget_add_child(JWidget widget, JWidget child)
{
assert_valid_widget(widget);
assert_valid_widget(child);
ASSERT_VALID_WIDGET(widget);
ASSERT_VALID_WIDGET(child);
jlist_append(widget->children, child);
child->parent = widget;
@ -522,7 +521,7 @@ void jwidget_add_children(JWidget widget, ...)
JWidget child;
va_list ap;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
va_start(ap, widget);
@ -534,8 +533,8 @@ void jwidget_add_children(JWidget widget, ...)
void jwidget_remove_child(JWidget widget, JWidget child)
{
assert_valid_widget(widget);
assert_valid_widget(child);
ASSERT_VALID_WIDGET(widget);
ASSERT_VALID_WIDGET(child);
jlist_remove(widget->children, child);
child->parent = NULL;
@ -545,9 +544,9 @@ void jwidget_replace_child(JWidget widget, JWidget old_child, JWidget new_child)
{
JLink before;
assert_valid_widget(widget);
assert_valid_widget(old_child);
assert_valid_widget(new_child);
ASSERT_VALID_WIDGET(widget);
ASSERT_VALID_WIDGET(old_child);
ASSERT_VALID_WIDGET(new_child);
before = jlist_find(widget->children, old_child);
if (!before)
@ -664,7 +663,7 @@ Widget* Widget::pick(int x, int y)
bool Widget::hasChild(Widget* child)
{
assert_valid_widget(child);
ASSERT_VALID_WIDGET(child);
return jlist_find(this->children, child) != this->children->end ? true: false;
}
@ -719,7 +718,7 @@ void jwidget_relayout(JWidget widget)
/* gets the position of the widget */
JRect jwidget_get_rect(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return jrect_new_copy(widget->rc);
}
@ -727,7 +726,7 @@ JRect jwidget_get_rect(JWidget widget)
/* gets the position for children of the widget */
JRect jwidget_get_child_rect(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return jrect_new(widget->rc->x1 + widget->border_width.l,
widget->rc->y1 + widget->border_width.t,
@ -739,7 +738,7 @@ JRegion jwidget_get_region(JWidget widget)
{
JRegion region;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (widget->type == JI_FRAME)
region = widget->theme->get_window_mask(widget);
@ -758,7 +757,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags)
JLink link;
JRect cpos;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
region = jwidget_get_region(widget);
@ -871,14 +870,14 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags)
int jwidget_get_bg_color(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return widget->getBgColor();
}
JTheme jwidget_get_theme(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return widget->theme;
}
@ -894,7 +893,7 @@ int jwidget_get_text_length(JWidget widget)
int jwidget_get_text_height(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return text_height(widget->getFont());
}
@ -914,7 +913,7 @@ void jwidget_get_texticon_info(JWidget widget,
int box_x, box_y, box_w, box_h, icon_x, icon_y;
int text_x, text_y, text_w, text_h;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
text_x = text_y = 0;
@ -1015,7 +1014,7 @@ void jwidget_noborders(JWidget widget)
void jwidget_set_border(JWidget widget, int value)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->border_width.l = value;
widget->border_width.t = value;
@ -1027,7 +1026,7 @@ void jwidget_set_border(JWidget widget, int value)
void jwidget_set_border(JWidget widget, int l, int t, int r, int b)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->border_width.l = l;
widget->border_width.t = t;
@ -1041,7 +1040,7 @@ void jwidget_set_rect(JWidget widget, JRect rect)
{
JMessage msg;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
msg = jmessage_new(JM_SETPOS);
jrect_copy(&msg->setpos.rect, rect);
@ -1051,7 +1050,7 @@ void jwidget_set_rect(JWidget widget, JRect rect)
void jwidget_set_min_size(JWidget widget, int w, int h)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->min_w = w;
widget->min_h = h;
@ -1059,7 +1058,7 @@ void jwidget_set_min_size(JWidget widget, int w, int h)
void jwidget_set_max_size(JWidget widget, int w, int h)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->max_w = w;
widget->max_h = h;
@ -1067,14 +1066,14 @@ void jwidget_set_max_size(JWidget widget, int w, int h)
void jwidget_set_bg_color(JWidget widget, int color)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->setBgColor(color);
}
void jwidget_set_theme(JWidget widget, JTheme theme)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->theme = theme;
/* TODO mmhhh... maybe some JStyle in JWidget should be great */
@ -1098,7 +1097,7 @@ void jwidget_flush_redraw(JWidget widget)
widget = processing.front();
processing.pop();
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
// If the widget is hidden
if (!widget->isVisible())
@ -1138,7 +1137,7 @@ void jwidget_flush_redraw(JWidget widget)
void jwidget_invalidate(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (widget->isVisible()) {
JRegion reg1 = jwidget_get_drawable_region(widget, JI_GDR_CUTTOPWINDOWS);
@ -1154,7 +1153,7 @@ void jwidget_invalidate(JWidget widget)
void jwidget_invalidate_rect(JWidget widget, const JRect rect)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (widget->isVisible()) {
JRegion reg1 = jregion_new(rect, 1);
@ -1165,7 +1164,7 @@ void jwidget_invalidate_rect(JWidget widget, const JRect rect)
void jwidget_invalidate_region(JWidget widget, const JRegion region)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (widget->isVisible() &&
jregion_rect_in(region, widget->rc) != JI_RGNOUT) {
@ -1219,21 +1218,21 @@ void jwidget_scroll(JWidget widget, JRegion region, int dx, int dy)
void jwidget_signal_on(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->emit_signals--;
}
void jwidget_signal_off(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
widget->emit_signals++;
}
bool jwidget_emit_signal(JWidget widget, int signal_num)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
if (!widget->emit_signals) {
JMessage msg;
@ -1278,7 +1277,7 @@ bool Widget::sendMessage(JMessage msg)
JHook hook;
JLink link;
assert(msg != NULL);
ASSERT(msg != NULL);
JI_LIST_FOR_EACH(this->hooks, link) {
hook = reinterpret_cast<JHook>(link->data);
@ -1440,7 +1439,7 @@ bool Widget::hasCapture()
JWidget jwidget_find_name(JWidget widget, const char *name)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
return widget->findChild(name);
}
@ -1448,7 +1447,7 @@ bool jwidget_check_underscored(JWidget widget, int scancode)
{
int c, ascii;
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
ascii = 0;
if (scancode >= KEY_0 && scancode <= KEY_9)
@ -1477,8 +1476,8 @@ bool Widget::onProcessMessage(JMessage msg)
{
JWidget widget = this;
assert(msg != NULL);
assert_valid_widget(widget);
ASSERT(msg != NULL);
ASSERT_VALID_WIDGET(widget);
switch (msg->type) {

View File

@ -43,10 +43,10 @@ namespace Vaca { class PreferredSizeEvent; }
#ifndef NDEBUG
#include "jinete/jintern.h"
#define assert_valid_widget(widget) assert((widget) != NULL && \
#define ASSERT_VALID_WIDGET(widget) ASSERT((widget) != NULL && \
_ji_is_valid_widget((widget)))
#else
#define assert_valid_widget(widget) ((void)0)
#define ASSERT_VALID_WIDGET(widget) ((void)0)
#endif
using Vaca::Rect;

View File

@ -805,7 +805,7 @@ void jstandard_theme::draw_menuitem(JWidget widget, JRect clip)
int x1, y1, x2, y2;
JRect pos;
/* TODO assert? */
/* TODO ASSERT? */
if (!widget->parent->parent)
return;

View File

@ -76,7 +76,7 @@ void remove_editor(Editor* editor)
{
EditorList::iterator it = std::find(editors.begin(), editors.end(), editor);
assert(it != editors.end());
ASSERT(it != editors.end());
editors.erase(it);
}
@ -340,7 +340,7 @@ void close_editor(Editor* editor)
if (!current_editor) {
JWidget next_editor = find_next_editor(other_widget);
if (next_editor) {
assert(next_editor->type == editor_type());
ASSERT(next_editor->type == editor_type());
set_current_editor(static_cast<Editor*>(next_editor));
}

View File

@ -21,7 +21,6 @@
#include <algorithm>
#include <allegro.h>
#include <allegro/internal/aintern.h>
#include <cassert>
#include <list>
#include <vector>
@ -338,7 +337,7 @@ int init_module_gui()
void exit_module_gui()
{
// destroy shortcuts
assert(shortcuts != NULL);
ASSERT(shortcuts != NULL);
for (std::vector<Shortcut*>::iterator
it = shortcuts->begin(); it != shortcuts->end(); ++it) {
Shortcut* shortcut = *it;
@ -348,7 +347,7 @@ void exit_module_gui()
shortcuts = NULL;
// destroy monitors
assert(monitors != NULL);
ASSERT(monitors != NULL);
for (MonitorList::iterator
it2 = monitors->begin(); it2 != monitors->end(); ++it2) {
Monitor* monitor = *it2;
@ -1042,7 +1041,7 @@ void remove_gui_monitor(Monitor* monitor)
MonitorList::iterator it =
std::find(monitors->begin(), monitors->end(), monitor);
assert(it != monitors->end());
ASSERT(it != monitors->end());
if (!monitor->lock)
delete monitor;

View File

@ -19,7 +19,6 @@
#ifndef MODULES_GUI_H_INCLUDED
#define MODULES_GUI_H_INCLUDED
#include <cassert>
#include <string>
#include <list>
#include "ase_exception.h"
@ -160,7 +159,7 @@ public:
}
T* operator->() {
assert(m_ptr != NULL);
ASSERT(m_ptr != NULL);
return m_ptr;
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <string.h>
@ -117,10 +116,10 @@ void set_current_color(int index, int r, int g, int b)
{
register int c;
assert(index >= 0 && index <= 255);
assert(r >= 0 && r <= 255);
assert(g >= 0 && g <= 255);
assert(b >= 0 && b <= 255);
ASSERT(index >= 0 && index <= 255);
ASSERT(r >= 0 && r <= 255);
ASSERT(g >= 0 && g <= 255);
ASSERT(b >= 0 && b <= 255);
c = ase_current_palette->getEntry(index);

View File

@ -237,7 +237,7 @@ static int load_root_menu()
static JWidget load_menu_by_id(TiXmlHandle& handle, const char* id)
{
assert(id != NULL);
ASSERT(id != NULL);
//PRINTF("load_menu_by_id(%s)\n", id);

View File

@ -353,7 +353,7 @@ BITMAP* SkinneableTheme::set_cursor(int type, int* focus_x, int* focus_y)
return NULL;
}
else {
assert(type >= 0 && type < JI_CURSORS);
ASSERT(type >= 0 && type < JI_CURSORS);
*focus_x = cursors_info[type].focusx*jguiscale();
*focus_y = cursors_info[type].focusy*jguiscale();
@ -425,7 +425,7 @@ void SkinneableTheme::init_widget(JWidget widget)
case JI_COMBOBOX:
{
ComboBox* combobox = dynamic_cast<ComboBox*>(widget);
assert(combobox != NULL);
ASSERT(combobox != NULL);
Widget* button = combobox->getButtonWidget();
@ -904,7 +904,7 @@ void SkinneableTheme::draw_menuitem(JWidget widget, JRect clip)
int x1, y1, x2, y2;
JRect pos;
/* TODO assert? */
/* TODO ASSERT? */
if (!widget->parent->parent)
return;

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <cassert>
#include "raster/cel.h"
#include "raster/layer.h"
@ -58,13 +56,13 @@ Cel* cel_new(int frame, int image)
Cel* cel_new_copy(const Cel* cel)
{
assert(cel);
ASSERT(cel);
return new Cel(*cel);
}
void cel_free(Cel* cel)
{
assert(cel);
ASSERT(cel);
delete cel;
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <cstring>
#include <map>
#include <utility>
@ -46,7 +45,7 @@ RasterModule::RasterModule()
RasterModule::~RasterModule()
{
assert(objects_map->empty());
ASSERT(objects_map->empty());
delete objects_map;
delete objects_mutex;
}
@ -104,8 +103,8 @@ GfxObj* gfxobj_find(gfxobj_id id)
void _gfxobj_set_id(GfxObj* gfxobj, gfxobj_id id)
{
assert(gfxobj_find(gfxobj->id) == gfxobj);
assert(gfxobj_find(id) == NULL);
ASSERT(gfxobj_find(gfxobj->id) == gfxobj);
ASSERT(gfxobj_find(id) == NULL);
ScopedLock lock(*objects_mutex);
@ -126,7 +125,7 @@ static void erase_gfxobj(GfxObj* gfxobj)
std::map<gfxobj_id, GfxObj*>::iterator
it = objects_map->find(gfxobj->id);
assert(it != objects_map->end());
ASSERT(it != objects_map->end());
objects_map->erase(it);
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <string.h>
#include <stdexcept>
@ -65,13 +64,13 @@ Image* image_new(int imgtype, int w, int h)
Image* image_new_copy(const Image* image)
{
assert(image);
ASSERT(image);
return image_crop(image, 0, 0, image->w, image->h, 0);
}
void image_free(Image* image)
{
assert(image);
ASSERT(image);
delete image;
}
@ -158,8 +157,8 @@ void image_rotate(const Image* src, Image* dst, int angle)
switch (angle) {
case 180:
assert(dst->w == src->w);
assert(dst->h == src->h);
ASSERT(dst->w == src->w);
ASSERT(dst->h == src->h);
for (y=0; y<src->h; ++y)
for (x=0; x<src->w; ++x)
@ -168,8 +167,8 @@ void image_rotate(const Image* src, Image* dst, int angle)
break;
case 90:
assert(dst->w == src->h);
assert(dst->h == src->w);
ASSERT(dst->w == src->h);
ASSERT(dst->h == src->w);
for (y=0; y<src->h; ++y)
for (x=0; x<src->w; ++x)
@ -177,8 +176,8 @@ void image_rotate(const Image* src, Image* dst, int angle)
break;
case -90:
assert(dst->w == src->h);
assert(dst->h == src->w);
ASSERT(dst->w == src->h);
ASSERT(dst->h == src->w);
for (y=0; y<src->h; ++y)
for (x=0; x<src->w; ++x)

View File

@ -19,8 +19,6 @@
#ifndef RASTER_IMAGE_IMPL_H_INCLUDED
#define RASTER_IMAGE_IMPL_H_INCLUDED
#include <cassert>
#include "raster/image.h"
#include "raster/palette.h"
@ -41,12 +39,12 @@ public: // raw access to pixel-data
}
inline address_t line_address(int y) {
assert(y >= 0 && y < h);
ASSERT(y >= 0 && y < h);
return ((address_t*)line)[y];
}
inline const_address_t line_address(int y) const {
assert(y >= 0 && y < h);
ASSERT(y >= 0 && y < h);
return ((const_address_t*)line)[y];
}

View File

@ -19,8 +19,6 @@
#ifndef RASTER_IMAGE_TRAITS_H_INCLUDED
#define RASTER_IMAGE_TRAITS_H_INCLUDED
#include <cassert>
//////////////////////////////////////////////////////////////////////
// RGBA
@ -79,7 +77,7 @@ struct RgbTraits
static inline BLEND_COLOR get_blender(int blend_mode)
{
assert(blend_mode >= 0 && blend_mode < BLEND_MODE_MAX);
ASSERT(blend_mode >= 0 && blend_mode < BLEND_MODE_MAX);
return _rgba_blenders[blend_mode];
}
};
@ -128,7 +126,7 @@ struct GrayscaleTraits
static inline BLEND_COLOR get_blender(int blend_mode)
{
assert(blend_mode >= 0 && blend_mode < BLEND_MODE_MAX);
ASSERT(blend_mode >= 0 && blend_mode < BLEND_MODE_MAX);
return _graya_blenders[blend_mode];
}
};
@ -194,8 +192,8 @@ struct BitmapTraits
template<class Traits>
inline typename Traits::address_t image_address_fast(const Image* image, int x, int y)
{
assert(x >= 0 && x < image->w);
assert(y >= 0 && y < image->h);
ASSERT(x >= 0 && x < image->w);
ASSERT(y >= 0 && y < image->h);
return ((((typename Traits::pixel_t**)image->line)[y])+x);
}
@ -203,8 +201,8 @@ inline typename Traits::address_t image_address_fast(const Image* image, int x,
template<class Traits>
inline typename Traits::pixel_t image_getpixel_fast(const Image* image, int x, int y)
{
assert(x >= 0 && x < image->w);
assert(y >= 0 && y < image->h);
ASSERT(x >= 0 && x < image->w);
ASSERT(y >= 0 && y < image->h);
return *((((typename Traits::pixel_t**)image->line)[y])+x);
}
@ -212,8 +210,8 @@ inline typename Traits::pixel_t image_getpixel_fast(const Image* image, int x, i
template<class Traits>
inline void image_putpixel_fast(Image* image, int x, int y, typename Traits::pixel_t color)
{
assert(x >= 0 && x < image->w);
assert(y >= 0 && y < image->h);
ASSERT(x >= 0 && x < image->w);
ASSERT(y >= 0 && y < image->h);
*((((typename Traits::pixel_t**)image->line)[y])+x) = color;
}
@ -221,8 +219,8 @@ inline void image_putpixel_fast(Image* image, int x, int y, typename Traits::pix
template<>
inline BitmapTraits::pixel_t image_getpixel_fast<BitmapTraits>(const Image* image, int x, int y)
{
assert(x >= 0 && x < image->w);
assert(y >= 0 && y < image->h);
ASSERT(x >= 0 && x < image->w);
ASSERT(y >= 0 && y < image->h);
div_t d = div(x, 8);
return ((*(((BitmapTraits::pixel_t**)image->line)[y]+d.quot)) & (1<<d.rem)) ? 1: 0;
@ -231,8 +229,8 @@ inline BitmapTraits::pixel_t image_getpixel_fast<BitmapTraits>(const Image* imag
template<>
inline void image_putpixel_fast<BitmapTraits>(Image* image, int x, int y, BitmapTraits::pixel_t color)
{
assert(x >= 0 && x < image->w);
assert(y >= 0 && y < image->h);
ASSERT(x >= 0 && x < image->w);
ASSERT(y >= 0 && y < image->h);
div_t d = div(x, 8);
if (color)

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <algorithm>
#include <assert.h>
#include <string.h>
#include <allegro/unicode.h>
@ -41,7 +40,7 @@ static bool has_cels(const Layer* layer, int frame);
Layer::Layer(int type, Sprite* sprite)
: GfxObj(type)
{
assert(type == GFXOBJ_LAYER_IMAGE || type == GFXOBJ_LAYER_FOLDER);
ASSERT(type == GFXOBJ_LAYER_IMAGE || type == GFXOBJ_LAYER_FOLDER);
set_name("Layer");
@ -127,11 +126,11 @@ LayerImage::LayerImage(const LayerImage* src_layer, Sprite* dst_sprite)
const Cel* cel = *it;
Cel* cel_copy = cel_new_copy(cel);
assert((cel->image >= 0) &&
ASSERT((cel->image >= 0) &&
(cel->image < src_layer->getSprite()->getStock()->nimage));
Image* image = src_layer->getSprite()->getStock()->image[cel->image];
assert(image != NULL);
ASSERT(image != NULL);
Image* image_copy = image_new_copy(image);
@ -162,7 +161,7 @@ void LayerImage::destroy_all_cels()
Cel* cel = *it;
Image* image = getSprite()->getStock()->image[cel->image];
assert(image != NULL);
ASSERT(image != NULL);
stock_remove_image(getSprite()->getStock(), image);
image_free(image);
@ -208,7 +207,7 @@ void LayerImage::remove_cel(Cel *cel)
{
CelIterator it = std::find(m_cels.begin(), m_cels.end(), cel);
assert(it != m_cels.end());
ASSERT(it != m_cels.end());
m_cels.erase(it);
}
@ -250,8 +249,8 @@ Cel* LayerImage::get_cel(int frame)
*/
void LayerImage::configure_as_background()
{
assert(getSprite() != NULL);
assert(getSprite()->getBackgroundLayer() == NULL);
ASSERT(getSprite() != NULL);
ASSERT(getSprite()->getBackgroundLayer() == NULL);
*flags_addr() |= LAYER_IS_LOCKMOVE | LAYER_IS_BACKGROUND;
set_name("Background");
@ -324,7 +323,7 @@ void LayerFolder::add_layer(Layer* layer)
void LayerFolder::remove_layer(Layer* layer)
{
LayerIterator it = std::find(m_layers.begin(), m_layers.end(), layer);
assert(it != m_layers.end());
ASSERT(it != m_layers.end());
m_layers.erase(it);
layer->set_parent(NULL);
@ -333,12 +332,12 @@ void LayerFolder::remove_layer(Layer* layer)
void LayerFolder::move_layer(Layer* layer, Layer* after)
{
LayerIterator it = std::find(m_layers.begin(), m_layers.end(), layer);
assert(it != m_layers.end());
ASSERT(it != m_layers.end());
m_layers.erase(it);
if (after) {
LayerIterator after_it = std::find(m_layers.begin(), m_layers.end(), after);
assert(after_it != m_layers.end());
ASSERT(after_it != m_layers.end());
after_it++;
m_layers.insert(after_it, layer);
}
@ -415,11 +414,11 @@ void layer_render(const Layer* layer, Image* image, int x, int y, int frame)
Image* src_image;
if (cel) {
assert((cel->image >= 0) &&
ASSERT((cel->image >= 0) &&
(cel->image < layer->getSprite()->getStock()->nimage));
src_image = layer->getSprite()->getStock()->image[cel->image];
assert(src_image != NULL);
ASSERT(src_image != NULL);
image_merge(image, src_image,
cel->x + x,

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@ -42,7 +41,7 @@ Mask::Mask(const Mask& mask)
Mask::~Mask()
{
assert(m_freeze_count == 0);
ASSERT(m_freeze_count == 0);
if (this->name)
jfree(this->name);
@ -64,13 +63,13 @@ void Mask::initialize()
void Mask::freeze()
{
assert(m_freeze_count >= 0);
ASSERT(m_freeze_count >= 0);
m_freeze_count++;
}
void Mask::unfreeze()
{
assert(m_freeze_count > 0);
ASSERT(m_freeze_count > 0);
m_freeze_count--;
// Shrink just in case
@ -87,13 +86,13 @@ Mask* mask_new()
Mask* mask_new_copy(const Mask* mask)
{
assert(mask);
ASSERT(mask);
return new Mask(*mask);
}
void mask_free(Mask* mask)
{
assert(mask);
ASSERT(mask);
delete mask;
}
@ -394,7 +393,7 @@ void mask_crop(Mask* mask, const Image *image)
void Mask::reserve(int x, int y, int w, int h)
{
assert(w > 0 && h > 0);
ASSERT(w > 0 && h > 0);
if (!this->bitmap) {
this->x = x;

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <allegro.h>
#include <algorithm>
@ -31,7 +30,7 @@
Palette::Palette(int frame, int ncolors)
: GfxObj(GFXOBJ_PALETTE)
{
assert(ncolors >= 1 && ncolors <= 256);
ASSERT(ncolors >= 1 && ncolors <= 256);
m_frame = frame;
m_colors.resize(ncolors);
@ -62,7 +61,7 @@ Palette* Palette::createGrayscale()
void Palette::resize(int ncolors)
{
assert(ncolors >= 1 && ncolors <= 256);
ASSERT(ncolors >= 1 && ncolors <= 256);
int old_size = m_colors.size();
m_colors.resize(ncolors);
@ -79,15 +78,15 @@ void Palette::resize(int ncolors)
void Palette::setFrame(int frame)
{
assert(frame >= 0);
ASSERT(frame >= 0);
m_frame = frame;
}
void Palette::setEntry(int i, ase_uint32 color)
{
assert(i >= 0 && i < size());
assert(_rgba_geta(color) == 255);
ASSERT(i >= 0 && i < size());
ASSERT(_rgba_geta(color) == 255);
m_colors[i] = color;
++m_modifications;
@ -139,8 +138,8 @@ void Palette::makeHorzRamp(int from, int to)
int r2, g2, b2;
int i, n;
assert(from >= 0 && from <= 255);
assert(to >= 0 && to <= 255);
ASSERT(from >= 0 && from <= 255);
ASSERT(to >= 0 && to <= 255);
if (from > to)
std::swap(from, to);
@ -172,12 +171,12 @@ void Palette::makeVertRamp(int from, int to, int columns)
int y, ybeg, yend, n;
int offset;
assert(from >= 0 && from <= 255);
assert(to >= 0 && to <= 255);
assert(columns >= 1 && columns <= 256);
ASSERT(from >= 0 && from <= 255);
ASSERT(to >= 0 && to <= 255);
ASSERT(columns >= 1 && columns <= 256);
/* both indices have to be in the same column */
assert((from % columns) == (to % columns));
ASSERT((from % columns) == (to % columns));
if (from > to)
std::swap(from, to);
@ -210,9 +209,9 @@ void Palette::makeRectRamp(int from, int to, int columns)
{
int x1, y1, x2, y2, y;
assert(from >= 0 && from <= 255);
assert(to >= 0 && to <= 255);
assert(columns >= 1 && columns <= 256);
ASSERT(from >= 0 && from <= 255);
ASSERT(to >= 0 && to <= 255);
ASSERT(columns >= 1 && columns <= 256);
if (from > to)
std::swap(from, to);
@ -357,7 +356,7 @@ void Palette::sort(int from, int to, SortPalette* sort_palette, std::vector<int>
if (from == to) // Just do nothing
return;
assert(from < to);
ASSERT(from < to);
std::vector<PalEntryWithIndex> temp(to-from+1);
for (int i=0; i<(int)temp.size(); ++i) {
@ -502,9 +501,9 @@ int Palette::findBestfit(int r, int g, int b) const
#endif
int i, coldiff, lowest;
assert(r >= 0 && r <= 255);
assert(g >= 0 && g <= 255);
assert(b >= 0 && b <= 255);
ASSERT(r >= 0 && r <= 255);
ASSERT(g >= 0 && g <= 255);
ASSERT(b >= 0 && b <= 255);
if (col_diff[1] == 0)
bestfit_init();

View File

@ -22,7 +22,6 @@
#include "raster/gfxobj.h"
#include <allegro/color.h>
#include <vector>
#include <cassert>
class SortPalette
{
@ -69,7 +68,7 @@ public:
void setFrame(int frame);
ase_uint32 getEntry(int i) const {
assert(i >= 0 && i < size());
ASSERT(i >= 0 && i < size());
return m_colors[i];
}

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <string.h>
#include <cassert>
#include "raster/blend.h"
#include "raster/image.h"
@ -81,13 +80,13 @@ Path* path_new(const char* name)
Path* path_new_copy(const Path* path)
{
assert(path);
ASSERT(path);
return new Path(*path);
}
void path_free(Path* path)
{
assert(path);
ASSERT(path);
delete path;
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <allegro.h>
#include "raster/palette.h"
@ -61,9 +60,9 @@ public:
}
int mapColor(int r, int g, int b) const {
assert(r >= 0 && r < 256);
assert(g >= 0 && g < 256);
assert(b >= 0 && b < 256);
ASSERT(r >= 0 && r < 256);
ASSERT(g >= 0 && g < 256);
ASSERT(b >= 0 && b < 256);
return m_allegMap->data[r>>3][g>>3][b>>3];
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <cstring>
#include <vector>
@ -75,8 +74,8 @@ public:
}
void setSize(int width, int height) {
assert(width > 0);
assert(height > 0);
ASSERT(width > 0);
ASSERT(height > 0);
m_width = width;
m_height = height;
@ -233,7 +232,7 @@ public:
getCurrentLayer()->is_image()) {
const Cel* cel = static_cast<const LayerImage*>(getCurrentLayer())->get_cel(getCurrentFrame());
if (cel) {
assert((cel->image >= 0) &&
ASSERT((cel->image >= 0) &&
(cel->image < getStock()->nimage));
image = getStock()->image[cel->image];
@ -254,7 +253,7 @@ public:
getCurrentLayer()->is_image()) {
Cel* cel = static_cast<LayerImage*>(getCurrentLayer())->get_cel(getCurrentFrame());
if (cel) {
assert((cel->image >= 0) &&
ASSERT((cel->image >= 0) &&
(cel->image < getStock()->nimage));
image = getStock()->image[cel->image];
@ -273,8 +272,8 @@ public:
}
void remapImages(int frame_from, int frame_to, const std::vector<int>& mapping) {
assert(m_imgtype == IMAGE_INDEXED);
assert(mapping.size() == 256);
ASSERT(m_imgtype == IMAGE_INDEXED);
ASSERT(mapping.size() == 256);
CelList cels;
getCels(cels);
@ -453,7 +452,7 @@ SpriteImpl::SpriteImpl(Sprite* sprite, int imgtype, int width, int height, int n
, m_height(height)
, m_filename("Sprite")
{
assert(width > 0 && height > 0);
ASSERT(width > 0 && height > 0);
m_associated_to_file = false;
m_frames = 1;
@ -595,7 +594,7 @@ SpriteImpl* SpriteImpl::copyLayers(SpriteImpl* dst_sprite, const SpriteImpl* src
dst_sprite->m_folder = NULL;
}
assert(src_sprite->getFolder() != NULL);
ASSERT(src_sprite->getFolder() != NULL);
undo_disable(dst_sprite->getUndo());
dst_sprite->m_folder = src_sprite->getFolder()->duplicate_for(dst_sprite->m_self);
@ -707,7 +706,7 @@ bool SpriteImpl::lockToWrite()
// this only is possible if there are just one reader
if (m_read_locks == 1) {
assert(!m_write_lock);
ASSERT(!m_write_lock);
m_read_locks = 0;
m_write_lock = true;
return true;
@ -724,8 +723,8 @@ void SpriteImpl::unlockToRead()
{
ScopedLock lock(*m_mutex);
assert(m_read_locks == 0);
assert(m_write_lock);
ASSERT(m_read_locks == 0);
ASSERT(m_write_lock);
m_write_lock = false;
m_read_locks = 1;
@ -742,7 +741,7 @@ void SpriteImpl::unlock()
--m_read_locks;
}
else {
assert(false);
ASSERT(false);
}
}
@ -824,7 +823,7 @@ void SpriteImpl::generateMaskBoundaries(Mask* mask)
m_bound.nseg = 0;
}
assert(mask != NULL);
ASSERT(mask != NULL);
if (mask->bitmap) {
m_bound.seg = find_mask_boundary(mask->bitmap,
@ -860,7 +859,7 @@ const Palette* SpriteImpl::getPalette(int frame) const
const Palette* pal;
JLink link;
assert(frame >= 0);
ASSERT(frame >= 0);
JI_LIST_FOR_EACH(m_palettes, link) {
pal = reinterpret_cast<const Palette*>(link->data);
@ -872,7 +871,7 @@ const Palette* SpriteImpl::getPalette(int frame) const
break;
}
assert(found != NULL);
ASSERT(found != NULL);
return found;
}
@ -882,7 +881,7 @@ Palette* SpriteImpl::getPalette(int frame)
Palette* pal;
JLink link;
assert(frame >= 0);
ASSERT(frame >= 0);
JI_LIST_FOR_EACH(m_palettes, link) {
pal = reinterpret_cast<Palette*>(link->data);
@ -894,13 +893,13 @@ Palette* SpriteImpl::getPalette(int frame)
break;
}
assert(found != NULL);
ASSERT(found != NULL);
return found;
}
void SpriteImpl::setPalette(Palette* pal, bool truncate)
{
assert(pal != NULL);
ASSERT(pal != NULL);
if (!truncate) {
Palette* sprite_pal = getPalette(pal->getFrame());
@ -939,10 +938,10 @@ void SpriteImpl::resetPalettes()
void SpriteImpl::deletePalette(Palette* pal)
{
assert(pal != NULL);
ASSERT(pal != NULL);
JLink link = jlist_find(m_palettes, pal);
assert(link != NULL);
ASSERT(link != NULL);
delete pal;
jlist_delete_link(m_palettes, link);
@ -1020,7 +1019,7 @@ Sprite* Sprite::createFlattenCopy(const Sprite& src_sprite)
dst_sprite->m_impl = dst_sprite_impl;
// Flatten layers
assert(src_sprite.getFolder() != NULL);
ASSERT(src_sprite.getFolder() != NULL);
Layer* flat_layer;
try {

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <string.h>
#include <assert.h>
#include "raster/image.h"
#include "raster/stock.h"
@ -54,7 +53,7 @@ Stock::Stock(const Stock& stock)
}
}
assert(this->nimage == stock.nimage);
ASSERT(this->nimage == stock.nimage);
}
Stock::~Stock()
@ -84,7 +83,7 @@ Stock* stock_new(int imgtype)
*/
Stock* stock_new_copy(const Stock* stock)
{
assert(stock);
ASSERT(stock);
return new Stock(*stock);
}
@ -93,7 +92,7 @@ Stock* stock_new_copy(const Stock* stock)
*/
void stock_free(Stock* stock)
{
assert(stock);
ASSERT(stock);
delete stock;
}

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <vector>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
@ -315,13 +314,13 @@ Undo* undo_new(Sprite *sprite)
void undo_free(Undo* undo)
{
assert(undo);
ASSERT(undo);
delete undo;
}
int undo_get_memsize(const Undo* undo)
{
assert(undo);
ASSERT(undo);
return
undo->undo_stream->size +
undo->redo_stream->size;
@ -329,55 +328,55 @@ int undo_get_memsize(const Undo* undo)
void undo_enable(Undo* undo)
{
assert(undo);
ASSERT(undo);
undo->enabled = true;
}
void undo_disable(Undo* undo)
{
assert(undo);
ASSERT(undo);
undo->enabled = false;
}
bool undo_is_enabled(const Undo* undo)
{
assert(undo);
ASSERT(undo);
return undo->enabled ? true: false;
}
bool undo_is_disabled(const Undo* undo)
{
assert(undo);
ASSERT(undo);
return !undo_is_enabled(undo);
}
bool undo_can_undo(const Undo* undo)
{
assert(undo);
ASSERT(undo);
return !jlist_empty(undo->undo_stream->chunks);
}
bool undo_can_redo(const Undo* undo)
{
assert(undo);
ASSERT(undo);
return !jlist_empty(undo->redo_stream->chunks);
}
void undo_do_undo(Undo* undo)
{
assert(undo);
ASSERT(undo);
run_undo(undo, DO_UNDO);
}
void undo_do_redo(Undo* undo)
{
assert(undo);
ASSERT(undo);
run_undo(undo, DO_REDO);
}
void undo_clear_redo(Undo* undo)
{
assert(undo);
ASSERT(undo);
if (!jlist_empty(undo->redo_stream->chunks)) {
undo_stream_free(undo->redo_stream);
undo->redo_stream = undo_stream_new(undo);
@ -393,7 +392,7 @@ const char *undo_get_next_undo_label(const Undo* undo)
{
UndoChunk* chunk;
assert(undo_can_undo(undo));
ASSERT(undo_can_undo(undo));
chunk = reinterpret_cast<UndoChunk*>(jlist_first_data(undo->undo_stream->chunks));
return chunk->label;
@ -403,7 +402,7 @@ const char *undo_get_next_redo_label(const Undo* undo)
{
UndoChunk* chunk;
assert(undo_can_redo(undo));
ASSERT(undo_can_redo(undo));
chunk = reinterpret_cast<UndoChunk*>(jlist_first_data(undo->redo_stream->chunks));
return chunk->label;
@ -626,7 +625,7 @@ static void chunk_data_new(UndoStream* stream, GfxObj *gfxobj, void *data, int s
ase_uint32 offset = (unsigned int)(((ase_uint8* )data) -
((ase_uint8* )gfxobj));
assert(size >= 1);
ASSERT(size >= 1);
chunk = (UndoChunkData *)
undo_chunk_new(stream,
@ -694,8 +693,8 @@ static void chunk_image_new(UndoStream* stream, Image* image, int x, int y, int
ase_uint8* ptr;
int v, size;
assert(w >= 1 && h >= 1);
assert(x >= 0 && y >= 0 && x+w <= image->w && y+h <= image->h);
ASSERT(w >= 1 && h >= 1);
ASSERT(x >= 0 && y >= 0 && x+w <= image->w && y+h <= image->h);
size = image_line_size(image, w);
@ -957,7 +956,7 @@ static void chunk_remove_image_invert(UndoStream* stream, UndoChunkRemoveImage*
if (stock) {
Image* image = read_raw_image(chunk->data);
/* assert(image != NULL); */
/* ASSERT(image != NULL); */
stock_replace_image(stock, image_index, image);
chunk_add_image_new(stream, stock, image_index);
@ -1111,7 +1110,7 @@ static void chunk_remove_cel_invert(UndoStream* stream, UndoChunkRemoveCel* chun
if (layer) {
Cel* cel = read_raw_cel(chunk->data);
/* assert(cel != NULL); */
/* ASSERT(cel != NULL); */
chunk_add_cel_new(stream, layer, cel);
layer->add_cel(cel);
@ -1268,7 +1267,7 @@ static void chunk_remove_layer_invert(UndoStream* stream, UndoChunkRemoveLayer*
if (folder) {
Layer* layer = read_raw_layer(chunk->data);
/* assert(layer != NULL); */
/* ASSERT(layer != NULL); */
chunk_add_layer_new(stream, folder, layer);
folder->add_layer(layer);
@ -1502,7 +1501,7 @@ static void chunk_remap_palette_new(UndoStream* stream, Sprite *sprite, int fram
chunk->frame_from = frame_from;
chunk->frame_to = frame_to;
assert(mapping.size() == 256 && "Mapping tables must have 256 entries");
ASSERT(mapping.size() == 256 && "Mapping tables must have 256 entries");
for (size_t c=0; c<256; c++)
chunk->mapping[c] = mapping[c];
@ -1777,7 +1776,7 @@ void undo_set_frlen(Undo* undo, Sprite *sprite, int frame)
static void chunk_set_frlen_new(UndoStream* stream, Sprite *sprite, int frame)
{
assert(frame >= 0 && frame < sprite->getTotalFrames());
ASSERT(frame >= 0 && frame < sprite->getTotalFrames());
UndoChunkSetFrlen *chunk = (UndoChunkSetFrlen *)
undo_chunk_new(stream,
@ -1809,7 +1808,7 @@ static UndoChunk* undo_chunk_new(UndoStream* stream, int type, int size)
{
UndoChunk* chunk;
assert(size >= sizeof(UndoChunk));
ASSERT(size >= sizeof(UndoChunk));
chunk = (UndoChunk* )jmalloc0(size);
if (!chunk)
@ -2089,7 +2088,7 @@ static ase_uint8* write_raw_image(ase_uint8* raw_data, Image* image)
static int get_raw_image_size(Image* image)
{
assert(image != NULL);
ASSERT(image != NULL);
return 4+1+2+2+image_line_size(image, image->w) * image->h;
}
@ -2285,7 +2284,7 @@ static ase_uint8* write_raw_layer(ase_uint8* raw_data, Layer* layer)
raw_data = write_raw_cel(raw_data, cel);
Image* image = layer->getSprite()->getStock()->image[cel->image];
assert(image != NULL);
ASSERT(image != NULL);
write_raw_uint8(1);
raw_data = write_raw_image(raw_data, image);

View File

@ -383,7 +383,7 @@ private:
IToolSettings* UISettingsImpl::getToolSettings(Tool* tool)
{
assert(tool != NULL);
ASSERT(tool != NULL);
std::map<std::string, IToolSettings*>::iterator
it = m_toolSettings.find(tool->getId());

View File

@ -61,13 +61,13 @@ public:
Sprite* operator->()
{
assert(m_sprite != NULL);
ASSERT(m_sprite != NULL);
return m_sprite;
}
const Sprite* operator->() const
{
assert(m_sprite != NULL);
ASSERT(m_sprite != NULL);
return m_sprite;
}
@ -239,7 +239,7 @@ public:
void destroy()
{
assert(m_sprite != NULL);
ASSERT(m_sprite != NULL);
m_context->remove_sprite(m_sprite);
unlock_writer();

View File

@ -23,7 +23,6 @@
#error You should compile the tests with the NDEBUG flag activated
#endif
#include <assert.h>
#include <stdio.h>
#include <allegro.h>

View File

@ -27,7 +27,7 @@ static void run_thread(void *data)
{
errno = 0;
trace("[second thread] errno: %d\n", errno);
assert(errno == 0);
ASSERT(errno == 0);
}
int main(int argc, char *argv[])
@ -36,13 +36,13 @@ int main(int argc, char *argv[])
errno = 33;
trace("[main thread] errno: %d\n", errno);
assert(errno == 33);
ASSERT(errno == 33);
thread = jthread_new(run_thread, NULL);
jthread_join(thread);
trace("[main thread] errno: %d\n", errno);
assert(errno == 33);
ASSERT(errno == 33);
trace("errno is thread safe\n");

View File

@ -54,12 +54,12 @@ static void display_fileitem(FileItem *fi, int level, int deep)
int main(int argc, char *argv[])
{
test_init();
assert(file_system_init());
ASSERT(file_system_init());
trace("*** Listing root of the file-system (deep = 2)...\n");
{
FileItem *root = get_root_fileitem();
assert(root != NULL);
ASSERT(root != NULL);
display_fileitem(root, 0, 2);
}
@ -71,18 +71,18 @@ int main(int argc, char *argv[])
trace("*** Getting 'C:\\' using 'get_fileitem_from_path'...\n");
c_drive = get_fileitem_from_path("C:\\");
assert(c_drive != NULL);
ASSERT(c_drive != NULL);
trace("*** Getting 'C:\\' again\n");
c_drive2 = get_fileitem_from_path("C:\\");
assert(c_drive == c_drive2);
ASSERT(c_drive == c_drive2);
trace("*** Displaying 'C:\\'...\n");
display_fileitem(c_drive, 0, 0);
trace("*** Getting 'My PC' (using 'fileitem_get_parent')...\n");
my_pc = fileitem_get_parent(c_drive);
assert(my_pc != NULL);
ASSERT(my_pc != NULL);
trace("*** Listing 'My PC'...\n");
display_fileitem(my_pc, 0, 1);
@ -91,14 +91,14 @@ int main(int argc, char *argv[])
trace("*** Testing 'filename_has_extension'...\n");
{
assert(filename_has_extension("hi.png", "png"));
assert(!filename_has_extension("hi.png", "pngg"));
assert(!filename_has_extension("hi.png", "ppng"));
assert(filename_has_extension("hi.jpeg", "jpg,jpeg"));
assert(filename_has_extension("hi.jpg", "jpg,jpeg"));
assert(!filename_has_extension("hi.ase", "jpg,jpeg"));
assert(filename_has_extension("hi.ase", "jpg,jpeg,ase"));
assert(filename_has_extension("hi.ase", "ase,jpg,jpeg"));
ASSERT(filename_has_extension("hi.png", "png"));
ASSERT(!filename_has_extension("hi.png", "pngg"));
ASSERT(!filename_has_extension("hi.png", "ppng"));
ASSERT(filename_has_extension("hi.jpeg", "jpg,jpeg"));
ASSERT(filename_has_extension("hi.jpg", "jpg,jpeg"));
ASSERT(!filename_has_extension("hi.ase", "jpg,jpeg"));
ASSERT(filename_has_extension("hi.ase", "jpg,jpeg,ase"));
ASSERT(filename_has_extension("hi.ase", "ase,jpg,jpeg"));
}
file_system_exit();

View File

@ -37,23 +37,23 @@ static void test_grid_2x1()
/* test request-size */
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 20 && req_h == 10);
ASSERT(req_w == 20 && req_h == 10);
/* test child-spacing */
grid->child_spacing = 2;
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 22 && req_h == 10);
ASSERT(req_w == 22 && req_h == 10);
/* test borders */
grid->border_width.l = 3;
grid->border_width.b = 3;
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 25 && req_h == 13);
ASSERT(req_w == 25 && req_h == 13);
grid->border_width.r = 5;
grid->border_width.t = 2;
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 30 && req_h == 15);
ASSERT(req_w == 30 && req_h == 15);
jwidget_free(grid);
}
@ -74,22 +74,22 @@ static void test_grid_2x1_expand2nd()
/* test request size */
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 30 && req_h == 20);
ASSERT(req_w == 30 && req_h == 20);
/* test layout */
rect = jrect_new(0, 0, 40, 20);
jwidget_set_rect(grid, rect);
jrect_free(rect);
assert(w1->rc->x1 == 0);
assert(w1->rc->y1 == 0);
assert(jrect_w(w1->rc) == 20);
assert(jrect_h(w1->rc) == 20);
ASSERT(w1->rc->x1 == 0);
ASSERT(w1->rc->y1 == 0);
ASSERT(jrect_w(w1->rc) == 20);
ASSERT(jrect_h(w1->rc) == 20);
assert(w2->rc->x1 == 20);
assert(w2->rc->y1 == 0);
assert(jrect_w(w2->rc) == 20);
assert(jrect_h(w2->rc) == 10);
ASSERT(w2->rc->x1 == 20);
ASSERT(w2->rc->y1 == 0);
ASSERT(jrect_w(w2->rc) == 20);
ASSERT(jrect_h(w2->rc) == 10);
jwidget_free(grid);
}
@ -110,17 +110,17 @@ static void test_grid_2x1_samewidth()
/* test request size */
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 40 && req_h == 20);
ASSERT(req_w == 40 && req_h == 20);
/* test layout */
rect = jrect_new(0, 0, 60, 20);
jwidget_set_rect(grid, rect);
jrect_free(rect);
assert(w1->rc->x1 == 0);
assert(w2->rc->x1 == 30);
assert(jrect_w(w1->rc) == 30);
assert(jrect_w(w2->rc) == 30);
ASSERT(w1->rc->x1 == 0);
ASSERT(w2->rc->x1 == 30);
ASSERT(jrect_w(w1->rc) == 30);
ASSERT(jrect_w(w2->rc) == 30);
jwidget_free(grid);
}
@ -186,22 +186,22 @@ static void test_grid_3x3_intrincate()
/* test request size */
grid->child_spacing = 2;
jwidget_request_size(grid, &req_w, &req_h);
assert(req_w == 22 && req_h == 22);
ASSERT(req_w == 22 && req_h == 22);
/* test layout */
rect = jrect_new(0, 0, 100, 100);
jwidget_set_rect(grid, rect);
jrect_free(rect);
assert(w1->rc->x1 == 0 && w1->rc->y1 == 0);
assert(w2->rc->x1 == 12 && w2->rc->y1 == 0);
assert(w3->rc->x1 == 0 && w3->rc->y1 == 12);
assert(w4->rc->x1 == 90 && w4->rc->y1 == 12);
ASSERT(w1->rc->x1 == 0 && w1->rc->y1 == 0);
ASSERT(w2->rc->x1 == 12 && w2->rc->y1 == 0);
ASSERT(w3->rc->x1 == 0 && w3->rc->y1 == 12);
ASSERT(w4->rc->x1 == 90 && w4->rc->y1 == 12);
assert(jrect_w(w1->rc) == 10 && jrect_h(w1->rc) == 10);
assert(jrect_w(w2->rc) == 88 && jrect_h(w2->rc) == 10);
assert(jrect_w(w3->rc) == 88 && jrect_h(w3->rc) == 88);
assert(jrect_w(w4->rc) == 10 && jrect_h(w4->rc) == 88);
ASSERT(jrect_w(w1->rc) == 10 && jrect_h(w1->rc) == 10);
ASSERT(jrect_w(w2->rc) == 88 && jrect_h(w2->rc) == 10);
ASSERT(jrect_w(w3->rc) == 88 && jrect_h(w3->rc) == 88);
ASSERT(jrect_w(w4->rc) == 10 && jrect_h(w4->rc) == 88);
jwidget_free(grid);
}

View File

@ -24,21 +24,21 @@ static void test_append_and_clear()
JList q;
q = jlist_new();
assert(q != NULL);
assert(jlist_length(q) == 0);
ASSERT(q != NULL);
ASSERT(jlist_length(q) == 0);
jlist_append(q, (void *)10);
assert(jlist_length(q) == 1);
ASSERT(jlist_length(q) == 1);
jlist_append(q, (void *)20);
jlist_append(q, (void *)30);
assert(jlist_length(q) == 3);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)20);
assert(jlist_nth_data(q, 2) == (void *)30);
ASSERT(jlist_length(q) == 3);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)20);
ASSERT(jlist_nth_data(q, 2) == (void *)30);
jlist_clear(q);
assert(jlist_length(q) == 0);
ASSERT(jlist_length(q) == 0);
jlist_free(q);
}
@ -51,10 +51,10 @@ static void test_prepend()
jlist_prepend(q, (void *)30);
jlist_prepend(q, (void *)20);
jlist_prepend(q, (void *)10);
assert(jlist_length(q) == 3);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)20);
assert(jlist_nth_data(q, 2) == (void *)30);
ASSERT(jlist_length(q) == 3);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)20);
ASSERT(jlist_nth_data(q, 2) == (void *)30);
jlist_free(q);
}
@ -69,12 +69,12 @@ static void test_insert()
jlist_insert(q, (void *)20, 1);
jlist_insert(q, (void *)50, 3);
jlist_insert(q, (void *)40, 3);
assert(jlist_length(q) == 5);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)20);
assert(jlist_nth_data(q, 2) == (void *)30);
assert(jlist_nth_data(q, 3) == (void *)40);
assert(jlist_nth_data(q, 4) == (void *)50);
ASSERT(jlist_length(q) == 5);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)20);
ASSERT(jlist_nth_data(q, 2) == (void *)30);
ASSERT(jlist_nth_data(q, 3) == (void *)40);
ASSERT(jlist_nth_data(q, 4) == (void *)50);
jlist_free(q);
}
@ -92,9 +92,9 @@ static void test_nth_link()
a = jlist_nth_link(q, 0);
b = jlist_nth_link(q, 1);
c = jlist_nth_link(q, 2);
assert(a->data == (void *)10);
assert(b->data == (void *)20);
assert(c->data == (void *)30);
ASSERT(a->data == (void *)10);
ASSERT(b->data == (void *)20);
ASSERT(c->data == (void *)30);
jlist_free(q);
}
@ -117,14 +117,14 @@ static void test_insert_before()
jlist_insert_before(q, b, (void *)30);
jlist_insert_before(q, c, (void *)50);
jlist_insert_before(q, NULL, (void *)70);
assert(jlist_length(q) == 7);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)20);
assert(jlist_nth_data(q, 2) == (void *)30);
assert(jlist_nth_data(q, 3) == (void *)40);
assert(jlist_nth_data(q, 4) == (void *)50);
assert(jlist_nth_data(q, 5) == (void *)60);
assert(jlist_nth_data(q, 6) == (void *)70);
ASSERT(jlist_length(q) == 7);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)20);
ASSERT(jlist_nth_data(q, 2) == (void *)30);
ASSERT(jlist_nth_data(q, 3) == (void *)40);
ASSERT(jlist_nth_data(q, 4) == (void *)50);
ASSERT(jlist_nth_data(q, 5) == (void *)60);
ASSERT(jlist_nth_data(q, 6) == (void *)70);
jlist_free(q);
}
@ -139,14 +139,14 @@ static void test_remove_and_remove_all()
jlist_append(q, (void *)30);
jlist_remove(q, (void *)20);
assert(jlist_length(q) == 2);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)30);
ASSERT(jlist_length(q) == 2);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)30);
jlist_append(q, (void *)10);
jlist_remove_all(q, (void *)10);
assert(jlist_length(q) == 1);
assert(jlist_nth_data(q, 0) == (void *)30);
ASSERT(jlist_length(q) == 1);
ASSERT(jlist_nth_data(q, 0) == (void *)30);
jlist_free(q);
}
@ -163,11 +163,11 @@ static void test_remove_link_and_delete_link()
b = jlist_nth_link(q, 1);
jlist_remove_link(q, b);
assert(jlist_length(q) == 2);
ASSERT(jlist_length(q) == 2);
jlist_delete_link(q, jlist_nth_link(q, 0));
jlist_delete_link(q, jlist_nth_link(q, 0));
assert(jlist_length(q) == 0);
ASSERT(jlist_length(q) == 0);
jlink_free(b);
jlist_free(q);
@ -181,16 +181,16 @@ static void test_copy()
jlist_append(q, (void *)10);
jlist_append(q, (void *)20);
jlist_append(q, (void *)30);
assert(jlist_length(q) == 3);
assert(jlist_nth_data(q, 0) == (void *)10);
assert(jlist_nth_data(q, 1) == (void *)20);
assert(jlist_nth_data(q, 2) == (void *)30);
ASSERT(jlist_length(q) == 3);
ASSERT(jlist_nth_data(q, 0) == (void *)10);
ASSERT(jlist_nth_data(q, 1) == (void *)20);
ASSERT(jlist_nth_data(q, 2) == (void *)30);
r = jlist_copy(q);
assert(jlist_length(r) == 3);
assert(jlist_nth_data(r, 0) == (void *)10);
assert(jlist_nth_data(r, 1) == (void *)20);
assert(jlist_nth_data(r, 2) == (void *)30);
ASSERT(jlist_length(r) == 3);
ASSERT(jlist_nth_data(r, 0) == (void *)10);
ASSERT(jlist_nth_data(r, 1) == (void *)20);
ASSERT(jlist_nth_data(r, 2) == (void *)30);
jlist_free(q);
jlist_free(r);
@ -205,9 +205,9 @@ static void test_find()
jlist_append(q, (void *)20);
jlist_append(q, (void *)30);
assert(jlist_find(q, (void *)10) == jlist_nth_link(q, 0));
assert(jlist_find(q, (void *)20) == jlist_nth_link(q, 1));
assert(jlist_find(q, (void *)30) == jlist_nth_link(q, 2));
ASSERT(jlist_find(q, (void *)10) == jlist_nth_link(q, 0));
ASSERT(jlist_find(q, (void *)20) == jlist_nth_link(q, 1));
ASSERT(jlist_find(q, (void *)30) == jlist_nth_link(q, 2));
}
int main(int argc, char *argv[])

View File

@ -287,7 +287,7 @@ void ToolLoopManager::calculateDirtyArea(IToolLoop* loop, const std::vector<Poin
void ToolLoopManager::calculateMinMax(const std::vector<Point>& points, Point& minpt, Point& maxpt)
{
assert(points.size() > 0);
ASSERT(points.size() > 0);
minpt.x = points[0].x;
minpt.y = points[0].y;

View File

@ -112,7 +112,7 @@ Tool* ToolBox::getToolById(const std::string& id)
return tool;
}
// PRINTF("Error get_tool_by_name() with '%s'\n", name.c_str());
// assert(false);
// ASSERT(false);
return NULL;
}

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <allegro/file.h>
#include <cassert>
#include "app.h"
#include "modules/editors.h"
@ -33,13 +32,13 @@ UIContext* UIContext::m_instance = NULL;
UIContext::UIContext()
: Context(new UISettingsImpl)
{
assert(m_instance == NULL);
ASSERT(m_instance == NULL);
m_instance = this;
}
UIContext::~UIContext()
{
assert(m_instance == this);
ASSERT(m_instance == this);
m_instance = NULL;
}

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <memory>
#include "jinete/jlist.h"
@ -45,7 +44,7 @@
*/
Undoable::Undoable(SpriteWriter& sprite, const char* label)
{
assert(label != NULL);
ASSERT(label != NULL);
m_sprite = sprite;
m_committed = false;
@ -89,7 +88,7 @@ void Undoable::commit()
void Undoable::set_number_of_frames(int frames)
{
assert(frames >= 1);
ASSERT(frames >= 1);
// Save in undo the current totalFrames property
if (is_enabled())
@ -101,7 +100,7 @@ void Undoable::set_number_of_frames(int frames)
void Undoable::set_current_frame(int frame)
{
assert(frame >= 0);
ASSERT(frame >= 0);
if (is_enabled())
undo_set_frame(m_sprite->getUndo(), m_sprite);
@ -125,8 +124,8 @@ void Undoable::set_current_layer(Layer* layer)
void Undoable::set_sprite_size(int w, int h)
{
assert(w > 0);
assert(h > 0);
ASSERT(w > 0);
ASSERT(h > 0);
if (is_enabled())
undo_set_size(m_sprite->getUndo(), m_sprite);
@ -259,7 +258,7 @@ void Undoable::set_imgtype(int new_imgtype, int dithering_method)
*/
int Undoable::add_image_in_stock(Image* image)
{
assert(image);
ASSERT(image);
// add the image in the stock
int image_index = stock_add_image(m_sprite->getStock(), image);
@ -275,10 +274,10 @@ int Undoable::add_image_in_stock(Image* image)
*/
void Undoable::remove_image_from_stock(int image_index)
{
assert(image_index >= 0);
ASSERT(image_index >= 0);
Image* image = stock_get_image(m_sprite->getStock(), image_index);
assert(image);
ASSERT(image);
if (is_enabled())
undo_remove_image(m_sprite->getUndo(), m_sprite->getStock(), image_index);
@ -291,7 +290,7 @@ void Undoable::replace_stock_image(int image_index, Image* new_image)
{
// get the current image in the 'image_index' position
Image* old_image = stock_get_image(m_sprite->getStock(), image_index);
assert(old_image);
ASSERT(old_image);
// replace the image in the stock
if (is_enabled())
@ -331,7 +330,7 @@ Layer* Undoable::new_layer()
*/
void Undoable::remove_layer(Layer* layer)
{
assert(layer);
ASSERT(layer);
LayerFolder* parent = layer->get_parent();
@ -414,12 +413,12 @@ void Undoable::displace_layers(Layer* layer, int dx, int dy)
void Undoable::background_from_layer(LayerImage* layer, int bgcolor)
{
assert(layer);
assert(layer->is_image());
assert(layer->is_readable());
assert(layer->is_writable());
assert(layer->getSprite() == m_sprite);
assert(m_sprite->getBackgroundLayer() == NULL);
ASSERT(layer);
ASSERT(layer->is_image());
ASSERT(layer->is_readable());
ASSERT(layer->is_writable());
ASSERT(layer->getSprite() == m_sprite);
ASSERT(m_sprite->getBackgroundLayer() == NULL);
// create a temporary image to draw each frame of the new
// `Background' layer
@ -433,12 +432,12 @@ void Undoable::background_from_layer(LayerImage* layer, int bgcolor)
for (; it != end; ++it) {
Cel* cel = *it;
assert((cel->image > 0) &&
ASSERT((cel->image > 0) &&
(cel->image < m_sprite->getStock()->nimage));
// get the image from the sprite's stock of images
Image* cel_image = stock_get_image(m_sprite->getStock(), cel->image);
assert(cel_image);
ASSERT(cel_image);
image_clear(bg_image, bgcolor);
image_merge(bg_image, cel_image,
@ -484,12 +483,12 @@ void Undoable::background_from_layer(LayerImage* layer, int bgcolor)
void Undoable::layer_from_background()
{
assert(m_sprite->getBackgroundLayer() != NULL);
assert(m_sprite->getCurrentLayer() != NULL);
assert(m_sprite->getCurrentLayer()->is_image());
assert(m_sprite->getCurrentLayer()->is_readable());
assert(m_sprite->getCurrentLayer()->is_writable());
assert(m_sprite->getCurrentLayer()->is_background());
ASSERT(m_sprite->getBackgroundLayer() != NULL);
ASSERT(m_sprite->getCurrentLayer() != NULL);
ASSERT(m_sprite->getCurrentLayer()->is_image());
ASSERT(m_sprite->getCurrentLayer()->is_readable());
ASSERT(m_sprite->getCurrentLayer()->is_writable());
ASSERT(m_sprite->getCurrentLayer()->is_background());
if (is_enabled()) {
undo_data(m_sprite->getUndo(),
@ -543,7 +542,7 @@ void Undoable::flatten_layers(int bgcolor)
cel = background->get_cel(frame);
if (cel) {
cel_image = m_sprite->getStock()->image[cel->image];
assert(cel_image != NULL);
ASSERT(cel_image != NULL);
/* we have to save the current state of `cel_image' in the undo */
if (is_enabled()) {
@ -624,8 +623,8 @@ void Undoable::new_frame()
void Undoable::new_frame_for_layer(Layer* layer, int frame)
{
assert(layer);
assert(frame >= 0);
ASSERT(layer);
ASSERT(frame >= 0);
switch (layer->type) {
@ -654,7 +653,7 @@ void Undoable::new_frame_for_layer(Layer* layer, int frame)
void Undoable::remove_frame(int frame)
{
assert(frame >= 0);
ASSERT(frame >= 0);
// Remove cels from this frame (and displace one position backward
// all next frames)
@ -673,8 +672,8 @@ void Undoable::remove_frame(int frame)
void Undoable::remove_frame_of_layer(Layer* layer, int frame)
{
assert(layer);
assert(frame >= 0);
ASSERT(layer);
ASSERT(frame >= 0);
switch (layer->type) {
@ -704,8 +703,8 @@ void Undoable::remove_frame_of_layer(Layer* layer, int frame)
*/
void Undoable::copy_previous_frame(Layer* layer, int frame)
{
assert(layer);
assert(frame > 0);
ASSERT(layer);
ASSERT(frame > 0);
// create a copy of the previous cel
Cel* src_cel = static_cast<LayerImage*>(layer)->get_cel(frame-1);
@ -734,8 +733,8 @@ void Undoable::copy_previous_frame(Layer* layer, int frame)
void Undoable::add_cel(LayerImage* layer, Cel* cel)
{
assert(layer);
assert(cel);
ASSERT(layer);
ASSERT(cel);
if (is_enabled())
undo_add_cel(m_sprite->getUndo(), layer, cel);
@ -745,8 +744,8 @@ void Undoable::add_cel(LayerImage* layer, Cel* cel)
void Undoable::remove_cel(LayerImage* layer, Cel* cel)
{
assert(layer);
assert(cel);
ASSERT(layer);
ASSERT(cel);
// find if the image that use the cel to remove, is used by
// another cels
@ -776,8 +775,8 @@ void Undoable::remove_cel(LayerImage* layer, Cel* cel)
void Undoable::set_cel_frame_position(Cel* cel, int frame)
{
assert(cel);
assert(frame >= 0);
ASSERT(cel);
ASSERT(frame >= 0);
if (is_enabled())
undo_int(m_sprite->getUndo(), cel, &cel->frame);
@ -787,7 +786,7 @@ void Undoable::set_cel_frame_position(Cel* cel, int frame)
void Undoable::set_cel_position(Cel* cel, int x, int y)
{
assert(cel);
ASSERT(cel);
if (is_enabled()) {
undo_int(m_sprite->getUndo(), cel, &cel->x);
@ -849,7 +848,7 @@ void Undoable::move_frame_before(int frame, int before_frame)
void Undoable::move_frame_before_layer(Layer* layer, int frame, int before_frame)
{
assert(layer);
ASSERT(layer);
switch (layer->type) {
@ -911,7 +910,7 @@ Cel* Undoable::get_current_cel()
void Undoable::crop_cel(Cel* cel, int x, int y, int w, int h, int bgcolor)
{
Image* cel_image = stock_get_image(m_sprite->getStock(), cel->image);
assert(cel_image);
ASSERT(cel_image);
// create the new image through a crop
Image* new_image = image_crop(cel_image, x-cel->x, y-cel->y, w, h, bgcolor);
@ -1023,13 +1022,13 @@ void Undoable::paste_image(const Image* src_image, int x, int y, int opacity)
{
const Layer* layer = m_sprite->getCurrentLayer();
assert(layer);
assert(layer->is_image());
assert(layer->is_readable());
assert(layer->is_writable());
ASSERT(layer);
ASSERT(layer->is_image());
ASSERT(layer->is_readable());
ASSERT(layer->is_writable());
Cel* cel = ((LayerImage*)layer)->get_cel(m_sprite->getCurrentFrame());
assert(cel);
ASSERT(cel);
Image* cel_image = stock_get_image(m_sprite->getStock(), cel->image);
Image* cel_image2 = image_new_copy(cel_image);
@ -1040,8 +1039,8 @@ void Undoable::paste_image(const Image* src_image, int x, int y, int opacity)
void Undoable::copy_to_current_mask(Mask* mask)
{
assert(m_sprite->getMask());
assert(mask);
ASSERT(m_sprite->getMask());
ASSERT(mask);
if (is_enabled())
undo_set_mask(m_sprite->getUndo(), m_sprite);
@ -1051,7 +1050,7 @@ void Undoable::copy_to_current_mask(Mask* mask)
void Undoable::set_mask_position(int x, int y)
{
assert(m_sprite->getMask());
ASSERT(m_sprite->getMask());
if (is_enabled()) {
undo_int(m_sprite->getUndo(), m_sprite->getMask(), &m_sprite->getMask()->x);

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <jinete/jlist.h>
#include "sprite_wrappers.h"
@ -58,10 +57,10 @@ void move_cel(SpriteWriter& sprite)
{
Cel *src_cel, *dst_cel;
assert(src_layer != NULL);
assert(dst_layer != NULL);
assert(src_frame >= 0 && src_frame < sprite->getTotalFrames());
assert(dst_frame >= 0 && dst_frame < sprite->getTotalFrames());
ASSERT(src_layer != NULL);
ASSERT(dst_layer != NULL);
ASSERT(src_frame >= 0 && src_frame < sprite->getTotalFrames());
ASSERT(dst_frame >= 0 && dst_frame < sprite->getTotalFrames());
if (src_layer->is_background()) {
copy_cel(sprite);
@ -150,10 +149,10 @@ void copy_cel(SpriteWriter& sprite)
{
Cel *src_cel, *dst_cel;
assert(src_layer != NULL);
assert(dst_layer != NULL);
assert(src_frame >= 0 && src_frame < sprite->getTotalFrames());
assert(dst_frame >= 0 && dst_frame < sprite->getTotalFrames());
ASSERT(src_layer != NULL);
ASSERT(dst_layer != NULL);
ASSERT(src_frame >= 0 && src_frame < sprite->getTotalFrames());
ASSERT(dst_frame >= 0 && dst_frame < sprite->getTotalFrames());
src_cel = static_cast<LayerImage*>(src_layer)->get_cel(src_frame);
dst_cel = static_cast<LayerImage*>(dst_layer)->get_cel(dst_frame);

View File

@ -20,7 +20,6 @@
#include <allegro.h>
#include <allegro/internal/aintern.h>
#include <cassert>
#include "jinete/jinete.h"
@ -134,7 +133,7 @@ static void set_clipboard(Image* image, Palette* palette, bool set_system_clipbo
static bool copy_from_sprite(const Sprite* sprite)
{
assert(sprite != NULL);
ASSERT(sprite != NULL);
Image* image = NewImageFromMask(sprite);
if (!image)
return false;
@ -164,8 +163,8 @@ bool clipboard::can_paste()
void clipboard::cut(SpriteWriter& sprite)
{
assert(sprite != NULL);
assert(sprite->getCurrentLayer() != NULL);
ASSERT(sprite != NULL);
ASSERT(sprite->getCurrentLayer() != NULL);
if (!copy_from_sprite(sprite)) {
Console console;
@ -185,7 +184,7 @@ void clipboard::cut(SpriteWriter& sprite)
void clipboard::copy(const SpriteReader& sprite)
{
assert(sprite != NULL);
ASSERT(sprite != NULL);
if (!copy_from_sprite(sprite)) {
Console console;
@ -219,7 +218,7 @@ void clipboard::paste(SpriteWriter& sprite)
if (clipboard_image == NULL)
return;
assert(sprite != NULL);
ASSERT(sprite != NULL);
// destination image (where to put this image)
dst_image = sprite->getCurrentImage(&dst_x, &dst_y);

View File

@ -73,7 +73,7 @@ static void set_win32_clipboard_bitmap(Image* image, Palette* palette)
palette_entries = palette->size();
break;
}
assert(scanline > 0 && color_depth > 0);
ASSERT(scanline > 0 && color_depth > 0);
// create the BITMAPV5HEADER structure
HGLOBAL hmem = GlobalAlloc(GHND,

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
#include <string.h>
#include "jinete/jlist.h"
@ -46,10 +45,10 @@ Image* NewImageFromMask(const Sprite* src_sprite)
const Image *src = src_sprite->getCurrentImage(&x, &y);
div_t d;
assert(src_sprite);
assert(src_sprite->getMask());
assert(src_sprite->getMask()->bitmap);
assert(src);
ASSERT(src_sprite);
ASSERT(src_sprite->getMask());
ASSERT(src_sprite->getMask()->bitmap);
ASSERT(src);
dst = image_new(src_sprite->getImgType(),
src_sprite->getMask()->w,
@ -89,7 +88,7 @@ int interactive_move_layer(int mode, bool use_undo, int (*callback)())
Editor* editor = current_editor;
Sprite* sprite = editor->getSprite();
assert(sprite->getCurrentLayer()->is_image());
ASSERT(sprite->getCurrentLayer()->is_image());
LayerImage* layer = static_cast<LayerImage*>(sprite->getCurrentLayer());
Cel *cel = layer->get_cel(sprite->getCurrentFrame());

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <stdio.h>
#include <string.h>
@ -55,7 +54,7 @@ void rec_screen_on()
/* || (rec_file)) */
/* return; */
assert(rec_file == NULL);
ASSERT(rec_file == NULL);
/* get a file name for the record */
for (c=0; c<10000; c++) {

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <assert.h>
#include "jinete/jlist.h"
#include "core/cfg.h"
@ -169,8 +167,8 @@ static void merge_zoomed_image(Image* dst, const Image* src, const Palette* pal,
// for each line to draw of the source image...
for (y=0; y<src_h; y++) {
assert(src_x >= 0 && src_x < src->w);
assert(dst_x >= 0 && dst_x < dst->w);
ASSERT(src_x >= 0 && src_x < src->w);
ASSERT(dst_x >= 0 && dst_x < dst->w);
// get addresses to each line (beginning of 'src', 'dst', etc.)
src_address = image_address_fast<SrcTraits>(src, src_x, src_y);
@ -180,14 +178,14 @@ static void merge_zoomed_image(Image* dst, const Image* src, const Palette* pal,
// read 'src' and 'dst' and blend them, put the result in `scanline'
for (x=0; x<src_w; x++) {
assert(scanline_address >= scanline);
assert(scanline_address < scanline + src_w);
ASSERT(scanline_address >= scanline);
ASSERT(scanline_address < scanline + src_w);
assert(src_address >= image_address_fast<SrcTraits>(src, src_x, src_y));
assert(src_address <= image_address_fast<SrcTraits>(src, src_x+src_w-1, src_y));
assert(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
assert(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
assert(dst_address < dst_address_end);
ASSERT(src_address >= image_address_fast<SrcTraits>(src, src_x, src_y));
ASSERT(src_address <= image_address_fast<SrcTraits>(src, src_x+src_w-1, src_y));
ASSERT(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
ASSERT(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
ASSERT(dst_address < dst_address_end);
blender(scanline_address, dst_address, src_address, opacity);
@ -219,11 +217,11 @@ static void merge_zoomed_image(Image* dst, const Image* src, const Palette* pal,
// first pixel
if (offsetx > 0) {
for (box_x=0; box_x<offsetx; box_x++) {
assert(scanline_address >= scanline);
assert(scanline_address < scanline + src_w);
assert(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
assert(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
assert(dst_address < dst_address_end);
ASSERT(scanline_address >= scanline);
ASSERT(scanline_address < scanline + src_w);
ASSERT(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
ASSERT(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
ASSERT(dst_address < dst_address_end);
(*dst_address++) = (*scanline_address);
@ -238,9 +236,9 @@ static void merge_zoomed_image(Image* dst, const Image* src, const Palette* pal,
// the rest of the line
for (; x<src_w; x++) {
for (box_x=0; box_x<box_w; box_x++) {
assert(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
assert(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
assert(dst_address < dst_address_end);
ASSERT(dst_address >= image_address_fast<DstTraits>(dst, dst_x, dst_y));
ASSERT(dst_address <= image_address_fast<DstTraits>(dst, dst_x+dst_w-1, dst_y));
ASSERT(dst_address < dst_address_end);
(*dst_address++) = (*scanline_address);
@ -499,7 +497,7 @@ void RenderEngine::renderImage(Image* rgb_image, Image* src_image, const Palette
{
void (*zoomed_func)(Image*, const Image*, const Palette*, int, int, int, int, int);
assert(rgb_image->imgtype == IMAGE_RGB && "renderImage accepts RGB destination images only");
ASSERT(rgb_image->imgtype == IMAGE_RGB && "renderImage accepts RGB destination images only");
switch (src_image->imgtype) {

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro/color.h>
#include <allegro/draw.h>
#include <allegro/gfx.h>
@ -124,7 +123,7 @@ static void thumbnail_render(BITMAP* bmp, const Image* image, bool has_alpha, co
int w, h, x1, y1;
double sx, sy, scale;
assert(image != NULL);
ASSERT(image != NULL);
sx = (double)image->w / (double)bmp->w;
sy = (double)image->h / (double)bmp->h;
@ -177,7 +176,7 @@ static void thumbnail_render(BITMAP* bmp, const Image* image, bool has_alpha, co
for (x=0; x<w; x++) {
c = image_getpixel(image, x*scale, y*scale);
if (c != 0) {
assert(c >= 0 && (size_t)c < palette->size());
ASSERT(c >= 0 && (size_t)c < palette->size());
c = palette->getEntry(MID(0, (size_t)c, palette->size()-1));
putpixel(bmp, x1+x, y1+y, makecol(_rgba_getr(c),
@ -217,7 +216,7 @@ static void thumbnail_render(BITMAP* bmp, const Image* image, bool has_alpha, co
for (x=0; x<w; x++) {
c = image_getpixel(image, x*scale, y*scale);
assert(c >= 0 && (size_t)c < palette->size());
ASSERT(c >= 0 && (size_t)c < palette->size());
c = palette->getEntry(MID(0, (size_t)c, palette->size()-1));
putpixel(bmp, x1+x, y1+y, makecol(_rgba_getr(c),

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <cstring>
#include <allegro.h>
@ -172,7 +171,7 @@ bool ColorBar::onProcessMessage(JMessage msg)
m_colorsPerColumn--;
}
assert(m_colorsPerColumn*m_columns <= 256);
ASSERT(m_colorsPerColumn*m_columns <= 256);
}
SkinneableTheme* theme = static_cast<SkinneableTheme*>(this->theme);
@ -475,7 +474,7 @@ color_t ColorBar::getHotColor(hotcolor_t hot)
case HOTCOLOR_FGCOLOR: return m_fgcolor;
case HOTCOLOR_BGCOLOR: return m_bgcolor;
default:
assert(hot >= 0 && hot < getEntriesCount());
ASSERT(hot >= 0 && hot < getEntriesCount());
return getEntryColor(hot);
}
}
@ -484,7 +483,7 @@ void ColorBar::setHotColor(hotcolor_t hot, color_t color)
{
switch (hot) {
case HOTCOLOR_NONE:
assert(false);
ASSERT(false);
break;
case HOTCOLOR_FGCOLOR:
setFgColor(color);
@ -493,7 +492,7 @@ void ColorBar::setHotColor(hotcolor_t hot, color_t color)
setBgColor(color);
break;
default:
assert(hot >= 0 && hot < getEntriesCount());
ASSERT(hot >= 0 && hot < getEntriesCount());
#if 0
m_color[hot] = color;

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include <vector>
@ -333,7 +332,7 @@ static void colorselector_set_color2(JWidget widget, color_t color,
m = models+MODEL_GRAY;
break;
default:
assert(false);
ASSERT(false);
}
// // Select the RGB button

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <assert.h>
#include <allegro.h>
#include "jinete/jbase.h"
@ -148,7 +147,7 @@ static void on_palette_change_update_cursor_color()
static void on_pen_size_before_change()
{
assert(current_editor != NULL);
ASSERT(current_editor != NULL);
pen_size_thick = current_editor->editor_get_cursor_thick();
if (pen_size_thick)
@ -157,7 +156,7 @@ static void on_pen_size_before_change()
static void on_pen_size_after_change()
{
assert(current_editor != NULL);
ASSERT(current_editor != NULL);
// Show drawing cursor
if (current_editor->getSprite() && pen_size_thick > 0)
@ -176,7 +175,7 @@ static Pen* editor_get_current_pen()
->getToolSettings(current_tool)
->getPen();
assert(pen_settings != NULL);
ASSERT(pen_settings != NULL);
if (!current_pen ||
current_pen->get_type() != pen_settings->getType() ||
@ -230,8 +229,8 @@ void Editor::editor_cursor_exit()
*/
void Editor::editor_draw_cursor(int x, int y, bool refresh)
{
assert(m_cursor_thick == 0);
assert(m_sprite != NULL);
ASSERT(m_cursor_thick == 0);
ASSERT(m_sprite != NULL);
/* get drawable region */
clipping_region = jwidget_get_drawable_region(this, JI_GDR_CUTTOPWINDOWS);
@ -394,7 +393,7 @@ void Editor::editor_clean_cursor(bool refresh)
{
int x, y;
assert(m_cursor_thick != 0);
ASSERT(m_cursor_thick != 0);
clipping_region = jwidget_get_drawable_region(this, JI_GDR_CUTTOPWINDOWS);
@ -480,7 +479,7 @@ static void generate_cursor_boundaries()
if (current_tool) {
IPenSettings* pen_settings = context->getSettings()
->getToolSettings(current_tool)->getPen();
assert(pen_settings != NULL);
ASSERT(pen_settings != NULL);
pen = new Pen(pen_settings->getType(),
pen_settings->getSize(),
pen_settings->getAngle());
@ -672,7 +671,7 @@ static int point_inside_region(int x, int y, JRegion region)
static int get_pen_color(Sprite *sprite)
{
color_t c = UIContext::instance()->getSettings()->getFgColor();
assert(sprite != NULL);
ASSERT(sprite != NULL);
// Avoid using invalid colors
if (!color_is_valid(c))

View File

@ -20,7 +20,6 @@
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <allegro.h>
@ -687,7 +686,7 @@ void Editor::editor_to_screen(int xin, int yin, int *xout, int *yout)
void Editor::show_drawing_cursor()
{
assert(m_sprite != NULL);
ASSERT(m_sprite != NULL);
if (!m_cursor_thick && m_cursor_candraw) {
jmouse_hide();
@ -828,7 +827,7 @@ enum WHEEL_ACTION { WHEEL_NONE,
bool Editor::onProcessMessage(JMessage msg)
{
assert((m_state == EDITOR_STATE_DRAWING && m_toolLoopManager != NULL) ||
ASSERT((m_state == EDITOR_STATE_DRAWING && m_toolLoopManager != NULL) ||
(m_state != EDITOR_STATE_DRAWING && m_toolLoopManager == NULL));
switch (msg->type) {
@ -954,7 +953,7 @@ bool Editor::onProcessMessage(JMessage msg)
// Drawing loop
if (m_state == EDITOR_STATE_DRAWING) {
assert(m_toolLoopManager != NULL);
ASSERT(m_toolLoopManager != NULL);
m_toolLoopManager->pressButton(msg);
@ -1082,7 +1081,7 @@ bool Editor::onProcessMessage(JMessage msg)
}
// Start the Tool-Loop
else if (m_sprite->getCurrentLayer()) {
assert(m_toolLoopManager == NULL);
ASSERT(m_toolLoopManager == NULL);
IToolLoop* toolLoop = createToolLoopImpl(UIContext::instance(), msg);
if (!toolLoop)
@ -1186,13 +1185,13 @@ bool Editor::onProcessMessage(JMessage msg)
else if (m_state == EDITOR_STATE_DRAWING) {
acquire_bitmap(ji_screen);
assert(m_toolLoopManager != NULL);
ASSERT(m_toolLoopManager != NULL);
// Clean the area occupied by the cursor in the screen
if (m_cursor_thick)
editor_clean_cursor();
assert(m_toolLoopManager != NULL);
ASSERT(m_toolLoopManager != NULL);
// Infinite scroll
controlInfiniteScroll(msg);
@ -1203,7 +1202,7 @@ bool Editor::onProcessMessage(JMessage msg)
editor_clean_cursor();
// notify mouse movement to the tool
assert(m_toolLoopManager != NULL);
ASSERT(m_toolLoopManager != NULL);
m_toolLoopManager->movement(msg);
// draw the cursor again
@ -1239,7 +1238,7 @@ bool Editor::onProcessMessage(JMessage msg)
// Drawing
if (m_state == EDITOR_STATE_DRAWING) {
assert(m_toolLoopManager != NULL);
ASSERT(m_toolLoopManager != NULL);
if (m_toolLoopManager->releaseButton(msg))
return true;
@ -1262,7 +1261,7 @@ bool Editor::onProcessMessage(JMessage msg)
return true;
}
else {
assert(m_toolLoopManager == NULL);
ASSERT(m_toolLoopManager == NULL);
m_state = EDITOR_STATE_STANDBY;
}
@ -1800,7 +1799,7 @@ public:
// Create the pen
IPenSettings* pen_settings = settings->getToolSettings(m_tool)->getPen();
assert(pen_settings != NULL);
ASSERT(pen_settings != NULL);
m_pen = new Pen(pen_settings->getType(),
pen_settings->getSize(),

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <cassert>
#include <allegro.h>
#include <algorithm>
@ -144,8 +143,8 @@ void fileview_set_current_folder(JWidget widget, FileItem *folder)
{
FileView* fileview = fileview_data(widget);
assert(folder != NULL);
assert(fileitem_is_browsable(folder));
ASSERT(folder != NULL);
ASSERT(fileitem_is_browsable(folder));
fileview->current_folder = folder;
fileview->req_valid = false;
@ -199,7 +198,7 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg)
fileview_stop_threads(fileview);
// at this point, can't be threads running in background
assert(fileview->monitors.empty());
ASSERT(fileview->monitors.empty());
jmanager_remove_timer(fileview->timer_id);
delete fileview;
@ -869,7 +868,7 @@ static void monitor_free_thumbnail_generation(void *_data)
MonitorList& monitors(fileview_data(data->fileview)->monitors);
MonitorList::iterator it =
std::find(monitors.begin(), monitors.end(), data->monitor);
assert(it != monitors.end());
ASSERT(it != monitors.end());
monitors.erase(it);
// destroy the thumbnail

View File

@ -19,7 +19,6 @@
#include "config.h"
#include <allegro.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@ -80,7 +79,7 @@ void PalEdit::setColumns(int columns)
{
int old_columns = m_columns;
assert(columns >= 1 && columns <= 256);
ASSERT(columns >= 1 && columns <= 256);
m_columns = columns;
if (m_columns != old_columns) {
@ -99,7 +98,7 @@ void PalEdit::setBoxSize(int boxsize)
void PalEdit::selectColor(int index)
{
assert(index >= 0 && index <= 255);
ASSERT(index >= 0 && index <= 255);
if ((m_color[0] != index) ||
(m_color[1] != index) ||
@ -117,8 +116,8 @@ void PalEdit::selectColor(int index)
void PalEdit::selectRange(int begin, int end, int range_type)
{
/* assert(begin >= 0 && begin <= 255); */
/* assert(end >= 0 && end <= 255); */
/* ASSERT(begin >= 0 && begin <= 255); */
/* ASSERT(end >= 0 && end <= 255); */
m_color[0] = begin;
m_color[1] = end;

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <assert.h>
#include "jinete/jmanager.h"
#include "jinete/jmessage.h"
#include "jinete/jwidget.h"
@ -64,7 +62,7 @@ int preview_type()
void preview_restart(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
Preview* preview = reinterpret_cast<Preview*>(jwidget_get_data(widget, preview_type()));
@ -77,7 +75,7 @@ void preview_restart(JWidget widget)
Effect *preview_get_effect(JWidget widget)
{
assert_valid_widget(widget);
ASSERT_VALID_WIDGET(widget);
Preview* preview = reinterpret_cast<Preview*>(jwidget_get_data(widget, preview_type()));
return preview->effect;

View File

@ -22,7 +22,6 @@
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <cassert>
#include "jinete/jinete.h"
@ -232,7 +231,7 @@ void StatusBar::showColor(int msecs, const char* text, color_t color, int alpha)
void StatusBar::showTool(int msecs, Tool* tool)
{
assert(tool != NULL);
ASSERT(tool != NULL);
// Tool name
std::string text = tool->getText();
@ -267,7 +266,7 @@ Progress* StatusBar::addProgress()
void StatusBar::removeProgress(Progress* progress)
{
assert(progress->m_statusbar == this);
ASSERT(progress->m_statusbar == this);
jlist_remove(m_progress, progress);
jwidget_dirty(this);
@ -609,7 +608,7 @@ bool StatusBar::onProcessMessage(JMessage msg)
sprite->setCurrentLayer(layer);
// Flash the current layer
assert(current_editor != NULL); // Cannot be null when we have a current sprite
ASSERT(current_editor != NULL); // Cannot be null when we have a current sprite
current_editor->flashCurrentLayer();
// Redraw the status-bar

View File

@ -20,7 +20,6 @@
#include <allegro.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include "jinete/jinete.h"
@ -128,7 +127,7 @@ void Tabs::removeTab(void* data)
std::vector<Tab*>::iterator it =
std::find(m_list_of_tabs.begin(), m_list_of_tabs.end(), tab);
assert(it != m_list_of_tabs.end() && "Removing a tab that is not part of the Tabs widget");
ASSERT(it != m_list_of_tabs.end() && "Removing a tab that is not part of the Tabs widget");
it = m_list_of_tabs.erase(it);
@ -643,7 +642,7 @@ static bool tabs_button_msg_proc(JWidget widget, JMessage msg)
return true;
}
else if (msg->signal.num == JI_SIGNAL_DISABLE) {
assert(tabs != NULL);
ASSERT(tabs != NULL);
if (widget->isSelected()) {
tabs->stopScrolling();
@ -654,12 +653,12 @@ static bool tabs_button_msg_proc(JWidget widget, JMessage msg)
break;
case JM_BUTTONPRESSED:
assert(tabs != NULL);
ASSERT(tabs != NULL);
tabs->startScrolling();
break;
case JM_BUTTONRELEASED:
assert(tabs != NULL);
ASSERT(tabs != NULL);
tabs->stopScrolling();
break;

View File

@ -520,7 +520,7 @@ void ToolBar::closeTipWindow()
void ToolBar::selectTool(Tool* tool)
{
assert(tool != NULL);
ASSERT(tool != NULL);
m_selected_in_group[tool->getGroup()] = tool;