editor: increase warning level and fix warnings
While we're at it, let's fix-up some code-style errors.
This commit is contained in:
parent
878d1534f1
commit
163194e338
@ -605,8 +605,8 @@ void processCommand(NetworkSocket &sock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
|
||||||
LPSTR lpCmdLine, int nShowCmd)
|
LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||||
@ -676,6 +676,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
SOCKET clientSocket = INVALID_SOCKET;
|
SOCKET clientSocket = INVALID_SOCKET;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
|
#pragma warning(suppress: 4127)
|
||||||
FD_SET(serverSocket, &fds);
|
FD_SET(serverSocket, &fds);
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="4"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public:
|
|||||||
if (!connected())
|
if (!connected())
|
||||||
return false;
|
return false;
|
||||||
int ret = ::recv(socket, buffer, int(length), flags);
|
int ret = ::recv(socket, buffer, int(length), flags);
|
||||||
if (ret != length) {
|
if (ret != int(length)) {
|
||||||
disconnect();
|
disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
if (!connected())
|
if (!connected())
|
||||||
return false;
|
return false;
|
||||||
int ret = ::send(socket, buffer, int(length), flags);
|
int ret = ::send(socket, buffer, int(length), flags);
|
||||||
if (ret != length) {
|
if (ret != int(length)) {
|
||||||
disconnect();
|
disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -387,9 +387,8 @@ void TrackView::editCopy()
|
|||||||
const SyncDocument *doc = getDocument();
|
const SyncDocument *doc = getDocument();
|
||||||
if (NULL == doc) return;
|
if (NULL == doc) return;
|
||||||
|
|
||||||
if (0 == getTrackCount())
|
if (0 == getTrackCount()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,11 +403,6 @@ void TrackView::editCopy()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gather data
|
|
||||||
int rows = selectBottom - selectTop + 1;
|
|
||||||
int columns = selectRight - selectLeft + 1;
|
|
||||||
size_t cells = columns * rows;
|
|
||||||
|
|
||||||
std::vector<struct CopyEntry> copyEntries;
|
std::vector<struct CopyEntry> copyEntries;
|
||||||
for (int track = selectLeft; track <= selectRight; ++track) {
|
for (int track = selectLeft; track <= selectRight; ++track) {
|
||||||
const size_t trackIndex = doc->getTrackIndexFromPos(track);
|
const size_t trackIndex = doc->getTrackIndexFromPos(track);
|
||||||
@ -450,9 +444,8 @@ void TrackView::editCopy()
|
|||||||
|
|
||||||
void TrackView::editCut()
|
void TrackView::editCut()
|
||||||
{
|
{
|
||||||
if (0 == getTrackCount())
|
if (0 == getTrackCount()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,9 +458,8 @@ void TrackView::editPaste()
|
|||||||
SyncDocument *doc = getDocument();
|
SyncDocument *doc = getDocument();
|
||||||
if (NULL == doc) return;
|
if (NULL == doc) return;
|
||||||
|
|
||||||
if (0 == getTrackCount())
|
if (0 == getTrackCount()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,7 +523,8 @@ void TrackView::editPaste()
|
|||||||
GlobalUnlock(hmem);
|
GlobalUnlock(hmem);
|
||||||
clipbuf = NULL;
|
clipbuf = NULL;
|
||||||
}
|
}
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
|
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
}
|
}
|
||||||
@ -786,7 +779,8 @@ void TrackView::editEnterValue()
|
|||||||
SendMessage(GetParent(getWin()), WM_CURRVALDIRTY, 0, 0);
|
SendMessage(GetParent(getWin()), WM_CURRVALDIRTY, 0, 0);
|
||||||
InvalidateRect(getWin(), NULL, FALSE);
|
InvalidateRect(getWin(), NULL, FALSE);
|
||||||
}
|
}
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackView::editToggleInterpolationType()
|
void TrackView::editToggleInterpolationType()
|
||||||
@ -800,7 +794,7 @@ void TrackView::editToggleInterpolationType()
|
|||||||
|
|
||||||
int idx = key_idx_floor(t, editRow);
|
int idx = key_idx_floor(t, editRow);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +811,8 @@ void TrackView::editToggleInterpolationType()
|
|||||||
SendMessage(GetParent(getWin()), WM_CURRVALDIRTY, 0, 0);
|
SendMessage(GetParent(getWin()), WM_CURRVALDIRTY, 0, 0);
|
||||||
InvalidateRect(getWin(), NULL, FALSE);
|
InvalidateRect(getWin(), NULL, FALSE);
|
||||||
}
|
}
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackView::editDelete()
|
void TrackView::editDelete()
|
||||||
@ -846,9 +841,8 @@ void TrackView::editDelete()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == multiCmd->getSize())
|
if (0 == multiCmd->getSize()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
delete multiCmd;
|
delete multiCmd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -870,9 +864,8 @@ void TrackView::editBiasValue(float amount)
|
|||||||
int selectTop = min(selectStartRow, selectStopRow);
|
int selectTop = min(selectStartRow, selectStopRow);
|
||||||
int selectBottom = max(selectStartRow, selectStopRow);
|
int selectBottom = max(selectStartRow, selectStopRow);
|
||||||
|
|
||||||
if (0 == getTrackCount())
|
if (0 == getTrackCount()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,9 +888,8 @@ void TrackView::editBiasValue(float amount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == multiCmd->getSize())
|
if (0 == multiCmd->getSize()) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
delete multiCmd;
|
delete multiCmd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -939,12 +931,12 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
if (0 < editTrack)
|
if (0 < editTrack)
|
||||||
doc->swapTrackOrder(editTrack, editTrack - 1);
|
doc->swapTrackOrder(editTrack, editTrack - 1);
|
||||||
else
|
else
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
if (0 != getTrackCount())
|
if (0 != getTrackCount())
|
||||||
setEditTrack(editTrack - 1);
|
setEditTrack(editTrack - 1);
|
||||||
else
|
else
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VK_RIGHT:
|
case VK_RIGHT:
|
||||||
@ -952,12 +944,12 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
if (int(getTrackCount()) > editTrack + 1)
|
if (int(getTrackCount()) > editTrack + 1)
|
||||||
doc->swapTrackOrder(editTrack, editTrack + 1);
|
doc->swapTrackOrder(editTrack, editTrack + 1);
|
||||||
else
|
else
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
if (0 != getTrackCount())
|
if (0 != getTrackCount())
|
||||||
setEditTrack(editTrack + 1);
|
setEditTrack(editTrack + 1);
|
||||||
else
|
else
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -972,7 +964,8 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
float bias = 1.0f;
|
float bias = 1.0f;
|
||||||
if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
|
if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
|
||||||
if (int(getTrackCount()) > editTrack) editBiasValue(bias);
|
if (int(getTrackCount()) > editTrack) editBiasValue(bias);
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
else setEditRow(editRow - 1);
|
else setEditRow(editRow - 1);
|
||||||
break;
|
break;
|
||||||
@ -983,7 +976,8 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
float bias = 1.0f;
|
float bias = 1.0f;
|
||||||
if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
|
if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
|
||||||
if (int(getTrackCount()) > editTrack) editBiasValue(-bias);
|
if (int(getTrackCount()) > editTrack) editBiasValue(-bias);
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
else setEditRow(editRow + 1);
|
else setEditRow(editRow + 1);
|
||||||
break;
|
break;
|
||||||
@ -1031,25 +1025,24 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
editString.resize(editString.size() - 1);
|
editString.resize(editString.size() - 1);
|
||||||
invalidatePos(editTrack, editRow);
|
invalidatePos(editTrack, editRow);
|
||||||
}
|
}
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VK_CANCEL:
|
case VK_CANCEL:
|
||||||
case VK_ESCAPE:
|
case VK_ESCAPE:
|
||||||
if (!editString.empty())
|
if (!editString.empty()) {
|
||||||
{
|
|
||||||
// return to old value (i.e don't clear)
|
// return to old value (i.e don't clear)
|
||||||
editString.clear();
|
editString.clear();
|
||||||
invalidatePos(editTrack, editRow);
|
invalidatePos(editTrack, editRow);
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VK_SPACE:
|
case VK_SPACE:
|
||||||
if (!editString.empty())
|
if (!editString.empty()) {
|
||||||
{
|
|
||||||
editString.clear();
|
editString.clear();
|
||||||
invalidatePos(editTrack, editRow);
|
invalidatePos(editTrack, editRow);
|
||||||
MessageBeep(-1);
|
MessageBeep(~0U);
|
||||||
}
|
}
|
||||||
doc->sendPauseCommand( !doc->clientPaused );
|
doc->sendPauseCommand( !doc->clientPaused );
|
||||||
break;
|
break;
|
||||||
@ -1057,7 +1050,7 @@ LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT TrackView::onChar(UINT keyCode, UINT flags)
|
LRESULT TrackView::onChar(UINT keyCode, UINT /*flags*/)
|
||||||
{
|
{
|
||||||
switch (char(keyCode))
|
switch (char(keyCode))
|
||||||
{
|
{
|
||||||
@ -1070,9 +1063,8 @@ LRESULT TrackView::onChar(UINT keyCode, UINT flags)
|
|||||||
break;
|
break;
|
||||||
case '.':
|
case '.':
|
||||||
// only one '.' allowed
|
// only one '.' allowed
|
||||||
if (std::string::npos != editString.find('.'))
|
if (std::string::npos != editString.find('.')) {
|
||||||
{
|
MessageBeep(~0U);
|
||||||
MessageBeep(-1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case '0':
|
case '0':
|
||||||
@ -1090,7 +1082,8 @@ LRESULT TrackView::onChar(UINT keyCode, UINT flags)
|
|||||||
editString.push_back(char(keyCode));
|
editString.push_back(char(keyCode));
|
||||||
invalidatePos(editTrack, editRow);
|
invalidatePos(editTrack, editRow);
|
||||||
}
|
}
|
||||||
else MessageBeep(-1);
|
else
|
||||||
|
MessageBeep(~0U);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
@ -1113,7 +1106,7 @@ LRESULT TrackView::onSize(int width, int height)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT TrackView::onSetCursor(HWND win, UINT hitTest, UINT message)
|
LRESULT TrackView::onSetCursor(HWND /*win*/, UINT hitTest, UINT message)
|
||||||
{
|
{
|
||||||
POINT cpos;
|
POINT cpos;
|
||||||
GetCursorPos(&cpos);
|
GetCursorPos(&cpos);
|
||||||
@ -1128,7 +1121,7 @@ LRESULT TrackView::onSetCursor(HWND win, UINT hitTest, UINT message)
|
|||||||
MAKELPARAM(hitTest, message));
|
MAKELPARAM(hitTest, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT TrackView::onLButtonDown(UINT flags, POINTS pos)
|
LRESULT TrackView::onLButtonDown(UINT /*flags*/, POINTS pos)
|
||||||
{
|
{
|
||||||
int track = getTrackFromX(pos.x);
|
int track = getTrackFromX(pos.x);
|
||||||
if (pos.y < topMarginHeight &&
|
if (pos.y < topMarginHeight &&
|
||||||
@ -1140,14 +1133,14 @@ LRESULT TrackView::onLButtonDown(UINT flags, POINTS pos)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT TrackView::onLButtonUp(UINT flags, POINTS pos)
|
LRESULT TrackView::onLButtonUp(UINT /*flags*/, POINTS /*pos*/)
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
setEditTrack(editTrack);
|
setEditTrack(editTrack);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT TrackView::onMouseMove(UINT flags, POINTS pos)
|
LRESULT TrackView::onMouseMove(UINT /*flags*/, POINTS pos)
|
||||||
{
|
{
|
||||||
if (GetCapture() == hwnd) {
|
if (GetCapture() == hwnd) {
|
||||||
SyncDocument *doc = getDocument();
|
SyncDocument *doc = getDocument();
|
||||||
@ -1207,14 +1200,16 @@ LRESULT TrackView::windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case WM_UNDO:
|
case WM_UNDO:
|
||||||
if (NULL == getDocument()) return FALSE;
|
if (NULL == getDocument()) return FALSE;
|
||||||
if (!getDocument()->undo()) MessageBeep(-1);
|
if (!getDocument()->undo())
|
||||||
|
MessageBeep(~0U);
|
||||||
// unfortunately, we don't know how much to invalidate... so we'll just invalidate it all.
|
// unfortunately, we don't know how much to invalidate... so we'll just invalidate it all.
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_REDO:
|
case WM_REDO:
|
||||||
if (NULL == getDocument()) return FALSE;
|
if (NULL == getDocument()) return FALSE;
|
||||||
if (!getDocument()->redo()) MessageBeep(-1);
|
if (!getDocument()->redo())
|
||||||
|
MessageBeep(~0U);
|
||||||
// unfortunately, we don't know how much to invalidate... so we'll just invalidate it all.
|
// unfortunately, we don't know how much to invalidate... so we'll just invalidate it all.
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user