Skip to content

Commit

Permalink
more gcc 7
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed May 22, 2017
1 parent 4c201e0 commit ba86c65
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 35 deletions.
45 changes: 32 additions & 13 deletions far/PluginA.cpp
Expand Up @@ -3565,9 +3565,11 @@ static int WINAPI FarPanelControlA(HANDLE hPlugin, int Command, void *Param) noe

return ret;
}
case oldfar::FCTL_SETANOTHERSELECTION:
hPlugin=PANEL_PASSIVE;
case oldfar::FCTL_SETSELECTION:

case oldfar::FCTL_SETANOTHERSELECTION:
hPlugin=PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_SETSELECTION:
{
if (!Param)
return FALSE;
Expand All @@ -3583,9 +3585,11 @@ static int WINAPI FarPanelControlA(HANDLE hPlugin, int Command, void *Param) noe
NativeInfo.PanelControl(hPlugin, FCTL_ENDSELECTION, 0, nullptr);
return TRUE;
}
case oldfar::FCTL_REDRAWANOTHERPANEL:
hPlugin = PANEL_PASSIVE;
case oldfar::FCTL_REDRAWPANEL:

case oldfar::FCTL_REDRAWANOTHERPANEL:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_REDRAWPANEL:
{
if (!Param)
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_REDRAWPANEL, 0, nullptr));
Expand All @@ -3594,13 +3598,17 @@ static int WINAPI FarPanelControlA(HANDLE hPlugin, int Command, void *Param) noe
PanelRedrawInfo pri = {sizeof(PanelRedrawInfo), static_cast<size_t>(priA->CurrentItem),static_cast<size_t>(priA->TopPanelItem)};
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_REDRAWPANEL,0,&pri));
}
case oldfar::FCTL_SETANOTHERNUMERICSORT:
hPlugin = PANEL_PASSIVE;
case oldfar::FCTL_SETNUMERICSORT:
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETNUMERICSORT, (Param && *static_cast<int*>(Param))? 1 : 0, nullptr));
case oldfar::FCTL_SETANOTHERPANELDIR:

case oldfar::FCTL_SETANOTHERNUMERICSORT:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_SETNUMERICSORT:
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETNUMERICSORT, (Param && *static_cast<int*>(Param))? 1 : 0, nullptr));

case oldfar::FCTL_SETANOTHERPANELDIR:
hPlugin = PANEL_PASSIVE;
case oldfar::FCTL_SETPANELDIR:
// fallthrough
case oldfar::FCTL_SETPANELDIR:
{
if (!Param)
return FALSE;
Expand All @@ -3610,26 +3618,35 @@ static int WINAPI FarPanelControlA(HANDLE hPlugin, int Command, void *Param) noe
int ret = static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETPANELDIRECTORY,0,&dirInfo));
return ret;
}

case oldfar::FCTL_SETANOTHERSORTMODE:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_SETSORTMODE:

if (!Param)
return FALSE;

return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETSORTMODE, *static_cast<int*>(Param), nullptr));

case oldfar::FCTL_SETANOTHERSORTORDER:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_SETSORTORDER:
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETSORTORDER, Param && *static_cast<int*>(Param), nullptr));

case oldfar::FCTL_SETANOTHERVIEWMODE:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_SETVIEWMODE:
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_SETVIEWMODE, Param? *static_cast<int *>(Param) : 0, nullptr));

case oldfar::FCTL_UPDATEANOTHERPANEL:
hPlugin = PANEL_PASSIVE;
// fallthrough
case oldfar::FCTL_UPDATEPANEL:
return static_cast<int>(NativeInfo.PanelControl(hPlugin, FCTL_UPDATEPANEL, Param? 1 : 0, nullptr));

case oldfar::FCTL_GETCMDLINE:
case oldfar::FCTL_GETCMDLINESELECTEDTEXT:
{
Expand Down Expand Up @@ -5518,7 +5535,8 @@ class PluginA: public Plugin
case EE_GOTFOCUS:
case EE_KILLFOCUS:
Info->Param = &Info->EditorID;
case EE_READ:
// fallthrough
case EE_READ:
case EE_SAVE:
case EE_REDRAW:
ExecuteFunction(es, Info->Event, Info->Param);
Expand Down Expand Up @@ -5571,6 +5589,7 @@ class PluginA: public Plugin
case VE_GOTFOCUS:
case VE_KILLFOCUS:
Info->Param = &Info->ViewerID;
// fallthrough
case VE_READ:
ExecuteFunction(es, Info->Event, Info->Param);
break;
Expand Down
2 changes: 2 additions & 0 deletions far/RegExp.cpp
Expand Up @@ -37,6 +37,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "RegExp.hpp"

WARNING_DISABLE_GCC("-Wimplicit-fallthrough")

#ifdef RE_DEBUG
#include "console.hpp"
#include "strmix.hpp"
Expand Down
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 22.05.2017 20:44:12 +0000 - build 4965

1. Ещё всякое на тему gcc 7.

drkns 20.05.2017 23:45:02 +0000 - build 4964

1. gcc 7.
Expand Down
1 change: 1 addition & 0 deletions far/cmdline.cpp
Expand Up @@ -481,6 +481,7 @@ bool CommandLine::ProcessKey(const Manager::Key& Key)
case KEY_ALTSHIFTHOME: case KEY_ALTSHIFTNUMPAD7:
case KEY_RALTSHIFTHOME: case KEY_RALTSHIFTNUMPAD7:
LocalKey&=~(KEY_ALT|KEY_RALT);
// fallthrough
default:

// Сбрасываем выделение на некоторых клавишах
Expand Down
1 change: 1 addition & 0 deletions far/config.cpp
Expand Up @@ -477,6 +477,7 @@ void Options::MaskGroupsSettings()
case KEY_NUMPAD0:
case KEY_INS:
Item = &EmptyString;
// fallthrough
case KEY_ENTER:
case KEY_NUMENTER:
case KEY_F4:
Expand Down
7 changes: 7 additions & 0 deletions far/copy.cpp
Expand Up @@ -2008,6 +2008,7 @@ COPY_CODES ShellCopy::ShellCopyOneFile(
return COPY_SUCCESS;
}
}
// fallthrough
default:
return COPY_CANCEL;
} /* switch */
Expand Down Expand Up @@ -2457,12 +2458,14 @@ COPY_CODES ShellCopy::ShellCopyOneFile(
{
case 1:
SkipEncMode = 1;
// fallthrough
case 0:
Flags |= FCOPY_DECRYPTED_DESTINATION;
break;

case 3:
SkipEncMode = 3;
// fallthrough
case 2:
return COPY_SKIPPED;

Expand Down Expand Up @@ -3423,18 +3426,21 @@ bool ShellCopy::AskOverwrite(const os::FAR_FIND_DATA &SrcData,
break;
case 3:
OvrMode = 2;
// fallthrough
case 2:
RetCode = COPY_SKIPPED;
return false;
case 5:
OvrMode = 5;
GenerateName(strDestName, strRenamedFilesPath);
// fallthrough
case 4:
RetCode = COPY_RETRY;
strNewName = strDestName;
break;
case 7:
OvrMode = 6;
// fallthrough
case 6:
Append = TRUE;
break;
Expand Down Expand Up @@ -3514,6 +3520,7 @@ bool ShellCopy::AskOverwrite(const os::FAR_FIND_DATA &SrcData,
break;
case 3:
ReadOnlyOvrMode=2;
// fallthrough
case 2:
RetCode=COPY_SKIPPED;
return false;
Expand Down
1 change: 1 addition & 0 deletions far/cvtname.cpp
Expand Up @@ -297,6 +297,7 @@ size_t GetMountPointLen(const string& abs_path, const string& drive_root)
if (os::GetVolumeNameForVolumeMountPoint(drive_root, vol_guid))
break;
// else fall down to default:
// fallthrough
default:
return 0;
}
Expand Down
5 changes: 4 additions & 1 deletion far/delete.cpp
Expand Up @@ -946,10 +946,12 @@ DEL_RESULT ShellDelete::ShellRemoveFile(const string& Name, bool Wipe, int Total
return DELETE_CANCEL;
case 3:
SkipWipeMode = 2; // fallthrough down
// fallthrough
case 2:
return DELETE_SKIP;
case 1:
SkipWipeMode = 0;
// fallthrough
case 0:
{
bool Cancel = false;
Expand Down Expand Up @@ -1160,7 +1162,8 @@ bool ShellDelete::RemoveToRecycleBin(const string& Name, bool dir, DEL_RESULT& r
if (dir)
SkipFoldersMode = 2;
else
m_SkipMode = 2; // fallthrough down
m_SkipMode = 2;
// fallthrough
case 1: // [Skip]
ret = DELETE_SKIP;
break;
Expand Down
13 changes: 12 additions & 1 deletion far/dialog.cpp
Expand Up @@ -1219,9 +1219,9 @@ void Dialog::DeleteDialogObjects()
case DI_COMBOBOX:
case DI_MEMOEDIT:
delete static_cast<DlgEdit*>(i.ObjPtr);
// fallthrough

case DI_LISTBOX:

if ((i.Type == DI_COMBOBOX || i.Type == DI_LISTBOX))
i.ListPtr.reset();

Expand Down Expand Up @@ -2139,6 +2139,7 @@ bool Dialog::ProcessMoveDialog(DWORD Key)
case KEY_RCTRLHOME: case KEY_RCTRLNUMPAD7:
case KEY_HOME: case KEY_NUMPAD7:
rr=(Key == KEY_CTRLLEFT || Key == KEY_RCTRLLEFT || Key == KEY_CTRLNUMPAD4 || Key == KEY_RCTRLNUMPAD4)?10:m_X1;
// fallthrough
case KEY_LEFT: case KEY_NUMPAD4:
Hide();

Expand All @@ -2159,6 +2160,7 @@ bool Dialog::ProcessMoveDialog(DWORD Key)
case KEY_RCTRLEND: case KEY_RCTRLNUMPAD1:
case KEY_END: case KEY_NUMPAD1:
rr=(Key == KEY_CTRLRIGHT || Key == KEY_RCTRLRIGHT || Key == KEY_CTRLNUMPAD6 || Key == KEY_RCTRLNUMPAD6)?10:std::max(0,ScrX-m_X2);
// fallthrough
case KEY_RIGHT: case KEY_NUMPAD6:
Hide();

Expand All @@ -2179,6 +2181,7 @@ bool Dialog::ProcessMoveDialog(DWORD Key)
case KEY_CTRLUP: case KEY_CTRLNUMPAD8:
case KEY_RCTRLUP: case KEY_RCTRLNUMPAD8:
rr=(Key == KEY_CTRLUP || Key == KEY_RCTRLUP || Key == KEY_CTRLNUMPAD8 || Key == KEY_RCTRLNUMPAD8)?5:m_Y1;
// fallthrough
case KEY_UP: case KEY_NUMPAD8:
Hide();

Expand All @@ -2199,6 +2202,7 @@ bool Dialog::ProcessMoveDialog(DWORD Key)
case KEY_RCTRLPGDN: case KEY_RCTRLNUMPAD3:
case KEY_PGDN: case KEY_NUMPAD3:
rr=(Key == KEY_CTRLDOWN || Key == KEY_RCTRLDOWN || Key == KEY_CTRLNUMPAD2 || Key == KEY_RCTRLNUMPAD2)? 5:std::max(0,ScrY-m_Y2);
// fallthrough
case KEY_DOWN: case KEY_NUMPAD2:
Hide();

Expand Down Expand Up @@ -2370,6 +2374,7 @@ long long Dialog::VMProcess(int OpCode,void *vParam,long long iParam)
Ret=Items[m_FocusPos].ListPtr->VMProcess(OpCode,vParam,iParam);
break;
}
// fallthrough

case DI_EDIT:
case DI_PSWEDIT:
Expand Down Expand Up @@ -2627,6 +2632,7 @@ bool Dialog::ProcessKey(const Manager::Key& Key)
return true; // делать больше не чего
}
}
// fallthrough
case KEY_NUMENTER:
case KEY_ENTER:
{
Expand Down Expand Up @@ -2793,6 +2799,7 @@ bool Dialog::ProcessKey(const Manager::Key& Key)
}
}
}
// fallthrough
case KEY_UP: case KEY_NUMPAD8:
case KEY_DOWN: case KEY_NUMPAD2:

Expand Down Expand Up @@ -2829,6 +2836,7 @@ bool Dialog::ProcessKey(const Manager::Key& Key)
return true;
}

// fallthrough
// ???
// ЭТО перед default последний!!!
case KEY_PGDN: case KEY_NUMPAD3:
Expand All @@ -2854,6 +2862,7 @@ bool Dialog::ProcessKey(const Manager::Key& Key)
}
return true;
}
// fallthrough

default:
{
Expand Down Expand Up @@ -4475,6 +4484,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
// изменим вызов RESIZE.
Param1=-1;
/*****************************************************************/
// fallthrough
case DM_MOVEDIALOG:
{
int W1,H1;
Expand Down Expand Up @@ -5598,6 +5608,7 @@ intptr_t Dialog::SendMessage(intptr_t Msg,intptr_t Param1,void* Param2)
Len = static_cast<DlgEdit*>(CurItem->ObjPtr)->GetLength();
break;
}
// fallthrough

case DI_LISTBOX:
{
Expand Down
1 change: 1 addition & 0 deletions far/edit.cpp
Expand Up @@ -1273,6 +1273,7 @@ bool Edit::ProcessKey(const Manager::Key& Key)
}
case KEY_SHIFTSPACE:
LocalKey = KEY_SPACE;
// fallthrough
default:
{
// _D(SysLog(L"Key=0x%08X",LocalKey));
Expand Down
1 change: 1 addition & 0 deletions far/editcontrol.cpp
Expand Up @@ -686,6 +686,7 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe

case KEY_MSLCLICK:
MenuKey = KEY_ENTER;
// fallthrough
case KEY_ENTER:
case KEY_NUMENTER:
{
Expand Down
5 changes: 3 additions & 2 deletions far/editor.cpp
Expand Up @@ -746,6 +746,7 @@ long long Editor::VMProcess(int OpCode, void* vParam, long long iParam)
}
}
}
// fallthrough
case MCODE_V_EDITORSELVALUE: // Editor.SelValue
{
*reinterpret_cast<string*>(vParam) = IsVerticalSelection()? VBlock2Text() : Block2Text();
Expand Down Expand Up @@ -1487,9 +1488,9 @@ bool Editor::ProcessKeyInternal(const Manager::Key& Key, bool& Refresh)
case KEY_SHIFTDEL:
case KEY_SHIFTNUMDEL:
case KEY_SHIFTDECIMAL:
{
Copy(FALSE);
}
// fallthrough

case KEY_CTRLD:
case KEY_RCTRLD:
{
Expand Down
6 changes: 4 additions & 2 deletions far/encoding.cpp
Expand Up @@ -253,7 +253,8 @@ static size_t get_bytes_impl(uintptr_t const Codepage, const wchar_t* const Data
return Utf8::get_bytes(Data, DataSize, Buffer, BufferSize);

case CP_UNICODE:
memcpy(Buffer, Data, std::min(DataSize * sizeof(wchar_t), BufferSize));
if (BufferSize) // paranoid gcc null checks are paranoid
memcpy(Buffer, Data, std::min(DataSize * sizeof(wchar_t), BufferSize));
return DataSize * sizeof(wchar_t);

case CP_REVERSEBOM:
Expand Down Expand Up @@ -308,7 +309,8 @@ static size_t get_chars_impl(uintptr_t const Codepage, const char* const Data, s
return Utf7::get_chars(Data, DataSize, Buffer, BufferSize, nullptr);

case CP_UNICODE:
memcpy(Buffer, Data, std::min(DataSize, BufferSize * sizeof(wchar_t)));
if (BufferSize) // paranoid gcc null checks are paranoid
memcpy(Buffer, Data, std::min(DataSize, BufferSize * sizeof(wchar_t)));
return DataSize / sizeof(wchar_t);

case CP_REVERSEBOM:
Expand Down

0 comments on commit ba86c65

Please sign in to comment.