summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-12 08:26:30 +0000
committerrubidium <rubidium@openttd.org>2011-11-12 08:26:30 +0000
commit4f87d2e88c4b42f4ae4a5c7956f2287740ef174b (patch)
treed390107524182c8276e616c20612708f9c893f7d
parentbd64bf6372399bad1a92565ae7d3c243658d241f (diff)
downloadopenttd-4f87d2e88c4b42f4ae4a5c7956f2287740ef174b.tar.xz
(svn r23194) -Codechange: don't cast away const needlessly
-rw-r--r--src/3rdparty/squirrel/squirrel/sqdebug.cpp2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp6
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.h2
-rw-r--r--src/blitter/32bpp_anim.cpp12
-rw-r--r--src/blitter/32bpp_base.cpp8
-rw-r--r--src/blitter/32bpp_base.hpp2
-rw-r--r--src/blitter/32bpp_optimized.cpp4
-rw-r--r--src/blitter/8bpp_base.cpp8
-rw-r--r--src/blitter/8bpp_base.hpp2
-rw-r--r--src/blitter/base.hpp2
-rw-r--r--src/blitter/null.hpp2
11 files changed, 25 insertions, 25 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqdebug.cpp b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
index 055762651..c683697d7 100644
--- a/src/3rdparty/squirrel/squirrel/sqdebug.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
@@ -91,7 +91,7 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
}
}
-void SQVM::Raise_IdxError(SQObject &o)
+void SQVM::Raise_IdxError(const SQObject &o)
{
SQObjectPtr oval = PrintObjVal(o);
Raise_Error(_SC("the index '%.50s' does not exist"), _stringval(oval));
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 1dbd83f30..1a991e022 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -459,7 +459,7 @@ bool SQVM::DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjec
#define sarg1 (*(const_cast<SQInt32 *>(&_i_._arg1)))
#define arg2 (_i_._arg2)
#define arg3 (_i_._arg3)
-#define sarg3 ((SQInteger)*((signed char *)&_i_._arg3))
+#define sarg3 ((SQInteger)*((const signed char *)&_i_._arg3))
SQRESULT SQVM::Suspend()
{
@@ -742,7 +742,7 @@ exception_restore:
continue;
case _OP_LOAD: TARGET = ci->_literals[arg1]; continue;
case _OP_LOADINT: TARGET = (SQInteger)arg1; continue;
- case _OP_LOADFLOAT: TARGET = *((SQFloat *)&arg1); continue;
+ case _OP_LOADFLOAT: TARGET = *((const SQFloat *)&arg1); continue;
case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue;
case _OP_TAILCALL:
temp_reg = STK(arg1);
@@ -1434,7 +1434,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
_table(self)->Remove(key);
}
else {
- Raise_IdxError((SQObject &)key);
+ Raise_IdxError((const SQObject &)key);
return false;
}
}
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h
index 7ba404564..73b5a0451 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.h
+++ b/src/3rdparty/squirrel/squirrel/sqvm.h
@@ -84,7 +84,7 @@ public:
void Raise_Error(const SQChar *s, ...);
void Raise_Error(SQObjectPtr &desc);
- void Raise_IdxError(SQObject &o);
+ void Raise_IdxError(const SQObject &o);
void Raise_CompareError(const SQObject &o1, const SQObject &o2);
void Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger type);
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp
index 17ea0af72..be8c26f6c 100644
--- a/src/blitter/32bpp_anim.cpp
+++ b/src/blitter/32bpp_anim.cpp
@@ -44,7 +44,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_px++;
- const uint8 *src_n_ln = src_n + *(uint32 *)src_n;
+ const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
src_n += 4;
uint32 *dst_end = dst + bp->skip_left;
@@ -296,7 +296,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
assert(!_screen_disable_anim);
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint32 *dst = (uint32 *)video;
- uint32 *usrc = (uint32 *)src;
+ const uint32 *usrc = (const uint32 *)src;
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
for (; height > 0; height--) {
@@ -309,7 +309,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
dst += _screen.pitch;
/* Copy back the anim-buffer */
memcpy(anim_line, usrc, width * sizeof(uint8));
- usrc = (uint32 *)((uint8 *)usrc + width);
+ usrc = (const uint32 *)((const uint8 *)usrc + width);
anim_line += this->anim_buf_width;
/* Okay, it is *very* likely that the image we stored is using
@@ -336,12 +336,12 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
assert(!_screen_disable_anim);
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint32 *udst = (uint32 *)dst;
- uint32 *src = (uint32 *)video;
- uint8 *anim_line;
+ const uint32 *src = (const uint32 *)video;
+ const uint8 *anim_line;
if (this->anim_buf == NULL) return;
- anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
+ anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp
index 0499f5712..01b3c7d6e 100644
--- a/src/blitter/32bpp_base.cpp
+++ b/src/blitter/32bpp_base.cpp
@@ -12,7 +12,7 @@
#include "../stdafx.h"
#include "32bpp_base.hpp"
-void *Blitter_32bppBase::MoveTo(const void *video, int x, int y)
+void *Blitter_32bppBase::MoveTo(void *video, int x, int y)
{
return (uint32 *)video + x + y * _screen.pitch;
}
@@ -39,7 +39,7 @@ void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colou
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
{
uint32 *dst = (uint32 *)video;
- uint32 *usrc = (uint32 *)src;
+ const uint32 *usrc = (const uint32 *)src;
for (; height > 0; height--) {
memcpy(dst, usrc, width * sizeof(uint32));
@@ -51,7 +51,7 @@ void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width,
void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, int height)
{
uint32 *udst = (uint32 *)dst;
- uint32 *src = (uint32 *)video;
+ const uint32 *src = (const uint32 *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
@@ -63,7 +63,7 @@ void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, in
void Blitter_32bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
{
uint32 *udst = (uint32 *)dst;
- uint32 *src = (uint32 *)video;
+ const uint32 *src = (const uint32 *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index 1c9d331b6..ed3c24549 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -20,7 +20,7 @@
class Blitter_32bppBase : public Blitter {
public:
/* virtual */ uint8 GetScreenDepth() { return 32; }
- /* virtual */ void *MoveTo(const void *video, int x, int y);
+ /* virtual */ void *MoveTo(void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp
index 91e04c02a..acbf91b0f 100644
--- a/src/blitter/32bpp_optimized.cpp
+++ b/src/blitter/32bpp_optimized.cpp
@@ -40,7 +40,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
/* skip upper lines in src_px and src_n */
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
- src_n += *(uint32 *)src_n;
+ src_n += *(const uint32 *)src_n;
}
/* skip lines in dst */
@@ -58,7 +58,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
src_px++;
/* next src_n line begins here */
- const uint8 *src_n_ln = src_n + *(uint32 *)src_n;
+ const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
src_n += 4;
/* we will end this line when we reach this point */
diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp
index 6371e3a8d..eecf63f02 100644
--- a/src/blitter/8bpp_base.cpp
+++ b/src/blitter/8bpp_base.cpp
@@ -23,7 +23,7 @@ void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, P
} while (--height);
}
-void *Blitter_8bppBase::MoveTo(const void *video, int x, int y)
+void *Blitter_8bppBase::MoveTo(void *video, int x, int y)
{
return (uint8 *)video + x + y * _screen.pitch;
}
@@ -44,7 +44,7 @@ void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour
void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
{
uint8 *dst = (uint8 *)video;
- uint8 *usrc = (uint8 *)src;
+ const uint8 *usrc = (const uint8 *)src;
for (; height > 0; height--) {
memcpy(dst, usrc, width * sizeof(uint8));
@@ -56,7 +56,7 @@ void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, i
void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int height)
{
uint8 *udst = (uint8 *)dst;
- uint8 *src = (uint8 *)video;
+ const uint8 *src = (const uint8 *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint8));
@@ -68,7 +68,7 @@ void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int
void Blitter_8bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
{
uint8 *udst = (uint8 *)dst;
- uint8 *src = (uint8 *)video;
+ const uint8 *src = (const uint8 *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint8));
diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp
index 03f194763..f6dbdcc09 100644
--- a/src/blitter/8bpp_base.hpp
+++ b/src/blitter/8bpp_base.hpp
@@ -19,7 +19,7 @@ class Blitter_8bppBase : public Blitter {
public:
/* virtual */ uint8 GetScreenDepth() { return 8; }
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
- /* virtual */ void *MoveTo(const void *video, int x, int y);
+ /* virtual */ void *MoveTo(void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp
index 21d42d64c..f52f414f1 100644
--- a/src/blitter/base.hpp
+++ b/src/blitter/base.hpp
@@ -87,7 +87,7 @@ public:
* @param y How much you want to scroll to the bottom.
* @return A new destination pointer moved the the requested place.
*/
- virtual void *MoveTo(const void *video, int x, int y) = 0;
+ virtual void *MoveTo(void *video, int x, int y) = 0;
/**
* Draw a pixel with a given colour on the video-buffer.
diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp
index e9e157d72..af49d485e 100644
--- a/src/blitter/null.hpp
+++ b/src/blitter/null.hpp
@@ -21,7 +21,7 @@ public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
- /* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
+ /* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width) {};