Set up small static-init test in Ballfield app

This commit is contained in:
pelya
2010-12-21 14:46:34 +00:00
parent 1089d16218
commit f975581a04
5 changed files with 44 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ SDL_Surface *clean_alpha(SDL_Surface *s)
}
SDL_LockSurface(work);
pixels = work->pixels;
pixels = (Uint32 *)work->pixels;
pp = work->pitch / sizeof(Uint32);
for(y = 0; y < work->h; ++y)
for(x = 0; x < work->w; ++x)
@@ -179,7 +179,7 @@ void print_num(SDL_Surface *dst, SDL_Surface *font, int x, int y, float value)
ballfield_t *ballfield_init(void)
{
int i;
ballfield_t *bf = calloc(sizeof(ballfield_t), 1);
ballfield_t *bf = (ballfield_t *)calloc(sizeof(ballfield_t), 1);
if(!bf)
return NULL;
for(i = 0; i < BALLS; ++i)
@@ -210,7 +210,7 @@ static int ballfield_init_frames(ballfield_t *bf)
/*
* Set up source rects for all frames
*/
bf->frames = calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
bf->frames = (SDL_Rect *)calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
if(!bf->frames)
{
fprintf(stderr, "No memory for frame rects!\n");

View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#include "test.h"
int test::initCount = 0;
int test::initCount2 = 12345;
test::test()
{
initCount++;
__android_log_print(ANDROID_LOG_INFO, "==TEST==", "test::test(): initCount %d initCount2 %d", initCount, initCount2);
}
test::~test()
{
initCount--;
__android_log_print(ANDROID_LOG_INFO, "==TEST==", "test::~test(): initCount %d initCount2 %d", initCount, initCount2);
}

View File

@@ -0,0 +1,15 @@
#include <stdio.h>
#include <android/log.h>
class test
{
public:
test();
~test();
public:
static int initCount;
static int initCount2;
};

View File

@@ -0,0 +1,7 @@
#include <stdio.h>
#include "test.h"
test t;

View File

@@ -1 +1 @@
fheroes2
ballfield