[Scummvm-cvs-logs] scummvm master -> c2fd35c9ed32820f9bc616c0e9fd23075c845a2e

lordhoto lordhoto at gmail.com
Wed Nov 16 18:18:08 CET 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
61795739f8 COMMON: Rename Common::set_to to Common::fill.
c2fd35c9ed COMMON: Make value parameter of fill a const reference.


Commit: 61795739f8f45c5de4cfd0fe57af459146c5173c
    https://github.com/scummvm/scummvm/commit/61795739f8f45c5de4cfd0fe57af459146c5173c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-11-16T09:06:30-08:00

Commit Message:
COMMON: Rename Common::set_to to Common::fill.

This makes the name match with the name of the STL function with the same
behavior.

Changed paths:
    backends/platform/android/texture.cpp
    common/algorithm.h
    engines/cge/events.cpp
    engines/cine/cine.cpp
    engines/cine/main_loop.cpp
    engines/cruise/gfxModule.cpp
    engines/kyra/kyra_hof.cpp
    engines/kyra/lol.cpp
    engines/kyra/scene_mr.cpp
    engines/kyra/script_mr.cpp
    engines/lure/res.cpp
    engines/lure/room.cpp
    engines/lure/sound.cpp
    engines/m4/assets.cpp
    engines/m4/dialogs.cpp
    engines/m4/graphics.cpp
    engines/m4/mads_anim.cpp
    engines/m4/mads_logic.cpp
    engines/m4/mads_scene.cpp
    engines/sword25/gfx/image/renderedimage.cpp
    engines/tinsel/graphics.cpp
    engines/tsage/converse.cpp
    engines/tsage/globals.cpp
    engines/tsage/graphics.cpp
    engines/tsage/graphics.h
    engines/tsage/resources.cpp
    engines/tsage/scenes.cpp
    engines/tsage/sound.cpp
    graphics/VectorRendererSpec.cpp
    graphics/surface.cpp



diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index 53b4d1c..e211e59 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -287,7 +287,7 @@ void GLESTexture::fillBuffer(uint32 color) {
 			((color & 0xff) == ((color >> 8) & 0xff)))
 		memset(_pixels, color & 0xff, _surface.pitch * _surface.h);
 	else
-		Common::set_to(_pixels, _pixels + _surface.pitch * _surface.h,
+		Common::fill(_pixels, _pixels + _surface.pitch * _surface.h,
 						(uint16)color);
 
 	setDirty();
diff --git a/common/algorithm.h b/common/algorithm.h
index e7ccef4..d6790af 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -73,25 +73,25 @@ Out copy_if(In first, In last, Out dst, Op op) {
 	return dst;
 }
 
-// Our 'specialized' 'set_to' template for char, signed char and unsigned char arrays.
+// Our 'specialized' 'fill' template for char, signed char and unsigned char arrays.
 // Since C++ doesn't support partial specialized template functions (currently) we
 // are going this way...
 // With this we assure the usage of memset for those, which should be
-// faster than a simple loop like for the generic 'set_to'.
+// faster than a simple loop like for the generic 'fill'.
 template<class Value>
-signed char *set_to(signed char *first, signed char *last, Value val) {
+signed char *fill(signed char *first, signed char *last, Value val) {
 	memset(first, (val & 0xFF), last - first);
 	return last;
 }
 
 template<class Value>
-unsigned char *set_to(unsigned char *first, unsigned char *last, Value val) {
+unsigned char *fill(unsigned char *first, unsigned char *last, Value val) {
 	memset(first, (val & 0xFF), last - first);
 	return last;
 }
 
 template<class Value>
-char *set_to(char *first, char *last, Value val) {
+char *fill(char *first, char *last, Value val) {
 	memset(first, (val & 0xFF), last - first);
 	return last;
 }
@@ -100,7 +100,7 @@ char *set_to(char *first, char *last, Value val) {
  * Sets all elements in the range [first, last) to val.
  */
 template<class In, class Value>
-In set_to(In first, In last, Value val) {
+In fill(In first, In last, Value val) {
 	while (first != last)
 		*first++ = val;
 	return first;
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index e277d79..73bef63 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -86,7 +86,7 @@ const uint16 Keyboard::_scummVmCodes[0x60] = {
 };
 
 Keyboard::Keyboard(CGEEngine *vm) : _client(NULL), _vm(vm) {
-	Common::set_to(&_key[0], &_key[0x60], false);
+	Common::fill(&_key[0], &_key[0x60], false);
 	_current = 0;
 }
 
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 6f34b0f..6b94c33 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -141,11 +141,11 @@ void CineEngine::initialize() {
 
 	// Resize zone data table to its correct size and reset all its elements
 	g_cine->_zoneData.resize(NUM_MAX_ZONE);
-	Common::set_to(g_cine->_zoneData.begin(), g_cine->_zoneData.end(), 0);
+	Common::fill(g_cine->_zoneData.begin(), g_cine->_zoneData.end(), 0);
 
 	// Resize zone query table to its correct size and reset all its elements
 	g_cine->_zoneQuery.resize(NUM_MAX_ZONE);
-	Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
+	Common::fill(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
 
 	_timerDelayMultiplier = 12; // Set default speed
 	setupOpcodes();
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index bb0545d..971830c 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -345,7 +345,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
 
 		// Clear the zoneQuery table (Operation Stealth specific)
 		if (g_cine->getGameType() == Cine::GType_OS) {
-			Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
+			Common::fill(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
 		}
 
 		if (g_cine->getGameType() == Cine::GType_OS) {
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 7bbcae2..aa2dbc5 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -326,7 +326,7 @@ void flip() {
 void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color) {
 	for (int y = y1; y < y2; ++y) {
 		byte *p = &gfxModuleData.pPage00[y * 320 + x1];
-		Common::set_to(p, p + (x2 - x1), color);
+		Common::fill(p, p + (x2 - x1), color);
 	}
 }
 
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 8a3229e..e91f3ba 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -1083,7 +1083,7 @@ void KyraEngine_HoF::loadNPCScript() {
 #pragma mark -
 
 void KyraEngine_HoF::resetScaleTable() {
-	Common::set_to(_scaleTable, ARRAYEND(_scaleTable), 0x100);
+	Common::fill(_scaleTable, ARRAYEND(_scaleTable), 0x100);
 }
 
 void KyraEngine_HoF::setScaleTableItem(int item, int data) {
@@ -1673,7 +1673,7 @@ void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
 }
 
 void KyraEngine_HoF::clearCauldronTable() {
-	Common::set_to(_cauldronTable, ARRAYEND(_cauldronTable), -1);
+	Common::fill(_cauldronTable, ARRAYEND(_cauldronTable), -1);
 }
 
 void KyraEngine_HoF::addFrontCauldronTable(int item) {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 182b734..43859dd 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -896,7 +896,7 @@ void LoLEngine::startupNew() {
 	_availableSpells[0] = 0;
 	setupScreenDims();
 
-	Common::set_to(_globalScriptVars2, ARRAYEND(_globalScriptVars2), 0x100);
+	Common::fill(_globalScriptVars2, ARRAYEND(_globalScriptVars2), 0x100);
 
 	static const int selectIds[] = { -9, -1, -8, -5 };
 	assert(_charSelection >= 0);
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 74d2e89..d6df523 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -83,7 +83,7 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2
 	}
 
 	_specialExitCount = 0;
-	Common::set_to(_specialExitTable, ARRAYEND(_specialExitTable), 0xFFFF);
+	Common::fill(_specialExitTable, ARRAYEND(_specialExitTable), 0xFFFF);
 
 	_mainCharacter.sceneId = sceneId;
 	_sceneList[sceneId].flags &= ~1;
@@ -388,7 +388,7 @@ void KyraEngine_MR::initSceneScript(int unk1) {
 	strcat(filename, ".CPS");
 	_screen->loadBitmap(filename, 3, 3, 0);
 
-	Common::set_to(_specialSceneScriptState, ARRAYEND(_specialSceneScriptState), false);
+	Common::fill(_specialSceneScriptState, ARRAYEND(_specialSceneScriptState), false);
 	_sceneEnterX1 = 160;
 	_sceneEnterY1 = 0;
 	_sceneEnterX2 = 296;
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 8ab094a..afe11ab 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -405,7 +405,7 @@ int KyraEngine_MR::o3_updateConversations(EMCState *script) {
 	}
 
 	int convs[4];
-	Common::set_to(convs, convs+4, -1);
+	Common::fill(convs, convs+4, -1);
 
 	if (_currentChapter == 1) {
 		switch (_mainCharacter.dlgIndex) {
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index fbf9f33..6328301 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -408,7 +408,7 @@ byte *Resources::getCursor(uint8 cursorNum) {
 	if (!LureEngine::getReference().isEGA())
 		return _cursors->data() + (cursorNum * CURSOR_SIZE);
 
-	Common::set_to(&_cursor[0], &_cursor[0] + CURSOR_SIZE, 0);
+	Common::fill(&_cursor[0], &_cursor[0] + CURSOR_SIZE, 0);
 	byte *pSrc = _cursors->data() + (cursorNum * 64);
 	byte *pDest = &_cursor[0];
 
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 2cb871d..219ed02 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -43,7 +43,7 @@ RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer):
 	int cellIndex = 0;
 
 	// Reset all the cells to unused
-	Common::set_to((uint8 *) _cells, (uint8 *) _cells + GRID_SIZE, 0xff);
+	Common::fill((uint8 *) _cells, (uint8 *) _cells + GRID_SIZE, 0xff);
 
 	// Load up the screen data
 	MemoryBlock *rawData = disk.getEntry(screenId);
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 85b86a8..0aecae2 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -53,7 +53,7 @@ SoundManager::SoundManager() {
 	_isRoland = MidiDriver::getMusicType(dev) != MT_ADLIB;
 	_nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
 
-	Common::set_to(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
+	Common::fill(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
 
 	_driver = MidiDriver::createMidi(dev);
 	int statusCode = _driver->open();
@@ -182,7 +182,7 @@ void SoundManager::killSounds() {
 
 	// Clear the active sounds
 	_activeSounds.clear();
-	Common::set_to(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
+	Common::fill(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
 }
 
 void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
@@ -221,7 +221,7 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
 	}
 
 	// Mark the found channels as in use
-	Common::set_to(_channelsInUse+channelCtr, _channelsInUse+channelCtr + numChannels, true);
+	Common::fill(_channelsInUse+channelCtr, _channelsInUse+channelCtr + numChannels, true);
 
 	SoundDescResource *newEntry = new SoundDescResource();
 	newEntry->soundNumber = rec.soundNumber;
@@ -342,7 +342,7 @@ void SoundManager::tidySounds() {
 			++i;
 		else {
 			// Mark the channels that it used as now being free
-			Common::set_to(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false);
+			Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false);
 
 			i = _activeSounds.erase(i);
 		}
@@ -373,7 +373,7 @@ void SoundManager::restoreSounds() {
 		SoundDescResource *rec = (*i).get();
 
 		if ((rec->numChannels != 0) && ((rec->flags & SF_RESTORE) != 0)) {
-			Common::set_to(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true);
+			Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true);
 
 			musicInterface_Play(rec->soundNumber, rec->channel, rec->numChannels);
 			musicInterface_SetVolume(rec->channel, rec->volume);
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp
index f70a35d..e871218 100644
--- a/engines/m4/assets.cpp
+++ b/engines/m4/assets.cpp
@@ -233,7 +233,7 @@ void SpriteAsset::loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStre
 	RGB8 *palData = Palette::decodeMadsPalette(spriteStream, &numColors);
 	Common::copy(palData, &palData[numColors], &_palette[0]);
 	if (numColors < 256)
-		Common::set_to((byte *)&_palette[numColors], (byte *)&_palette[256], 0);
+		Common::fill((byte *)&_palette[numColors], (byte *)&_palette[256], 0);
 	_colorCount = numColors;
 	delete[] palData;
 	delete spriteStream;
diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp
index e9c7414..2a36fa0 100644
--- a/engines/m4/dialogs.cpp
+++ b/engines/m4/dialogs.cpp
@@ -80,7 +80,7 @@ void Dialog::writeChars(const char *srcLine) {
 	while (*srcP) {
 		bool wordEndedP = false, newlineP = false;
 		char *destP = &wordStr[0];
-		Common::set_to(&wordStr[0], &wordStr[80], 0);
+		Common::fill(&wordStr[0], &wordStr[80], 0);
 
 		// Try and get the next word
 		for (;;) {
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index 4c272de..99130ae 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -48,7 +48,7 @@ RGBList::RGBList(int numEntries, RGB8 *srcData, bool freeData) {
 	}
 
 	_palIndexes = new byte[numEntries];
-	Common::set_to(&_palIndexes[0], &_palIndexes[numEntries], 0);
+	Common::fill(&_palIndexes[0], &_palIndexes[numEntries], 0);
 }
 
 RGBList::~RGBList() {
@@ -337,7 +337,7 @@ void M4Surface::freeData() {
 }
 
 void M4Surface::clear() {
-	Common::set_to((byte *)pixels, (byte *)pixels + w * h, _vm->_palette->BLACK);
+	Common::fill((byte *)pixels, (byte *)pixels + w * h, _vm->_palette->BLACK);
 }
 
 void M4Surface::reset() {
@@ -1029,7 +1029,7 @@ static void fadeRange(MadsM4Engine *vm, RGB8 *srcPal, RGB8 *destPal,  int startI
 Palette::Palette(MadsM4Engine *vm) : _vm(vm) {
 	reset();
 	_fading_in_progress = false;
-	Common::set_to(&_usageCount[0], &_usageCount[256], 0);
+	Common::fill(&_usageCount[0], &_usageCount[256], 0);
 }
 
 void Palette::setPalette(const byte *colors, uint start, uint num) {
@@ -1166,7 +1166,7 @@ void Palette::fadeFromGreen(int numSteps, uint delayAmount, bool fadeToBlack) {
 	RGB8 *destPalette = (RGB8 *) &_originalPalette[0];
 
 	if (fadeToBlack) {
-		Common::set_to((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
+		Common::fill((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
 		destPalette = &blackPalette[0];
 	}
 
@@ -1193,7 +1193,7 @@ void Palette::fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numC
 
 	_fading_in_progress = true;
 	RGB8 blackPalette[256];
-	Common::set_to((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
+	Common::fill((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
 
 	// Initially set the black palette
 	_vm->_palette->setPalette(blackPalette, 0, numColors);
@@ -1209,7 +1209,7 @@ RGB8 *Palette::decodeMadsPalette(Common::SeekableReadStream *palStream, int *num
 	assert(*numColors <= 252);
 
 	RGB8 *palData = new RGB8[*numColors];
-	Common::set_to((byte *)&palData[0], (byte *)&palData[*numColors], 0);
+	Common::fill((byte *)&palData[0], (byte *)&palData[*numColors], 0);
 
 	for (int i = 0; i < *numColors; ++i) {
 		byte r = palStream->readByte();
@@ -1249,12 +1249,12 @@ void Palette::setMadsSystemPalette() {
 }
 
 void Palette::resetColorCounts() {
-	Common::set_to(&_usageCount[0], &_usageCount[256], 0);
+	Common::fill(&_usageCount[0], &_usageCount[256], 0);
 }
 
 void Palette::blockRange(int startIndex, int size) {
 	// Use a reference count of -1 to signal a palette index shouldn't be used
-	Common::set_to(&_usageCount[startIndex], &_usageCount[startIndex + size], -1);
+	Common::fill(&_usageCount[startIndex], &_usageCount[startIndex + size], -1);
 }
 
 void Palette::addRange(RGBList *list) {
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp
index 2ea576d..aac21ae 100644
--- a/engines/m4/mads_anim.cpp
+++ b/engines/m4/mads_anim.cpp
@@ -87,7 +87,7 @@ void TextviewView::reset() {
 	_panY = 0;
 	_panSpeed = 0;
 	_soundDriverLoaded = false;
-	Common::set_to(&_spareScreens[0], &_spareScreens[10], 0);
+	Common::fill(&_spareScreens[0], &_spareScreens[10], 0);
 	_scrollCount = 0;
 	_lineY = -1;
 	_scrollTimeout = 0;
@@ -211,7 +211,7 @@ void TextviewView::updateState() {
 	byte *pixelsP = _textSurface.getBasePtr(0, 0);
 	Common::copy(pixelsP + width(),  pixelsP + _textSurface.width() * _textSurface.height(), pixelsP);
 	pixelsP = _textSurface.getBasePtr(0, _textSurface.height() - 1);
-	Common::set_to(pixelsP, pixelsP + _textSurface.width(), _vm->_palette->BLACK);
+	Common::fill(pixelsP, pixelsP + _textSurface.width(), _vm->_palette->BLACK);
 
 	if (_scrollCount > 0) {
 		// Handling final scrolling of text off of screen
diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp
index cafddb2..a7838d0 100644
--- a/engines/m4/mads_logic.cpp
+++ b/engines/m4/mads_logic.cpp
@@ -33,7 +33,7 @@ namespace M4 {
 
 void MadsGameLogic::initializeGlobals() {
 	// Clear the entire globals list
-	Common::set_to(&_madsVm->globals()->_globals[0], &_madsVm->globals()->_globals[TOTAL_NUM_VARIABLES], 0);
+	Common::fill(&_madsVm->globals()->_globals[0], &_madsVm->globals()->_globals[TOTAL_NUM_VARIABLES], 0);
 
 	SET_GLOBAL(4, 8);
 	SET_GLOBAL(33, 1);
@@ -479,7 +479,7 @@ void MadsSceneLogic::selectScene(int sceneNum) {
 	assert(sceneNum == 101);
 	_sceneNumber = sceneNum;
 
-	Common::set_to(&_spriteIndexes[0], &_spriteIndexes[50], 0);
+	Common::fill(&_spriteIndexes[0], &_spriteIndexes[50], 0);
 
 	// If debugging is turned on, show a debug warning if any of the scene methods aren't present
 	if (gDebugLevel > 0) {
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp
index 73d9f57..e2d034f 100644
--- a/engines/m4/mads_scene.cpp
+++ b/engines/m4/mads_scene.cpp
@@ -729,7 +729,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su
 				}
 			} else {
 				// 8-bit depth pixels
-				Common::set_to(destP, destP + runLength, *srcP++);
+				Common::fill(destP, destP + runLength, *srcP++);
 				destP += runLength;
 			}
 		}
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 3b29b03..b0d4853 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -152,7 +152,7 @@ RenderedImage::RenderedImage(uint width, uint height, bool &result) :
 	_height(height) {
 
 	_data = new byte[width * height * 4];
-	Common::set_to(_data, &_data[width * height * 4], 0);
+	Common::fill(_data, &_data[width * height * 4], 0);
 
 	_backSurface = Kernel::getInstance()->getGfx()->getSurface();
 
@@ -507,7 +507,7 @@ int *RenderedImage::scaleLine(int size, int srcSize) {
 	int scale = 100 * size / srcSize;
 	assert(scale > 0);
 	int *v = new int[size];
-	Common::set_to(v, &v[size], 0);
+	Common::fill(v, &v[size], 0);
 
 	int distCtr = 0;
 	int *destP = v;
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 6a5d626..5453101 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -478,9 +478,9 @@ static void t2WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
 						// Non-transparent run length
 						color += pObj->constant;
 						if (horizFlipped)
-							Common::set_to(tempP - runLength + 1, tempP + 1, color);
+							Common::fill(tempP - runLength + 1, tempP + 1, color);
 						else
-							Common::set_to(tempP, tempP + runLength, color);
+							Common::fill(tempP, tempP + runLength, color);
 					}
 				}
 
@@ -533,7 +533,7 @@ static void WrtConst(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) {
 
 	// Loop through any remaining lines
 	while (pObj->height > 0) {
-		Common::set_to(destP, destP + pObj->width, pObj->constant);
+		Common::fill(destP, destP + pObj->width, pObj->constant);
 
 		--pObj->height;
 		destP += SCREEN_WIDTH;
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index d86548b..31a689b 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -32,7 +32,7 @@ namespace TsAGE {
 
 
 SequenceManager::SequenceManager() : Action() {
-	Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+	Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
 	_sequenceData.clear();
 	_fontNum = 0;
 	_sequenceOffset = 0;
@@ -81,7 +81,7 @@ void SequenceManager::remove() {
 	if (g_globals->_sceneObjects->contains(&_sceneText))
 		_sceneText.remove();
 
-	Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+	Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
 	Action::remove();
 }
 
@@ -342,7 +342,7 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler,
 
 	DEALLOCATE(seqData);
 
-	Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+	Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
 	for (int idx = 0; idx < 6; ++idx) {
 		_objectList[idx] = va_arg(va, SceneObject *);
 		if (!_objectList[idx])
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index d21321a..540c3b6 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -155,7 +155,7 @@ Globals::~Globals() {
 }
 
 void Globals::reset() {
-	Common::set_to(&_flags[0], &_flags[MAX_FLAGS], false);
+	Common::fill(&_flags[0], &_flags[MAX_FLAGS], false);
 	g_saver->addFactory(classFactoryProc);
 }
 
@@ -379,7 +379,7 @@ void Ringworld2Globals::reset() {
 	_v565F5 = 0;
 	_v57C2C = 0;
 	_v58CE2 = 0;
-	Common::set_to(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
+	Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
 	_insetUp = 0;
 
 	// Reset fields stored in the player class
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 40654a3..f0a5973 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -81,7 +81,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
 	if (!rleEncoded) {
 		Common::copy(srcP, srcP + (r.width() * r.height()), destP);
 	} else {
-		Common::set_to(destP, destP + (r.width() * r.height()), s._transColor);
+		Common::fill(destP, destP + (r.width() * r.height()), s._transColor);
 
 		for (int yp = 0; yp < r.height(); ++yp) {
 			int width = r.width();
@@ -105,7 +105,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
 					controlVal &= 0x3f;
 					int pixel = *srcP++;
 
-					Common::set_to(destP, destP + controlVal, pixel);
+					Common::fill(destP, destP + controlVal, pixel);
 					destP += controlVal;
 					width -= controlVal;
 				}
@@ -261,7 +261,7 @@ void GfxSurface::create(int width, int height) {
 	}
 	_customSurface = new Graphics::Surface();
 	_customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-	Common::set_to((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
+	Common::fill((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
 	_bounds = Rect(0, 0, width, height);
 }
 
@@ -455,7 +455,7 @@ static int *scaleLine(int size, int srcSize) {
 	int scale = PRECISION_FACTOR * size / srcSize;
 	assert(scale >= 0);
 	int *v = new int[size];
-	Common::set_to(v, &v[size], -1);
+	Common::fill(v, &v[size], -1);
 
 	int distCtr = PRECISION_FACTOR / 2;
 	int *destP = v;
@@ -493,7 +493,7 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize, int trans
 		byte *destP = (byte *)destImage.getBasePtr(0, yp);
 
 		if (vertUsage[yp] == -1) {
-			Common::set_to(destP, destP + xSize, transIndex);
+			Common::fill(destP, destP + xSize, transIndex);
 		} else {
 			const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]);
 
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 06b482d..dba3401 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -292,7 +292,7 @@ public:
 		Common::copy(src, src + size, dest);
 	}
 	virtual void set(byte *dest, int size, byte val) {
-		Common::set_to(dest, dest + size, val);
+		Common::fill(dest, dest + size, val);
 	}
 	void copyFrom(GfxSurface &src, Rect destBounds, Region *priorityRegion = NULL) {
 		_surface.setBounds(_bounds);
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index b8c8fcd..824f20e 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -33,7 +33,7 @@ namespace TsAGE {
 
 MemoryManager::MemoryManager() {
 	_memoryPool = new MemoryHeader*[MEMORY_POOL_SIZE];
-	Common::set_to(&_memoryPool[0], &_memoryPool[MEMORY_POOL_SIZE], (MemoryHeader *)NULL);
+	Common::fill(&_memoryPool[0], &_memoryPool[MEMORY_POOL_SIZE], (MemoryHeader *)NULL);
 }
 
 MemoryManager::~MemoryManager() {
@@ -67,7 +67,7 @@ uint16 MemoryManager::allocate(uint32 size) {
 byte *MemoryManager::allocate2(uint32 size) {
 	uint32 idx = allocate(size);
 	byte *result = lock(idx);
-	Common::set_to(result, result + size, 0);
+	Common::fill(result, result + size, 0);
 	return result;
 }
 
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 5ed7c06..6362c63 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -259,7 +259,7 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
 	_sceneMode = 0;
 	_activeScreenNumber = 0;
 	_oldSceneBounds = Rect(4000, 4000, 4100, 4100);
-	Common::set_to(&_zoomPercents[0], &_zoomPercents[256], 0);
+	Common::fill(&_zoomPercents[0], &_zoomPercents[256], 0);
 }
 
 Scene::~Scene() {
@@ -363,7 +363,7 @@ void Scene::loadSceneData(int sceneNum) {
 	_priorities.load(sceneNum);
 
 	// Initialize the section enabled list
-	Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
+	Common::fill(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
 
 	g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
 	g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index fb88a5f..9df5a66 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -798,7 +798,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
 			continue;
 
 		_sfUpdateVoiceStructs();
-		Common::set_to(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
+		Common::fill(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
 
 		for (;;) {
 			// Scan for sub priority
@@ -1485,7 +1485,7 @@ Sound::Sound() {
 	memset(_chNumVoices, 0, SOUND_ARR_SIZE * sizeof(int));
 	memset(_chSubPriority, 0, SOUND_ARR_SIZE * sizeof(int));
 	memset(_chFlags, 0, SOUND_ARR_SIZE * sizeof(int));
-	Common::set_to(_chWork, _chWork + SOUND_ARR_SIZE, false);
+	Common::fill(_chWork, _chWork + SOUND_ARR_SIZE, false);
 	memset(_channelData, 0, SOUND_ARR_SIZE * sizeof(byte *));
 	memset(_trkChannel, 0, SOUND_ARR_SIZE * sizeof(int));
 	memset(_trkState, 0, SOUND_ARR_SIZE * sizeof(int));
@@ -2557,7 +2557,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
 
 	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
 
-	Common::set_to(_channelVoiced, _channelVoiced + ADLIB_CHANNEL_COUNT, false);
+	Common::fill(_channelVoiced, _channelVoiced + ADLIB_CHANNEL_COUNT, false);
 	memset(_channelVolume, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
 	memset(_v4405E, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
 	memset(_v44067, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
@@ -2565,7 +2565,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
 	memset(_v44079, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
 	memset(_v44082, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
 	_v44082[ADLIB_CHANNEL_COUNT] = 0x90;
-	Common::set_to(_pitchBlend, _pitchBlend + ADLIB_CHANNEL_COUNT, 0x2000);
+	Common::fill(_pitchBlend, _pitchBlend + ADLIB_CHANNEL_COUNT, 0x2000);
 	memset(_v4409E, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
 	_patchData = NULL;
 }
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 5897d2e..8bc7b5c 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -169,7 +169,7 @@ namespace Graphics {
 /**
  * Fills several pixels in a row with a given color.
  *
- * This is a replacement function for Common::set_to, using an unrolled
+ * This is a replacement function for Common::fill, using an unrolled
  * loop to maximize performance on most architectures.
  * This function may (and should) be overloaded in any child renderers
  * for portable platforms with platform-specific assembly code.
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index e0b25f2..79a7821 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -95,10 +95,10 @@ void Surface::hLine(int x, int y, int x2, uint32 color) {
 		memset(ptr, (byte)color, x2 - x + 1);
 	} else if (format.bytesPerPixel == 2) {
 		uint16 *ptr = (uint16 *)getBasePtr(x, y);
-		Common::set_to(ptr, ptr + (x2 - x + 1), (uint16)color);
+		Common::fill(ptr, ptr + (x2 - x + 1), (uint16)color);
 	} else if (format.bytesPerPixel == 4) {
 		uint32 *ptr = (uint32 *)getBasePtr(x, y);
-		Common::set_to(ptr, ptr + (x2 - x + 1), color);
+		Common::fill(ptr, ptr + (x2 - x + 1), color);
 	} else {
 		error("Surface::hLine: bytesPerPixel must be 1, 2, or 4");
 	}
@@ -172,13 +172,13 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
 		if (format.bytesPerPixel == 2) {
 			uint16 *ptr = (uint16 *)getBasePtr(r.left, r.top);
 			while (height--) {
-				Common::set_to(ptr, ptr + width, (uint16)color);
+				Common::fill(ptr, ptr + width, (uint16)color);
 				ptr += pitch / 2;
 			}
 		} else {
 			uint32 *ptr = (uint32 *)getBasePtr(r.left, r.top);
 			while (height--) {
-				Common::set_to(ptr, ptr + width, color);
+				Common::fill(ptr, ptr + width, color);
 				ptr += pitch / 4;
 			}
 		}


Commit: c2fd35c9ed32820f9bc616c0e9fd23075c845a2e
    https://github.com/scummvm/scummvm/commit/c2fd35c9ed32820f9bc616c0e9fd23075c845a2e
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-11-16T09:16:40-08:00

Commit Message:
COMMON: Make value parameter of fill a const reference.

Changed paths:
    common/algorithm.h



diff --git a/common/algorithm.h b/common/algorithm.h
index d6790af..7a0eed8 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -100,7 +100,7 @@ char *fill(char *first, char *last, Value val) {
  * Sets all elements in the range [first, last) to val.
  */
 template<class In, class Value>
-In fill(In first, In last, Value val) {
+In fill(In first, In last, const Value &val) {
 	while (first != last)
 		*first++ = val;
 	return first;






More information about the Scummvm-git-logs mailing list