@@ -515,13 +515,13 @@ static bool TarListAddFile(const char *f
#endif
DEBUG(misc, 6, "Found file in tar: %s (%d bytes, %d offset)", name, skip, pos);
if (_tar_filelist.insert(TarFileList::value_type(name, entry)).second) num++;
/* Skip to the next block.. */
skip = ALIGN(skip, 512);
skip = Align(skip, 512);
fseek(f, skip, SEEK_CUR);
pos += skip;
}
DEBUG(misc, 1, "Found tar '%s' with %d new files", filename, num);
fclose(f);
@@ -1012,14 +1012,14 @@ void RedrawScreenRect(int left, int top,
*
* @see SetDirtyBlocks
*/
void DrawDirtyBlocks()
{
byte *b = _dirty_blocks;
const int w = ALIGN(_screen.width, 64);
const int h = ALIGN(_screen.height, 8);
const int w = Align(_screen.width, 64);
const int h = Align(_screen.height, 8);
int x;
int y;
if (IsGeneratingWorld() && !IsGeneratingWorldReadyForPaint()) return;
y = 0;
@@ -550,13 +550,13 @@ template<typename T> static inline T ROR
* @note n must be a power of 2
* @param x The min value
* @param n The base of the number we are searching
* @return The smallest multiple of n equal or greater than x
template<typename T> static inline T ALIGN(const T x, uint n) {
template<typename T> static inline T Align(const T x, uint n) {
n--;
return (T)((x + n) & ~(n));
/** return the largest value that can be entered in a variable.
@@ -199,14 +199,9 @@ static inline bool SetNoDelay(SOCKET d)
return setsockopt(d, IPPROTO_TCP, TCP_NODELAY, (const char*)&b, sizeof(b)) == 0;
#else
return true;
#ifdef __APPLE__
/* Looks like sys/socket.h uses a name we got in macros.h */
#undef ALIGN
#endif /* ENABLE_NETWORK */
#endif /* NETWORK_CORE_OS_ABSTRACTION_H */
@@ -81,13 +81,13 @@ static bool MakeBmpImage(const char *nam
if (pixelformat != 8 && pixelformat != 32) return false;
f = fopen(name, "wb");
if (f == NULL) return false;
/* each scanline must be aligned on a 32bit boundary */
padw = ALIGN(w, 4);
padw = Align(w, 4);
if (pixelformat == 8) pal_size = sizeof(RgbQuad) * 256;
/* setup the file header */
bfh.type = TO_LE16('MB');
bfh.size = TO_LE32(sizeof(bfh) + sizeof(bih) + pal_size + padw * h * bpp);
@@ -94,13 +94,13 @@ static void pool_init(SettingsMemoryPool
static void *pool_alloc(SettingsMemoryPool **pool, uint size)
uint pos;
SettingsMemoryPool *p = *pool;
size = ALIGN(size, sizeof(void*));
size = Align(size, sizeof(void*));
/* first check if there's memory in the next pool */
if (p->next && p->next->pos + size <= p->next->size) {
p = p->next;
/* then check if there's not memory in the cur pool */
} else if (p->pos + size > p->size) {
@@ -44,13 +44,13 @@ static inline SpriteCache *GetSpriteCach
static SpriteCache *AllocateSpriteCache(uint index)
if (index >= _spritecache_items) {
/* Add another 1024 items to the 'pool' */
uint items = ALIGN(index + 1, 1024);
uint items = Align(index + 1, 1024);
DEBUG(sprite, 4, "Increasing sprite cache to %d items (%d bytes)", items, items * sizeof(*_spritecache));
_spritecache = ReallocT(_spritecache, items);
if (_spritecache == NULL) {
@@ -433,13 +433,13 @@ static void DeleteEntryFromSpriteCache()
void* AllocSprite(size_t mem_req)
mem_req += sizeof(MemBlock);
/* Align this to an uint32 boundary. This also makes sure that the 2 least
* bits are not used, so we could use those for other things. */
mem_req = ALIGN(mem_req, sizeof(uint32));
mem_req = Align(mem_req, sizeof(uint32));
for (;;) {
MemBlock* s;
for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
if (s->size & S_FREE_MASK) {
@@ -357,14 +357,12 @@ CDECL error(const char *str, ...);
#if defined(MORPHOS)
/* MorphOS doesn't have C++ conformant _stricmp... */
#define _stricmp stricmp
#elif defined(OPENBSD)
/* OpenBSD uses strcasecmp(3) */
#define _stricmp strcasecmp
/* OpenBSD furthermore already has an ALIGN macro. */
#if !defined(MORPHOS) && !defined(OPENBSD)
/* MorphOS & OpenBSD don't know wchars, the rest does :( */
#define HAS_WCHAR
#endif /* !defined(MORPHOS) && !defined(OPENBSD) */
@@ -49,14 +49,12 @@ extern "C" void HideMenuBar();
@interface NSApplication(NSAppleMenu)
- (void)setAppleMenu:(NSMenu *)menu;
@end
/* Defined in ppc/param.h or i386/param.h included from sys/param.h */
/* Defined in stdbool.h */
#ifndef __cplusplus
# ifndef __BEOS__
# undef bool
# undef false
# undef true
@@ -683,13 +683,13 @@ static bool AllocateDibSection(int w, in
if (bpp == 0) error("Can't use a blitter that blits 0 bpp for normal visuals");
if (w == _screen.width && h == _screen.height)
return false;
_screen.width = w;
_screen.pitch = (bpp == 8) ? ALIGN(w, 4) : w;
_screen.pitch = (bpp == 8) ? Align(w, 4) : w;
_screen.height = h;
bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi->bmiHeader.biWidth = _wnd.width = w;
Status change: