summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/arexx.c4
-rw-r--r--amiga/bitmap.c10
-rw-r--r--amiga/clipboard.c9
-rwxr-xr-xamiga/misc.c13
-rw-r--r--amiga/misc.h1
-rw-r--r--amiga/os3support.h7
6 files changed, 30 insertions, 14 deletions
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 35cdfb028..b138d4969 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -238,7 +238,7 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
{
if(!gw) return;
- dln = AllocVecTags(sizeof(struct dlnode), AVT_ClearWithValue, 0, TAG_DONE);
+ dln = ami_misc_allocvec_clear(sizeof(struct dlnode), 0);
dln->filename = strdup((char *)cmd->ac_ArgList[3]);
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 90f89e9d3..e7bd72ce4 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -40,6 +40,7 @@
#include "amiga/gui.h"
#include "amiga/bitmap.h"
#include "amiga/download.h"
+#include "amiga/misc.h"
/**
* Create a bitmap.
@@ -54,13 +55,10 @@ void *bitmap_create(int width, int height, unsigned int state)
{
struct bitmap *bitmap;
- bitmap = AllocVecTags(sizeof(struct bitmap), AVT_ClearWithValue, 0, TAG_DONE);
+ bitmap = ami_misc_allocvec_clear(sizeof(struct bitmap), 0);
if(bitmap)
{
- bitmap->pixdata = AllocVecTags(width*height*4,
- AVT_Type,MEMF_PRIVATE,
- AVT_ClearWithValue,0xff,
- TAG_DONE);
+ bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
bitmap->width = width;
bitmap->height = height;
@@ -378,7 +376,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
bm_format, bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
#ifndef __amigaos4__
- ami_bitmap_argb_to_rgba(bitmap);
+ ami_bitmap_argb_to_rgba(bm);
#endif
bitmap_set_opaque(bm, bitmap_test_opaque(bm));
}
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index a14a7b7ad..c95a9a3a6 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -42,6 +42,7 @@
#include "amiga/iff_cset.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
+#include "amiga/misc.h"
#include "amiga/utf8.h"
#define ID_UTF8 MAKE_ID('U','T','F','8')
@@ -110,10 +111,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
case 0:
if(ci_new) {
- ci_next->ci_Next = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
+ ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
ci_next = ci_next->ci_Next;
} else {
- ci_new = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
+ ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
ci_next = ci_new;
}
@@ -124,10 +125,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
default:
if(ci_new) {
- ci_next->ci_Next = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
+ ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
ci_next = ci_next->ci_Next;
} else {
- ci_new = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
+ ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
ci_next = ci_new;
}
diff --git a/amiga/misc.c b/amiga/misc.c
index 2f2f93eb8..0cd3baedd 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -34,6 +34,19 @@
#include "amiga/misc.h"
#include "amiga/utf8.h"
+void *ami_misc_allocvec_clear(int size, UBYTE value)
+{
+#ifdef __amigaos4__
+ return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
+#else
+ void *mem = AllocVec(size, MEMF_CLEAR);
+ if (mem && (value != 0)) {
+ memset(mem, value, size);
+ }
+ return mem;
+#endif
+}
+
static LONG ami_misc_req(const char *message, uint32 type)
{
LONG ret = 0;
diff --git a/amiga/misc.h b/amiga/misc.h
index 33313036f..66a6f1d11 100644
--- a/amiga/misc.h
+++ b/amiga/misc.h
@@ -23,6 +23,7 @@
extern struct gui_file_table *amiga_file_table;
struct Window;
+void *ami_misc_allocvec_clear(int size, UBYTE value);
char *translate_escape_chars(const char *s);
void ami_misc_fatal_error(const char *message);
int32 ami_warn_user_multi(const char *body,
diff --git a/amiga/os3support.h b/amiga/os3support.h
index cadcc737f..708ed50ce 100644
--- a/amiga/os3support.h
+++ b/amiga/os3support.h
@@ -36,6 +36,9 @@
#include <exec/memory.h>
#endif
+/* Macros */
+#define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0
+
/* Define extra memory type flags */
#define MEMF_PRIVATE MEMF_ANY
#define MEMF_SHARED MEMF_ANY
@@ -57,8 +60,8 @@
#define ObtainCharsetInfo(A,B,C) (const char *)"ISO-8859-1"
/* DOS */
-#define FOpen(A,B,C) Open(A,B);
-#define FClose(A) Close(A);
+#define FOpen(A,B,C) Open(A,B)
+#define FClose(A) Close(A)
/* Intuition */
#define IDoMethod DoMethod