diff options
author | skidd13 <skidd13@openttd.org> | 2007-11-19 20:40:14 +0000 |
---|---|---|
committer | skidd13 <skidd13@openttd.org> | 2007-11-19 20:40:14 +0000 |
commit | 58bb5c752568f8f9a1cb4d9533268d0ecad34e12 (patch) | |
tree | 6112141c4dddc87df3ac0db557f34623319c73e0 /src | |
parent | d076ea8697a61a4d7783bd6e1b5c7f12ecc2ec83 (diff) | |
download | openttd-58bb5c752568f8f9a1cb4d9533268d0ecad34e12.tar.xz |
(svn r11480) -Codechange: Rename the function ALIGN fitting to the naming style
This fixes also FS#1450
Diffstat (limited to 'src')
-rw-r--r-- | src/fileio.cpp | 2 | ||||
-rw-r--r-- | src/gfx.cpp | 4 | ||||
-rw-r--r-- | src/macros.h | 2 | ||||
-rw-r--r-- | src/network/core/os_abstraction.h | 5 | ||||
-rw-r--r-- | src/screenshot.cpp | 2 | ||||
-rw-r--r-- | src/settings.cpp | 2 | ||||
-rw-r--r-- | src/spritecache.cpp | 4 | ||||
-rw-r--r-- | src/stdafx.h | 2 | ||||
-rw-r--r-- | src/video/cocoa_v.mm | 2 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 2 |
10 files changed, 9 insertions, 18 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp index f92a7f6ab..a2db03896 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -518,7 +518,7 @@ static bool TarListAddFile(const char *filename) 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; } diff --git a/src/gfx.cpp b/src/gfx.cpp index 8f8bb3137..c8152e677 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1015,8 +1015,8 @@ void RedrawScreenRect(int left, int top, int right, int bottom) 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; diff --git a/src/macros.h b/src/macros.h index 75cd43b7a..a4dd78845 100644 --- a/src/macros.h +++ b/src/macros.h @@ -553,7 +553,7 @@ template<typename T> static inline T ROR(const T x, const uint8 n) * @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)); } diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h index 46be0a4fe..c1f7b028a 100644 --- a/src/network/core/os_abstraction.h +++ b/src/network/core/os_abstraction.h @@ -202,11 +202,6 @@ static inline bool SetNoDelay(SOCKET d) #endif } -#ifdef __APPLE__ -/* Looks like sys/socket.h uses a name we got in macros.h */ -#undef ALIGN -#endif - #endif /* ENABLE_NETWORK */ #endif /* NETWORK_CORE_OS_ABSTRACTION_H */ diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 35009e0cf..f0ee882e9 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -84,7 +84,7 @@ static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *user 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; diff --git a/src/settings.cpp b/src/settings.cpp index 68e31ad85..082495c03 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -97,7 +97,7 @@ 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) { diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 81932e86c..c303629d0 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -47,7 +47,7 @@ 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)); @@ -436,7 +436,7 @@ void* AllocSprite(size_t mem_req) /* 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; diff --git a/src/stdafx.h b/src/stdafx.h index d3c268e7a..d9bf34835 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -360,8 +360,6 @@ CDECL error(const char *str, ...); #elif defined(OPENBSD) /* OpenBSD uses strcasecmp(3) */ #define _stricmp strcasecmp -/* OpenBSD furthermore already has an ALIGN macro. */ -#undef ALIGN #endif #if !defined(MORPHOS) && !defined(OPENBSD) diff --git a/src/video/cocoa_v.mm b/src/video/cocoa_v.mm index fd8a7cb90..cf76ccd94 100644 --- a/src/video/cocoa_v.mm +++ b/src/video/cocoa_v.mm @@ -52,8 +52,6 @@ extern "C" void HideMenuBar(); #endif -/* Defined in ppc/param.h or i386/param.h included from sys/param.h */ -#undef ALIGN /* Defined in stdbool.h */ #ifndef __cplusplus # ifndef __BEOS__ diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 03728090c..16677fb87 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -686,7 +686,7 @@ static bool AllocateDibSection(int w, int h) 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); |