JANITORIAL: Remove more trailing spaces

This commit is contained in:
Eugene Sandulenko 2016-10-09 15:02:02 +02:00
parent dead4aa014
commit 355c4fa646
60 changed files with 211 additions and 211 deletions

View file

@ -123,7 +123,7 @@ void OPL::clear() {
} else if (_type == Config::kOpl2) {
for (int i = 0; i < kOpl2Operators; ++i) {
_oper[i].left = 1;
_oper[i].right = 1;
_oper[i].right = 1;
}
}
}
@ -152,7 +152,7 @@ bool OPL::init() {
while (!snd_ctl_hwdep_next_device(ctl, &dev) && dev >= 0) {
name = Common::String::format("hw:%d,%d", card, dev);
if (snd_hwdep_open(&_opl, name.c_str(), SND_HWDEP_OPEN_WRITE) < 0)
if (snd_hwdep_open(&_opl, name.c_str(), SND_HWDEP_OPEN_WRITE) < 0)
continue;
if (!snd_hwdep_info(_opl, info)) {

View file

@ -248,7 +248,7 @@ void RealOPL::onTimer() {
if (_baseFreq > kMaxFreq) {
// We run faster than our max, so run the callback multiple
// times to approximate the actual timer callback frequency.
uint totalTicks = _baseFreq + _remainingTicks;
uint totalTicks = _baseFreq + _remainingTicks;
callbacks = totalTicks / kMaxFreq;
_remainingTicks = totalTicks % kMaxFreq;
}

View file

@ -561,7 +561,7 @@ void MidiDriver_Miles_AdLib::noteOff(byte midiChannel, byte note) {
_virtualFmVoices[virtualFmVoice].sustained = true;
continue;
}
//
//
releaseFmVoice(virtualFmVoice);
}
}
@ -601,7 +601,7 @@ void MidiDriver_Miles_AdLib::prioritySort() {
}
}
//
//
while (virtualFmVoicesCount) {
uint16 unvoicedHighestPriority = 0;
byte unvoicedHighestFmVoice = 0;
@ -688,7 +688,7 @@ void MidiDriver_Miles_AdLib::releaseFmVoice(byte virtualFmVoice) {
// One less voice active on this MIDI channel
assert(_midiChannels[midiChannel].currentActiveVoicesCount);
_midiChannels[midiChannel].currentActiveVoicesCount--;
_midiChannels[midiChannel].currentActiveVoicesCount--;
}
void MidiDriver_Miles_AdLib::releaseSustain(byte midiChannel) {

View file

@ -62,7 +62,7 @@ bool EuphonyPlayer::init() {
}
}
}
if (!_drivers[0] || !_drivers[1])
return false;
@ -323,7 +323,7 @@ bool EuphonyPlayer::parseEvent() {
EVENT(programChange_channelAftertouch),
EVENT(programChange_channelAftertouch),
EVENT(controlChange_pitchWheel),
EVENT(sysex),
EVENT(advanceBar),
EVENT(notImpl),
@ -661,7 +661,7 @@ bool EuphonyDriver::init() {
delete[] _channels;
delete[] _partToChanMapping;
delete[] _sustainChannels;
_channels = new Channel[128];
_partToChanMapping = new int8[16];
_sustainChannels = new int8[16];
@ -674,7 +674,7 @@ void EuphonyDriver::reset() {
_intf->callback(74);
_intf->callback(70, 0);
_intf->callback(75, 3);
_currentEvent.clear();
memset(_sustainChannels, 0, 16);
memset(_partToChanMapping, -1, 16);

View file

@ -120,7 +120,7 @@ public:
int setTempo(int tempo);
void setLoopStatus(bool loop);
bool isPlaying() {return _playing; }
int configPart_enable(int part, int val);
@ -148,10 +148,10 @@ private:
void updateHangingNotes();
void clearHangingNotes();
void resetAllControls();
void allPartsOff();
uint8 appendEvent(uint8 evt, uint8 chan);
typedef bool(EuphonyPlayer::*EuphonyEvent)();
@ -190,7 +190,7 @@ private:
uint16 len;
SavedEvent *next;
};
SavedEvent *_savedEventsChain;
uint8 _defaultBarLength;

View file

@ -58,4 +58,4 @@ AudioCDManager *createMacOSXAudioCDManager();
#endif
#endif //
#endif //

View file

@ -385,4 +385,4 @@ AudioCDManager *createWin32AudioCDManager() {
return new Win32AudioCDManager();
}
#endif // WIN32
#endif // WIN32

View file

@ -84,7 +84,7 @@ bool AndroidSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
int AndroidSdlEventSource::mapKey(SDLKey sdlKey, SDLMod mod, Uint16 unicode) {
Common::KeyCode key = SDLToOSystemKeycode(sdlKey);
if (key >= Common::KEYCODE_F1 && key <= Common::KEYCODE_F9) {
return key - Common::KEYCODE_F1 + Common::ASCII_F1;
} else if (key >= Common::KEYCODE_KP0 && key <= Common::KEYCODE_KP9) {

View file

@ -267,7 +267,7 @@ bool POSIXFilesystemNode::create(bool isDir) {
}
}
if (success) {
if (success) {
setFlags();
if (_isValid) {
if (_isDirectory != isDir) warning("failed to create %s: got %s", isDir ? "directory" : "file", _isDirectory ? "directory" : "file");

View file

@ -168,7 +168,7 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
if (newPath.lastChar() != '/')
newPath += '/';
newPath += pent->d_name;
bool isDir = false;
tmpdir = opendir(newPath.c_str());
if(tmpdir)
@ -176,17 +176,17 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
isDir = true;
closedir(tmpdir);
}
if ((mode == Common::FSNode::kListFilesOnly && isDir) ||
(mode == Common::FSNode::kListDirectoriesOnly && !isDir))
continue;
struct stat st;
st.st_mode = 0;
st.st_mode |= ( isDir ? S_IFDIR : 0 );
st.st_mode |= S_IRUSR;
st.st_mode |= S_IWUSR;
list.push_back(new WiiFilesystemNode(newPath, &st));
}

View file

@ -57,7 +57,7 @@ void loadConfig() {
config.stretchToFit = confGetBool("stretchtofit", false);
config.sensitivity = confGetInt("sensitivity", -5);
config.screen = confGetInt("screen", kScreenBoth);
// Turn off the backlight of any screen not used
if (R_SUCCEEDED(gspLcdInit())) {
if (config.screen == kScreenTop) {
@ -70,7 +70,7 @@ void loadConfig() {
GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH);
gspLcdExit();
}
OSystem_3DS *osys = (OSystem_3DS *)g_system;
osys->updateConfig();
}

View file

@ -26,7 +26,7 @@
#include "common/str.h"
namespace _3DS {
struct Config {
bool showCursor;
bool snapToBorder;

View file

@ -33,7 +33,7 @@ public:
protected:
virtual void close();
uint32 _timer;
static StatusMessageDialog* _opened;
};

View file

@ -41,13 +41,13 @@ int main(int argc, char *argv[]) {
scummvm_main(0, nullptr);
delete dynamic_cast<_3DS::OSystem_3DS*>(g_system);
// Turn on both screen backlights before exiting.
if (R_SUCCEEDED(gspLcdInit())) {
GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH);
gspLcdExit();
}
cfguExit();
gfxExit();
return 0;

View file

@ -33,11 +33,11 @@
#include "common/translation.h"
namespace _3DS {
bool optionMenuOpened = false;
OptionsDialog::OptionsDialog() : GUI::Dialog(20, 20, 280, 200) {
optionMenuOpened = true;
new GUI::ButtonWidget(this, 120, 180, 72, 16, _("~C~lose"), 0, GUI::kCloseCmd);
@ -45,10 +45,10 @@ OptionsDialog::OptionsDialog() : GUI::Dialog(20, 20, 280, 200) {
_showCursorCheckbox = new GUI::CheckboxWidget(this, 5, 5, 130, 20, _("Show mouse cursor"), 0, 0, 'T');
_showCursorCheckbox->setState(config.showCursor);
_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 5, 22, 130, 20, _("Snap to edges"), 0, 0, 'T');
_snapToBorderCheckbox->setState(config.snapToBorder);
_stretchToFitCheckbox = new GUI::CheckboxWidget(this, 140, 5, 130, 20, _("Stretch to fit"), 0, 0, 'T');
_stretchToFitCheckbox->setState(config.stretchToFit);

View file

@ -33,7 +33,7 @@
#include "scumm/dialogs.h"
namespace _3DS {
enum {
kSave = 0x10000000,
kScreenRadioGroup,
@ -41,7 +41,7 @@ enum {
kScreenBottom,
kScreenBoth,
};
extern bool optionMenuOpened;
class OptionsDialog : public GUI::Dialog {

View file

@ -41,31 +41,31 @@ static void audioThreadFunc(void *arg) {
uint32 lastTime = osys->getMillis(true);
uint32 time = lastTime;
ndspWaveBuf buffers[bufferCount];
for (i = 0; i < bufferCount; ++i) {
memset(&buffers[i], 0, sizeof(ndspWaveBuf));
buffers[i].data_vaddr = linearAlloc(bufferSize);
buffers[i].looping = false;
buffers[i].status = NDSP_WBUF_FREE;
}
ndspChnReset(channel);
ndspChnSetInterp(channel, NDSP_INTERP_LINEAR);
ndspChnSetRate(channel, sampleRate);
ndspChnSetFormat(channel, NDSP_FORMAT_STEREO_PCM16);
while (!osys->exiting) {
while (!osys->exiting) {
osys->delayMillis(100); // Note: Increasing the delay requires a bigger buffer
time = osys->getMillis(true);
sampleLen = (time - lastTime) * 22 * 4; // sampleRate / 1000 * channelCount * sizeof(int16);
lastTime = time;
if (!osys->sleeping && sampleLen > 0) {
bufferIndex++;
bufferIndex %= bufferCount;
ndspWaveBuf *buf = &buffers[bufferIndex];
buf->nsamples = mixer->mixCallback(buf->data_adpcm, sampleLen);
if (buf->nsamples > 0) {
DSP_FlushDataCache(buf->data_vaddr, bufferSize);
@ -73,14 +73,14 @@ static void audioThreadFunc(void *arg) {
}
}
}
for (i = 0; i < bufferCount; ++i)
linearFree(buffers[i].data_pcm8);
}
void OSystem_3DS::initAudio() {
_mixer = new Audio::MixerImpl(this, 22050);
hasAudio = R_SUCCEEDED(ndspInit());
_mixer->setReady(false);
@ -97,7 +97,7 @@ void OSystem_3DS::destroyAudio() {
threadFree(audioThread);
ndspExit();
}
delete _mixer;
_mixer = 0;
}

View file

@ -44,7 +44,7 @@ static void pushEventQueue(Common::Queue<Common::Event> *queue, Common::Event &e
static void eventThreadFunc(void *arg) {
OSystem_3DS *osys = (OSystem_3DS *)g_system;
auto eventQueue = (Common::Queue<Common::Event> *)arg;
uint32 touchStartTime = osys->getMillis();
touchPosition lastTouch = {0, 0};
bool isRightClick = false;
@ -55,19 +55,19 @@ static void eventThreadFunc(void *arg) {
int circleDeadzone = 20;
int borderSnapZone = 6;
Common::Event event;
while (!osys->exiting) {
do {
osys->delayMillis(10);
} while (osys->sleeping && !osys->exiting);
hidScanInput();
touchPosition touch;
circlePosition circle;
u32 held = hidKeysHeld();
u32 keysPressed = hidKeysDown();
u32 keysReleased = hidKeysUp();
// C-Pad used to control the cursor
hidCircleRead(&circle);
if (circle.dx < circleDeadzone && circle.dx > -circleDeadzone)
@ -76,7 +76,7 @@ static void eventThreadFunc(void *arg) {
circle.dy = 0;
cursorDeltaX = (0.0002f + config.sensitivity / 100000.f) * circle.dx * abs(circle.dx);
cursorDeltaY = (0.0002f + config.sensitivity / 100000.f) * circle.dy * abs(circle.dy);
// Touch screen events
if (held & KEY_TOUCH) {
hidTouchRead(&touch);
@ -97,7 +97,7 @@ static void eventThreadFunc(void *arg) {
osys->warpMouse(touch.px, touch.py);
event.mouse.x = touch.px;
event.mouse.y = touch.py;
if (keysPressed & KEY_TOUCH) {
touchStartTime = osys->getMillis();
isRightClick = (held & KEY_X || held & KEY_DUP);
@ -109,7 +109,7 @@ static void eventThreadFunc(void *arg) {
event.type = Common::EVENT_MOUSEMOVE;
pushEventQueue(eventQueue, event);
}
lastTouch = touch;
} else if (keysReleased & KEY_TOUCH) {
event.mouse.x = lastTouch.px;
@ -136,13 +136,13 @@ static void eventThreadFunc(void *arg) {
lastTouch.px = cursorX;
lastTouch.py = cursorY;
osys->transformPoint(lastTouch);
osys->warpMouse(lastTouch.px, lastTouch.py);
osys->warpMouse(lastTouch.px, lastTouch.py);
event.mouse.x = lastTouch.px;
event.mouse.y = lastTouch.py;
event.type = Common::EVENT_MOUSEMOVE;
pushEventQueue(eventQueue, event);
}
// Button events
if (keysPressed & KEY_R) {
if (inputMode == MODE_DRAG) {
@ -195,7 +195,7 @@ static void eventThreadFunc(void *arg) {
event.kbd.flags = 0;
pushEventQueue(eventQueue, event);
}
// TODO: EVENT_PREDICTIVE_DIALOG
// EVENT_SCREEN_CHANGED
}
@ -203,7 +203,7 @@ static void eventThreadFunc(void *arg) {
static void aptHookFunc(APT_HookType hookType, void *param) {
OSystem_3DS *osys = (OSystem_3DS *)g_system;
switch (hookType) {
case APTHOOK_ONSUSPEND:
case APTHOOK_ONSLEEP:
@ -246,7 +246,7 @@ void OSystem_3DS::initEvents() {
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
_timerThread = threadCreate(&timerThreadFunc, this, 32 * 1024, prio - 1, -2, false);
_eventThread = threadCreate(&eventThreadFunc, &_eventQueue, 32 * 1024, prio - 1, -2, false);
aptHook(&cookie, aptHookFunc, this);
}
@ -277,7 +277,7 @@ bool OSystem_3DS::pollEvent(Common::Event &event) {
StatusMessageDialog dialog(messageOSD, 800);
dialog.runModal();
}
aptMainLoop(); // Call apt hook when necessary
if (optionMenuOpening) {
@ -289,12 +289,12 @@ bool OSystem_3DS::pollEvent(Common::Event &event) {
if (g_engine)
g_engine->pauseEngine(false);
}
Common::StackLock lock(*eventMutex);
if (_eventQueue.empty())
return false;
event = _eventQueue.pop();
return true;
}

View file

@ -35,7 +35,7 @@
GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
namespace _3DS {
void OSystem_3DS::initGraphics() {
_pfGame = Graphics::PixelFormat::createFormatCLUT8();
_pfGameTexture = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
@ -60,23 +60,23 @@ void OSystem_3DS::initGraphics() {
shaderProgramInit(&_program);
shaderProgramSetVsh(&_program, &_dvlb->DVLE[0]);
C3D_BindProgram(&_program);
_projectionLocation = shaderInstanceGetUniformLocation(_program.vertexShader, "projection");
_modelviewLocation = shaderInstanceGetUniformLocation(_program.vertexShader, "modelView");
C3D_AttrInfo *attrInfo = C3D_GetAttrInfo();
AttrInfo_Init(attrInfo);
AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 2); // v1=texcoord
Mtx_OrthoTilt(&_projectionTop, 0.0, 400.0, 240.0, 0.0, 0.0, 1.0);
Mtx_OrthoTilt(&_projectionBottom, 0.0, 320.0, 240.0, 0.0, 0.0, 1.0);
C3D_TexEnv *env = C3D_GetTexEnv(0);
C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, 0, 0);
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
C3D_DepthTest(false, GPU_GEQUAL, GPU_WRITE_ALL);
C3D_CullFace(GPU_CULL_NONE);
}
@ -148,14 +148,14 @@ void OSystem_3DS::initSize(uint width, uint height,
_gameHeight = height;
_gameTopTexture.create(width, height, _pfGameTexture);
_overlay.create(getOverlayWidth(), getOverlayHeight(), _pfGameTexture);
if (format) {
debug("pixelformat: %d %d %d %d %d", format->bytesPerPixel, format->rBits(), format->gBits(), format->bBits(), format->aBits());;
_pfGame = *format;
}
_gameScreen.create(width, height, _pfGame);
_focusDirty = true;
_focusRect = Common::Rect(_gameWidth, _gameHeight);
@ -169,7 +169,7 @@ void OSystem_3DS::updateSize() {
_gameBottomTexture.setScale(320.f / _gameWidth, 240.f / _gameHeight);
} else {
float ratio = static_cast<float>(_gameWidth) / _gameHeight;
if (ratio > 400.f / 240.f) {
float r = 400.f / _gameWidth;
_gameTopTexture.setScale(r, r);
@ -224,7 +224,7 @@ OSystem::TransactionError OSystem_3DS::endGFXTransaction() {
void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
assert(start + num <= 256);
memcpy(_palette + 3 * start, colors, 3 * num);
// Manually update all color that were changed
if (_gameScreen.format.bytesPerPixel == 1) {
flushGameScreen();
@ -240,10 +240,10 @@ void OSystem_3DS::copyRectToScreen(const void *buf, int pitch, int x,
Common::Rect rect(x, y, x+w, y+h);
_gameScreen.copyRectToSurface(buf, pitch, x, y, w, h);
Graphics::Surface subSurface = _gameScreen.getSubArea(rect);
Graphics::Surface *convertedSubSurface = subSurface.convertTo(_pfGameTexture, _palette);
_gameTopTexture.copyRectToSurface(*convertedSubSurface, x, y, Common::Rect(w, h));
convertedSubSurface->free();
delete convertedSubSurface;
_gameTopTexture.markDirty();
@ -268,7 +268,7 @@ void OSystem_3DS::updateScreen() {
if (sleeping || exiting)
return;
// updateFocus();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
@ -288,7 +288,7 @@ void OSystem_3DS::updateScreen() {
_cursorTexture.render();
}
}
// Render bottom screen
C3D_FrameDrawOn(_renderTargetBottom);
if (config.screen == kScreenBottom || config.screen == kScreenBoth) {
@ -327,7 +327,7 @@ void OSystem_3DS::clearFocusRectangle() {
}
void OSystem_3DS::updateFocus() {
if (_focusClearTime && getMillis() - _focusClearTime > 5000) {
_focusClearTime = 0;
_focusDirty = true;
@ -361,26 +361,26 @@ void OSystem_3DS::updateFocus() {
_focusStepScaleX = duration * (_focusTargetScaleX - _focusScaleX);
_focusStepScaleY = duration * (_focusTargetScaleY - _focusScaleY);
}
if (_focusDirty || _focusPosX != _focusTargetPosX || _focusPosY != _focusTargetPosY ||
_focusScaleX != _focusTargetScaleX || _focusScaleY != _focusTargetScaleY) {
_focusDirty = false;
if ((_focusStepPosX > 0 && _focusPosX > _focusTargetPosX) || (_focusStepPosX < 0 && _focusPosX < _focusTargetPosX))
_focusPosX = _focusTargetPosX;
else if (_focusPosX != _focusTargetPosX)
_focusPosX += _focusStepPosX;
if ((_focusStepPosY > 0 && _focusPosY > _focusTargetPosY) || (_focusStepPosY < 0 && _focusPosY < _focusTargetPosY))
_focusPosY = _focusTargetPosY;
else if (_focusPosY != _focusTargetPosY)
_focusPosY += _focusStepPosY;
if ((_focusStepScaleX > 0 && _focusScaleX > _focusTargetScaleX) || (_focusStepScaleX < 0 && _focusScaleX < _focusTargetScaleX))
_focusScaleX = _focusTargetScaleX;
else if (_focusScaleX != _focusTargetScaleX)
_focusScaleX += _focusStepScaleX;
if ((_focusStepScaleY > 0 && _focusScaleY > _focusTargetScaleY) || (_focusStepScaleY < 0 && _focusScaleY < _focusTargetScaleY))
_focusScaleY = _focusTargetScaleY;
else if (_focusScaleY != _focusTargetScaleY)
@ -476,10 +476,10 @@ void OSystem_3DS::setMouseCursor(const void *buf, uint w, uint h,
_cursor.create(w, h, _pfCursor);
_cursorTexture.create(w, h, _pfGameTexture);
}
_cursor.copyRectToSurface(buf, w, 0, 0, w, h);
flushCursor();
warpMouse(_cursorX, _cursorY);
}
@ -497,7 +497,7 @@ void OSystem_3DS::flushCursor() {
_cursorTexture.markDirty();
converted->free();
delete converted;
if (_pfCursor.bytesPerPixel == 1) {
uint* dest = (uint*) _cursorTexture.getPixels();
byte* src = (byte*) _cursor.getPixels();

View file

@ -85,7 +85,7 @@ OSystem_3DS::~OSystem_3DS() {
destroyEvents();
destroyAudio();
destroyGraphics();
delete _timerManager;
_timerManager = 0;
}
@ -109,7 +109,7 @@ void OSystem_3DS::initBackend() {
_timerManager = new DefaultTimerManager();
_savefileManager = new DefaultSaveFileManager("/3ds/scummvm/saves/");
initGraphics();
initAudio();
initEvents();

View file

@ -57,12 +57,12 @@ class OSystem_3DS : public EventsBaseBackend, public PaletteManager {
public:
OSystem_3DS();
virtual ~OSystem_3DS();
volatile bool exiting;
volatile bool sleeping;
virtual void initBackend();
virtual bool hasFeature(OSystem::Feature f);
virtual void setFeatureState(OSystem::Feature f, bool enable);
virtual bool getFeatureState(OSystem::Feature f);
@ -72,22 +72,22 @@ public:
virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const;
virtual MutexRef createMutex();
virtual void lockMutex(MutexRef mutex);
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
virtual void logMessage(LogMessageType::Type type, const char *message);
virtual Audio::Mixer *getMixer();
virtual PaletteManager *getPaletteManager() { return this; }
virtual Common::String getSystemLanguage() const;
virtual void fatalError();
virtual void quit();
virtual Common::String getDefaultConfigFileName();
// Graphics
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
int getDefaultGraphicsMode() const;
@ -131,16 +131,16 @@ public:
int hotspotY, uint32 keycolor, bool dontScale = false,
const Graphics::PixelFormat *format = NULL);
void setCursorPalette(const byte *colors, uint start, uint num);
// Transform point from touchscreen coords into gamescreen coords
void transformPoint(touchPosition &point);
void setCursorDelta(float deltaX, float deltaY);
void updateFocus();
void updateConfig();
void updateSize();
private:
void initGraphics();
void destroyGraphics();
@ -148,18 +148,18 @@ private:
void destroyAudio();
void initEvents();
void destroyEvents();
void flushGameScreen();
void flushCursor();
protected:
Audio::MixerImpl *_mixer;
private:
u16 _gameWidth, _gameHeight;
u16 _gameTopX, _gameTopY;
u16 _gameBottomX, _gameBottomY;
// Audio
Thread audioThread;
@ -169,15 +169,15 @@ private:
Graphics::PixelFormat _pfCursor;
byte _palette[3 * 256];
byte _cursorPalette[3 * 256];
Graphics::Surface _gameScreen;
Sprite _gameTopTexture;
Sprite _gameBottomTexture;
Sprite _overlay;
int _screenShakeOffset;
bool _overlayVisible;
DVLB_s *_dvlb;
shaderProgram_s _program;
int _projectionLocation;
@ -186,7 +186,7 @@ private:
C3D_Mtx _projectionBottom;
C3D_RenderTarget* _renderTargetTop;
C3D_RenderTarget* _renderTargetBottom;
// Focus
Common::Rect _focusRect;
bool _focusDirty;
@ -198,12 +198,12 @@ private:
float _focusTargetScaleX, _focusTargetScaleY;
float _focusStepScaleX, _focusStepScaleY;
uint32 _focusClearTime;
// Events
Thread _eventThread;
Thread _timerThread;
Common::Queue<Common::Event> _eventQueue;
// Cursor
Graphics::Surface _cursor;
Sprite _cursorTexture;

View file

@ -57,7 +57,7 @@ Sprite::~Sprite() {
void Sprite::create(uint16 width, uint16 height, const Graphics::PixelFormat &f) {
free();
actualWidth = width;
actualHeight = height;
format = f;
@ -73,7 +73,7 @@ void Sprite::create(uint16 width, uint16 height, const Graphics::PixelFormat &f)
assert(pixels && texture.data);
clear();
}
float x = 0.f, y = 0.f;
float u = (float)width/w;
float v = (float)height/h;

View file

@ -46,16 +46,16 @@ public:
void render();
void clear(uint32 color = 0);
void markDirty(){ dirtyPixels = true; }
void setPosition(int x, int y);
void setScale(float x, float y);
float getScaleX(){ return scaleX; }
float getScaleY(){ return scaleY; }
C3D_Mtx* getMatrix();
uint16 actualWidth;
uint16 actualHeight;
private:
bool dirtyPixels;
bool dirtyMatrix;

View file

@ -28,7 +28,7 @@
void OSystem_ANDROIDSDL::initBackend() {
// Create the backend custom managers
if (_eventSource == 0)
_eventSource = new AndroidSdlEventSource();
@ -37,10 +37,10 @@ void OSystem_ANDROIDSDL::initBackend() {
if (!ConfMan.hasKey("browser_lastpath"))
ConfMan.set("browser_lastpath", "/storage");
if (!ConfMan.hasKey("gfx_mode"))
ConfMan.set("gfx_mode", "2x");
// Call parent implementation of this method
OSystem_POSIX::initBackend();
}

View file

@ -29,7 +29,7 @@ class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
virtual void updateSavefilesList(Common::StringArray &lockedFiles);
virtual Common::InSaveFile *openRawFile(const Common::String &filename);
virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true);
virtual Common::InSaveFile *openForLoading(const Common::String &filename);

View file

@ -91,16 +91,16 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
if (!handleEvent_secondMouseUp(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputKeyPressed:
handleEvent_keyPressed(event, internalEvent.value1);
break;
case kInputSwipe:
if (!handleEvent_swipe(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputTap:
if (!handleEvent_tap(event, (UIViewTapDescription) internalEvent.value1, internalEvent.value2))
return false;
@ -109,7 +109,7 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
default:
break;
}
return true;
}
return false;
@ -499,14 +499,14 @@ bool OSystem_iOS7::handleEvent_swipe(Common::Event &event, int direction, int to
}
break;
}
event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode;
event.kbd.ascii = _queuedInputEvent.kbd.ascii = 0;
event.type = Common::EVENT_KEYDOWN;
_queuedInputEvent.type = Common::EVENT_KEYUP;
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
_queuedEventTime = getMillis() + kQueuedInputEventDelay;
return true;
}
else if (touches == 2) {

View file

@ -931,7 +931,7 @@ uint getSizeNextPOT(uint size) {
CGPoint point = [touch locationInView:self];
if (![self getMouseCoords:point eventX:&x eventY:&y])
return;
[self addEvent:InternalEvent(kInputMouseSecondDragged, x, y)];
}
}

View file

@ -151,7 +151,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxT
irxFiles = irxType[type];
numFiles = numIrx[type];
resModules = (IrxReference *)memalign(64, numFiles * sizeof(IrxReference));
curModule = resModules;
curModule = resModules;
for (int i = 0; i < numFiles; i++) {
curModule->fileRef = irxFiles + i;

View file

@ -628,7 +628,7 @@ bool OSystem_PS2::usbMassPresent(void) {
}
bool OSystem_PS2::netPresent(void) {
if (_useNet)
if (_useNet)
return true;
return false;

View file

@ -56,7 +56,7 @@ void OSystem_MacOSX::init() {
// Initialize taskbar manager
_taskbarManager = new MacOSXTaskbarManager();
#endif
// Invoke parent implementation of this method
OSystem_POSIX::init();
}

View file

@ -35,7 +35,7 @@ public:
virtual bool hasTextInClipboard();
virtual Common::String getTextFromClipboard();
virtual bool openUrl(const Common::String &url);
virtual Common::String getSystemLanguage() const;

View file

@ -65,7 +65,7 @@ protected:
virtual Common::WriteStream *createLogFile();
virtual AudioCDManager *createAudioCDManager();
bool launchBrowser(const Common::String& client, const Common::String &url);
};

View file

@ -318,16 +318,16 @@ void TizenAppForm::invokeShortcut() {
case kControlMouse:
setButtonShortcut();
break;
case kEscapeKey:
pushKey(Common::KEYCODE_ESCAPE);
break;
case kGameMenu:
_buttonState = kLeftButton;
pushKey(Common::KEYCODE_F5);
break;
case kShowKeypad:
showKeypad();
break;
@ -338,7 +338,7 @@ void TizenAppForm::showKeypad() {
// display the soft keyboard
if (_state == kActiveState) {
_buttonState = kLeftButton;
Common::Event e;
e.type = Common::EVENT_VIRTUAL_KEYBOARD;
if (_eventQueueLock) {

View file

@ -103,7 +103,7 @@ Common::List<Graphics::PixelFormat> TizenGraphicsManager::getSupportedFormats()
}
bool TizenGraphicsManager::hasFeature(OSystem::Feature f) {
bool result =
bool result =
(f == OSystem::kFeatureVirtualKeyboard ||
OpenGLGraphicsManager::hasFeature(f));
return result;

View file

@ -181,7 +181,7 @@ bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
assureCached(getSavePath());
if (getError().getCode() != Common::kNoError)
return false;
#ifdef USE_LIBCURL
// Update file's timestamp
Common::HashMap<Common::String, uint32> timestamps = loadTimestamps();

View file

@ -72,7 +72,7 @@
NSString *gameId = [recentGame valueForKey:@"game"];
NSString *desc = [recentGame valueForKey:@"description"];
NSString *iconFile = [recentGame valueForKey:@"icon"];
StartGameMenuItem *menuItem = [[StartGameMenuItem alloc] initWithGame:gameId description:desc icon:iconFile];
[recentGamesMenu addItem:menuItem];
[menuItem release];
@ -88,7 +88,7 @@
- (NSMenuItem*)initWithGame:(NSString *)gameId description:(NSString*)desc icon:(NSString*)iconFile {
self = [super initWithTitle:(desc == nil ? gameId : desc) action:@selector(startGame) keyEquivalent:@""];
[self setTarget:self];
if (iconFile != nil) {
NSImage *image = [[NSImage alloc] initWithContentsOfFile:iconFile];
[self setImage:image];
@ -97,7 +97,7 @@
game = gameId;
[game retain];
return self;
}
@ -108,7 +108,7 @@
- (IBAction) startGame {
NSLog(@"Starting Game %@...", game);
NSString *scummVMPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"org.scummvm.scummvm"];
if (scummVMPath == nil) {
NSLog(@"Cannot find ScummVM.app!");

View file

@ -40,16 +40,16 @@ public:
virtual void addRecent(const Common::String &name, const Common::String &description);
virtual void notifyError();
virtual void clearError();
private:
Common::String getIconPath(const Common::String&);
void initApplicationIconView();
void clearApplicationIconView();
void initOverlayIconView();
void clearOverlayIconView();
double _progress;
};

View file

@ -112,11 +112,11 @@ void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Comm
[_dockTile performSelector:@selector(display)];
return;
}
Common::String path = getIconPath(name);
if (path.empty())
return;
initOverlayIconView();
CFStringRef imageFile = CFStringCreateWithCString(0, path.c_str(), kCFStringEncodingASCII);
@ -136,7 +136,7 @@ void MacOSXTaskbarManager::setProgressValue(int completed, int total) {
_progress = (double)completed / (double)total;
else if (_progress < 0)
_progress = 0.0;
NSImage *mainIcon = [[NSApp applicationIconImage] copy];
double barSize = [mainIcon size].width;
double progressSize = barSize * _progress;
@ -150,7 +150,7 @@ void MacOSXTaskbarManager::setProgressValue(int completed, int total) {
initApplicationIconView();
[_applicationIconView setImage:mainIcon];
[mainIcon release];
[_dockTile performSelector:@selector(display)];
}
@ -207,50 +207,50 @@ Common::String MacOSXTaskbarManager::getIconPath(const Common::String& target) {
// fallback to the extra path
//
// Icons can be either in a subfolder named "icons" or directly in the path
Common::String iconsPath = ConfMan.get("iconspath");
Common::String extraPath = ConfMan.get("extrapath");
#define TRY_ICON_PATH(path) { \
Common::FSNode node((path)); \
if (node.exists()) \
return (path); \
}
if (!iconsPath.empty()) {
TRY_ICON_PATH(iconsPath + "/" + target + ".png");
TRY_ICON_PATH(iconsPath + "/" + ConfMan.get("gameid") + ".png");
TRY_ICON_PATH(iconsPath + "/icons/" + target + ".png");
TRY_ICON_PATH(iconsPath + "/icons/" + ConfMan.get("gameid") + ".png");
}
if (!extraPath.empty()) {
TRY_ICON_PATH(extraPath + "/" + target + ".png");
TRY_ICON_PATH(extraPath + "/" + ConfMan.get("gameid") + ".png");
TRY_ICON_PATH(extraPath + "/icons/" + target + ".png");
TRY_ICON_PATH(extraPath + "/icons/" + ConfMan.get("gameid") + ".png");
}
return "";
}
void MacOSXTaskbarManager::addRecent(const Common::String &name, const Common::String &description) {
//warning("[MacOSXTaskbarManager::addRecent] Adding recent list entry: %s (%s)", name.c_str(), description.c_str());
if (_dockTile == nil)
return;
// Store the game, description and icon in user preferences.
// The NSDockTilePlugin will retrieve them there to list them in the dock tile menu.
CFStringRef gameName = CFStringCreateWithCString(0, name.c_str(), kCFStringEncodingASCII);
CFStringRef desc = CFStringCreateWithCString(0, description.c_str(), kCFStringEncodingASCII);
// First build the dictionary for this game.
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:(NSString *)gameName forKey:@"game"];
[dict setObject:(NSString *)desc forKey:@"description"];
// Icon
Common::String iconPath = getIconPath(name);
if (!iconPath.empty()) {
@ -258,7 +258,7 @@ void MacOSXTaskbarManager::addRecent(const Common::String &name, const Common::S
[dict setObject:(NSString *)icon forKey:@"icon"];
CFRelease(icon);
}
// Retrieve the current list of recent items and update it.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *oldArray = [defaults arrayForKey:@"recentGames"];

View file

@ -55,7 +55,7 @@ Win32UpdateManager::Win32UpdateManager() {
win_sparkle_set_appcast_url(appcastUrl);
win_sparkle_init();
if (!ConfMan.hasKey("updates_check")
|| ConfMan.getInt("updates_check") == Common::UpdateManager::kUpdateIntervalNotSupported) {
setAutomaticallyChecksForUpdates(kUpdateStateDisabled);
@ -117,7 +117,7 @@ int Win32UpdateManager::getUpdateCheckInterval() {
bool Win32UpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
time_t updateTime = win_sparkle_get_last_check_time();
tm *ut = localtime(&updateTime);
t.tm_wday = ut->tm_wday;
t.tm_year = ut->tm_year;
t.tm_mon = ut->tm_mon;

View file

@ -482,7 +482,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
dlg.runModal();
}
#endif
#ifdef USE_LIBCURL
CloudMan.init();
CloudMan.syncSaves();

View file

@ -274,7 +274,7 @@ T gcd(T a, T b) {
* Replacement algorithm for iterables.
*
* Replaces all occurrences of "original" in [begin, end) with occurrences of "replaced".
*
*
* @param[in, out] begin: First element to be examined.
* @param[in] end: Last element in the seubsection. Not examined.
* @param[in] original: Elements to be replaced.

View file

@ -180,7 +180,7 @@ bool isPrint(int c);
/**
* Test whether the given character is a punctuation character,
* Test whether the given character is a punctuation character,
* (i.e not alphanumeric.
*
* @param c the character to test

View file

@ -132,7 +132,7 @@ static void writeStringList(PAKFile &out, const char *filename, const StringList
// Step 2: Write data
byte *const output = new byte[size];
byte *dst = output;
WRITE_BE_UINT32(dst, provider->numEntries); dst += 4;
for (uint i = 0; i < provider->numEntries; ++i) {

View file

@ -113,7 +113,7 @@ void openOutputFile(const char *outFilename) {
}
/**
* Write out the data for the font
* Write out the data for the font
*/
void writeFontBlock() {
const int knownAddr[3] = {0x30cd, 0x36b0, 0x36c0};
@ -149,7 +149,7 @@ void writeFontBlock() {
}
void writeStaticStrings(const char **strings, DataType dataType, int languageId) {
// Write out a section header
// Write out a section header
const char sStaticStrings[4] = { 'S', 'S', 'T', 'R' };
const char sGameStrings[4] = { 'G', 'S', 'T', 'R' };

View file

@ -43,7 +43,7 @@ const char *engineDataEn[] = {
"% of hints...",
"Do you want to wake up?",
"OK",
"",
"",
" Save",
" Load",
@ -96,7 +96,7 @@ const char *engineDataFr[] = {
"% des indices...",
"D\202sirez-vous vous r\202veiller?",
"OK",
"",
"",
" Sauvegarde",
" Chargement",
@ -150,7 +150,7 @@ const char *engineDataDe[] = {
"% der Hinweise| bemerken muessen...",
"Moechten Sie aufwachen?",
"OK",
"",
"",
" schreiben",
" lesen",

View file

@ -527,7 +527,7 @@ static const char *const STRINGS_DE[] = {
"Sie befinden sich bereits an Ihrem gew\xFCnschten Reiseziel.",
"Passagieren Ihrer Klasse ist der Zugang zu diesem Bereich nicht gestattet.",
"Wir bedauern, aber Sie m\xFCssen mindestens Dritte Klasse sein "
"bevor Sie um Hilfe bitten k\xF6nnen.",
"bevor Sie um Hilfe bitten k\xF6nnen.",
"Ihnen wurde keine Kabine zugeteilt.",
"Wir bedauern, aber dieser Aufzug geht nicht tiefer als bis in den 27. Stock.",
"Sie m\xFCssen zuerst das Spiel selektieren, das Sie laden m\xF6" "chten.",
@ -560,7 +560,7 @@ static const char *const STRINGS_DE[] = {
"aber das k\xF6nnen Sie eben nicht.",
"Eine Schale Pistazien.",
"Keine Schale Pistazien.",
"Sommer",
"Herbst",
"Winter",
@ -572,7 +572,7 @@ static const char *const STRINGS_DE[] = {
"Pflanzen bitte nicht ber\0xFC" "nhren.",
"!\0xBC" "ta'\0xAD" "ta! !T\0xAA" "z n\0xAA" " sappibundli t\0xAA"
"cn\0xAA" "z!",
"Stop",
"!Hanaz!",
"VorwSrts",

View file

@ -88,7 +88,7 @@ public:
/** Return a stream to the specified resource (or 0 if non-existent). */
File *getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang);
/** Returns true if the resources is empty */
bool empty() const { return _sections.empty(); }
private:

View file

@ -850,7 +850,7 @@ blitSubSurfaceClip(const Graphics::Surface *source, const Common::Rect &r, const
}
template<typename PixelType>
void VectorRendererSpec<PixelType>::
void VectorRendererSpec<PixelType>::
blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) {
int16 x = r.left;
int16 y = r.top;
@ -3125,7 +3125,7 @@ drawBorderRoundedSquareAlgClip(int x1, int y1, int r, int w, int h, PixelType co
PixelType color1 = color;
PixelType color2 = color;
while (sw++ < Base::_strokeWidth) {
blendFillClip(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color1, alpha_t,
x1 + r, y1 + sp/pitch); // top
@ -3297,7 +3297,7 @@ drawInteriorRoundedSquareAlgClip(int x1, int y1, int r, int w, int h, PixelType
x1 + r - x, y1 + h - r + y);
gradientFillClip(ptr_bl - y + px, w - 2 * r + 2 * y, x1 + r - y - x, long_h - r + x,
x1 + r - y, y1 + h - r + x);
BE_DRAWCIRCLE_XCOLOR_CLIP(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py,
x1 + w - r, y1 + r, x1 + r, y1 + r, x1 + r, y1 + h - r, x1 + w - r, y1 + h - r);
}

View file

@ -28,7 +28,7 @@ namespace Graphics {
const int SCALE_THRESHOLD = 0x100;
ManagedSurface::ManagedSurface() :
ManagedSurface::ManagedSurface() :
w(_innerSurface.w), h(_innerSurface.h), pitch(_innerSurface.pitch), format(_innerSurface.format),
_disposeAfterUse(DisposeAfterUse::NO), _owner(nullptr) {
}
@ -104,7 +104,7 @@ void ManagedSurface::create(uint16 width, uint16 height, const PixelFormat &pixe
void ManagedSurface::create(ManagedSurface &surf, const Common::Rect &bounds) {
free();
_offsetFromOwner = Common::Point(bounds.left, bounds.top);
_innerSurface.setPixels(surf.getBasePtr(bounds.left, bounds.top));
_innerSurface.pitch = surf.pitch;
@ -164,7 +164,7 @@ void ManagedSurface::blitFrom(const Surface &src, const Common::Point &destPos)
void ManagedSurface::blitFrom(const Surface &src, const Common::Rect &srcRect,
const Common::Point &destPos) {
Common::Rect srcBounds = srcRect;
Common::Rect destBounds(destPos.x, destPos.y, destPos.x + srcRect.width(),
Common::Rect destBounds(destPos.x, destPos.y, destPos.x + srcRect.width(),
destPos.y + srcRect.height());
assert(src.format.bytesPerPixel == format.bytesPerPixel);

View file

@ -95,12 +95,12 @@ public:
* Create the managed surface
*/
ManagedSurface(int width, int height);
/**
* Create the managed surface
*/
ManagedSurface(int width, int height, const Graphics::PixelFormat &pixelFormat);
/**
* Create the managed surface
*/
@ -211,7 +211,7 @@ public:
const Common::Rect getBounds() const {
return Common::Rect(0, 0, this->w, this->h);
}
/**
* Copies another surface into this one
*/

View file

@ -36,7 +36,7 @@ namespace Graphics {
/**
* Implements a specialised surface that represents the screen.
* It keeps track of any areas of itself that are updated by drawing
* calls, and provides an update that method that blits the affected
* calls, and provides an update that method that blits the affected
* areas to the physical screen
*/
class Screen : public ManagedSurface {
@ -72,7 +72,7 @@ public:
bool isDirty() const { return !_dirtyRects.empty(); }
/**
* Marks the whole screen as dirty. This forces the next call to update
* Marks the whole screen as dirty. This forces the next call to update
* to copy the entire screen contents
*/
void makeAllDirty();

View file

@ -346,7 +346,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
TransparentSurface srcImage(*this, false);
// TODO: Is the data really in the screen format?
if (format.bytesPerPixel != 4) {
warning("TransparentSurface can only blit 32bpp images, but got %d", format.bytesPerPixel * 8);
warning("TransparentSurface can only blit 32bpp images, but got %d", format.bytesPerPixel * 8);
return retSize;
}

View file

@ -52,7 +52,7 @@
- (id) init {
self = [super init];
_panel = 0;
return self;
}

View file

@ -69,7 +69,7 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId):
_openUrlWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.OpenUrlButton", _("Open URL"), 0, kOpenUrlCmd);
_pasteCodeWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.PasteCodeButton", _("Paste"), _("Pastes clipboard contents into fields"), kPasteCodeCmd);
_connectWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.ConnectButton", _("Connect"), 0, kConnectCmd);
// Initialy the code is empty, so disable the connect button
_connectWidget->setEnabled(false);
@ -78,7 +78,7 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId):
_returnLine1->setLabel(_("You will be directed to ScummVM's page where"));
_returnLine2->setLabel(_("you should allow it to access your storage."));
}
_picture = new GraphicsWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.Picture");
#ifndef DISABLE_FANCY_THEMES
if (g_gui.theme()->supportsImages()) {

View file

@ -24,8 +24,8 @@
#include "graphics/surface.h"
#include "image/codecs/codec.h"
/* Common structures, macros, and base class shared by both Indeo4 and
* Indeo5 decoders, derived from ffmpeg. We don't currently support Indeo5
/* Common structures, macros, and base class shared by both Indeo4 and
* Indeo5 decoders, derived from ffmpeg. We don't currently support Indeo5
* decoding, but just in case we eventually need it, this is kept as a separate
* file like it is in ffmpeg.
*
@ -343,7 +343,7 @@ struct AVFrame {
* Constructor
*/
AVFrame();
/**
* Destructor
*/
@ -564,7 +564,7 @@ protected:
virtual int decodeMbInfo(IVIBandDesc *band, IVITile *tile) = 0;
/**
* Decodes the Indeo frame from the bit reader already
* Decodes the Indeo frame from the bit reader already
* loaded into the context
*/
int decodeIndeoFrame();

View file

@ -610,7 +610,7 @@ int Indeo4Decoder::decodePlaneSubdivision() {
if (_ctx._gb->getBits(2) != 3)
return 0;
return 4;
default:
return 0;
}

View file

@ -459,7 +459,7 @@ int Indeo5Decoder::decode_gop_header() {
mbSize = _ctx._gb->getBit();
blkSize = 8 >> _ctx._gb->getBit();
mbSize = blkSize << (!mbSize ? 1 : 0);
if (p == 0 && blkSize == 4) {
warning("4x4 luma blocks are unsupported!");
return -2;

View file

@ -535,7 +535,7 @@ void QTRLEDecoder::createSurface() {
if (_surface) {
_surface->free();
delete _surface;
}
}
_surface = new Graphics::Surface();
_surface->create(_paddedWidth, _height, getPixelFormat());

View file

@ -28,8 +28,8 @@ class AlgorithmTestSuite : public CxxTest::TestSuite {
/**
* Auxiliary function to check the equality of two generic collections (A and B), from one_first to one_last.
*
* @note: It assumes that other has at least (one_last - one-first) lenght, starting from other_first.
*
* @note: It assumes that other has at least (one_last - one-first) lenght, starting from other_first.
*
* @param one_first: The first element of the first collection to be compared.
* @param one_last: The last element of the first collection to be compared.
* @param other_first: The first element of the collection to be compared.
@ -37,19 +37,19 @@ class AlgorithmTestSuite : public CxxTest::TestSuite {
*/
template<typename It>
bool checkEqual(It one_first, It one_last, It other_first) {
if (one_first == one_last)
if (one_first == one_last)
return true;
// Check whether two containers have the same items in the same order,
// starting from some iterators one_first and other_first
//
//
// It iterates through the containers, comparing the elements one by one.
// If it finds a discrepancy, it returns false. Otherwise, it returns true.
for (; one_first != one_last; ++one_first, ++other_first)
if (*one_first != *other_first)
for (; one_first != one_last; ++one_first, ++other_first)
if (*one_first != *other_first)
return false;
return true;
}
@ -125,19 +125,19 @@ public:
Common::sort(list.begin(), list.end());
TS_ASSERT_EQUALS(checkSort(list.begin(), list.end(), Common::Less<Item>()), true);
}
void test_string_replace() {
Common::String original = "Hello World";
Common::String expected = "Hells Wsrld";
Common::replace(original.begin(), original.end(), 'o', 's');
TS_ASSERT_EQUALS(original, expected);
TS_ASSERT_EQUALS(original, expected);
}
void test_container_replace() {
Common::List<int> original;
Common::List<int> expected;
for (int i = 0; i < 6; ++i) {
@ -150,7 +150,7 @@ public:
}
Common::replace(original.begin(), original.end(), 3, 5);
TS_ASSERT_EQUALS(checkEqual(original.begin(), original.end(), expected.begin()), true);
}
};

View file

@ -438,16 +438,16 @@ class StringTestSuite : public CxxTest::TestSuite
// Using iterators (also a terribly useless program as a test).
testString.replace(testString.begin(), testString.end(), "That is the supernew string.");
TS_ASSERT_EQUALS(testString, Common::String("That is the supernew string."));
TS_ASSERT_EQUALS(testString, Common::String("That is the supernew string."));
// With sub strings of character arrays.
testString.replace(21, 6, "That phrase is new.", 5, 6);
TS_ASSERT_EQUALS(testString, Common::String("That is the supernew phrase."));
// Now with substrings.
// Now with substrings.
testString.replace(12, 2, Common::String("That hy is new."), 5, 2);
TS_ASSERT_EQUALS(testString, Common::String("That is the hypernew phrase."));
// --------------------------
// Tests with displacement
// --------------------------
@ -463,20 +463,20 @@ class StringTestSuite : public CxxTest::TestSuite
// Using iterators (also a terribly useless program as a test)
testString.replace(testString.begin() + 4, testString.begin() + 5, " coffee ");
TS_ASSERT_EQUALS(testString, Common::String("Good coffee friends"));
TS_ASSERT_EQUALS(testString, Common::String("Good coffee friends"));
// With sub strings of character arrays
testString.replace(4, 0, "Lorem ipsum expresso dolor sit amet", 11, 9);
TS_ASSERT_EQUALS(testString, Common::String("Good expresso coffee friends"));
// Now with substrings
// Now with substrings
testString.replace(5, 9, Common::String("Displaced ristretto string"), 10, 10);
TS_ASSERT_EQUALS(testString, Common::String("Good ristretto coffee friends"));
// -----------------------
// Deep copy compliance
// -----------------------
// Makes a deep copy without changing the length of the original
Common::String s1 = "TestTestTestTestTestTestTestTestTestTestTest";
Common::String s2(s1);