- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
if (false == very_long_function(arg1, arg2, ...))
{
if (false == very_long_other_function(even_more_args)
{
do_something();
}
else
{
do_something_else();
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
if (false == very_long_function(arg1, arg2, ...))
{
if (false == very_long_other_function(even_more_args)
{
do_something();
}
else
{
do_something_else();
}
}
И вот такими многоэтажками забит весь проект.
+142
return st1.empty() || st2.empty() ? st1.empty() && st2.empty() ? 0 : st1.empty() ? st2.gcd() : st1.gcd() : qwer::gcd(st1.gcd(), st2.gcd());
Когда увлёкся условными конструкциями...
+138
if(argc > 6){
for(arg = argv[6]; strlen((char *)arg) >= 17 &&
isdigit(arg[0]) &&
isdigit(arg[1]) &&
isdigit(arg[3]) &&
isdigit(arg[4]) &&
isdigit(arg[6]) &&
isdigit(arg[7]) &&
isdigit(arg[9]) &&
isdigit(arg[10]) &&
isdigit(arg[12]) &&
isdigit(arg[13]) &&
isdigit(arg[15]) &&
isdigit(arg[16])
; arg+=18){
int t1, t2;
struct period *sp;
t1 = (arg[0] - '0') * 10 + (arg[1] - '0');
t1 = (t1 * 60) + (arg[3] - '0') * 10 + (arg[4] - '0');
t1 = (t1 * 60) + (arg[6] - '0') * 10 + (arg[7] - '0');
t2 = (arg[9] - '0') * 10 + (arg[10] - '0');
t2 = (t2 * 60) + (arg[12] - '0') * 10 + (arg[13] - '0');
t2 = (t2 * 60) + (arg[15] - '0') * 10 + (arg[16] - '0');
if(t2 < t1) break;
sp = myalloc(sizeof(struct period));
if(sp){
sp->fromtime = t1;
sp->totime = t2;
sp->next = acl->periods;
acl->periods = sp;
}
if(arg[17]!=',') break;
}
}
Получение временных диапазонов, из https://github.com/z3APA3A/3proxy/blob/devel/src/3proxy.c#L1470
Основное говно в том, что нифига не проверяются входные данные т.е. секунд и минут может быть больше 59, а часов может быть больше 23. И проверку if(t2 < t1) лучше заменить на if(t2 <= t1)
А еще там в том исходнике в качестве отступов используются и пробелы и табы. Вообще там очень много говнокода
+160
class Claims
{
...
function ReadClaim(...)
{
...
if ($this) $this->claim = $claim;
$instance = $this ? $this : Claims::getInstance($claim);
...
}
...
}
−403
if (indexPath.row == 0) {
if (![centerViewController isKindOfClass:[T7DUserInfoViewController class]]) {
T7DUserInfoViewController *userViewController = [[T7DUserInfoViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:userViewController animated:NO];
}
}
if (indexPath.row == 1) {
if (![centerViewController isKindOfClass:[T7DMapViewController class]]) {
T7DMapViewController *mapViewController = [[T7DMapViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:mapViewController animated:NO];
}
}
if (indexPath.row == 2) {
if (![centerViewController isKindOfClass:[T7DOrderListViewController class]]) {
T7DOrderListViewController *orderListViewController = [[T7DOrderListViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:orderListViewController animated:NO];
}
}
if (indexPath.row == 3) {
if (![centerViewController isKindOfClass:[T7DCurrentOrderViewController class]]) {
T7DCurrentOrderViewController *orderViewController = [[T7DCurrentOrderViewController alloc] init];
[orderViewController setOrderType:T7DOrderTypeCurrent];
[orderViewController setOrder:[T7DOrder currentOrder]];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:orderViewController animated:NO];
}
}
if (indexPath.row == 4) {
if (![centerViewController isKindOfClass:[T7DMessagesViewController class]]) {
T7DMessagesViewController *messagesViewConroller = [[T7DMessagesViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:messagesViewConroller animated:NO];
}
}
if (indexPath.row == 5) {
[self logout];
return;
}
Мудаки.
+92
var
HTML: TStringList;
HTTP: THTTPSend;
begin
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV4.exe'), SW_HIDE);
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV5.exe'), SW_HIDE);
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV6.exe'), SW_HIDE);
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV7.exe'), SW_HIDE);
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV8.exe'), SW_HIDE);
WinExec(PANsiChar('TASKKILL /F /IM HttpAnalyzerStdV9.exe'), SW_HIDE);
if FLogin.sEdit1.Text = '' then
raise Exception.Create('Ошибка авторизации, введенные данные не найдены!');
if FLogin.sEdit2.Text = '' then
raise Exception.Create('Ошибка авторизации, введенные данные не найдены!');
if FLogin.sEdit3.Text = '' then
raise Exception.Create('Ошибка авторизации, введенные данные не найдены!');
HTML := TStringList.Create;
HTTP := THTTPSend.Create;
HTTP.Protocol := '1.1';
HTTP.Headers.Add('Accept: application/json, text/javascript, */*; q=0.0');
HTTP.Headers.Add('X-Requested-With: XMLHttpRequest');
HTTP.MimeType := 'application/x-www-form-urlencoded; charset=UTF-8';
HTTP.UserAgent := 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)';
if HTTP.HTTPMethod('Post', 'http://{тут_мог_быть_ваш_адресс}/testlicfile/Perm_License.txt') then
begin
HTML.LoadFromStream(HTTP.Document);
if Pos((FLogin.sEdit1.Text + '_' + FLogin.sEdit2.text + '_' + FLogin.sEdit3.text + '_READY'), HTML.text) <> 0 then
begin
IniFile := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'ArcheAge.ini');
IniFile.WriteString('LOGIN', 'SKYPE', FLogin.sEdit1.Text);
IniFile.WriteString('LOGIN', 'HWID', FLogin.sEdit2.Text);
IniFile.WriteString('LOGIN', 'KEYPS', FLogin.sEdit3.Text);
IniFile.Free;
Form2.Caption := 'Информация - [Лицензия: ' + FLogin.sEdit1.Text + ']';
Form1.Show;
FLogin.AlphaBlend := True;
FLogin.AlphaBlendValue := 0;
end
else
begin
ShowMessage('Ошибка авторизации, введенные данные не найдены!');
end;
HTML.Free;
HTTP.Free;
end;
end;
Узрел тут такой шедевр на одном из форумов. Типа защита от взлома:)
+161
$reload_one_by_one = $folder = $datashow = $tagdelete = $ipdatauser = $design = $open_all = $catshow = $main = $daleeshow = $openshow = $number = $add = $size = $papki_numbers = $zagolovokin = $menu = $noli = $show_title = $random = $showlinks = $open_new_window = $shablon = $show_new_pages = $reload_link_show = $reload_link_time = $reload_link_on_start = $show_pages_from = $calendar_future = $calendar_years = $re_menu_type = $must_have_foto_adres = $papki_in_razdel_show = $papki_in_razdel_punkt = $papki_in_papki_show = $papki_in_papki_punkt = $papki_in_pages_show = $papki_in_pages_punkt = $type_menu_item = $razdel_menu_show = $tag_show = $sort_photo = $archive_type = $archive_sort = $another_css_link = $another_css_options = $another_css_font_1 = $another_css_font_2 = $another_css_color_1 = $another_css_color_2 = $another_css_noimages = $author_show = 0;
Кажется найден «брат» говнокода http://govnokod.ru/17836
−82
Процедура ПередЗаписью(Отказ, РежимЗаписи, РежимПроведения)
Если НЕ ВвестиСтроку(Комментарий, "Укажите комментарий к запрещению: ", 255) Тогда
ОбщегоНазначения.СообщитьОбОшибке("Не указан комментарий к запрещению!", Отказ, Заголовок);
Форма = ЭтотОбъект.ПолучитьФорму("ФормаДокумента");
Если Форма.Открыта() Тогда
Форма.Закрыть();
КонецЕсли;
Возврат;
КонецЕсли;
Если СтрДлина(Комментарий) < 11 Тогда
ОбщегоНазначения.СообщитьОбОшибке("Комментарий слишком короткий!", Отказ, Заголовок);
Возврат;
КонецЕсли;
КонецПроцедуры
И пусть транзакция подождет. Дорогой, у тебя слишком короткий комментарий.
−289
def self.add_zeroes(string, stringSize, leftOrRight = true)
while string.size < stringSize
string = leftOrRight ? "0" + string : string + "0"
end
string
end
+135
#include "mono-math.h"
#ifndef HAVE_SIGNBIT
int
mono_signbit_float (float x)
{
union { float f; int i; } u;
u.f = x;
return u.i < 0;
}
int
mono_signbit_double (double x)
{
union { double d; int i[2]; } u;
u.d = x;
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
return u.i [1] < 0;
#else
return u.i [0] < 0;
#endif
}
#endif
Говно тут в том, что int далеко не везде будет 32 бит.
https://github.com/mono/mono/blob/master/mono/utils/mono-math.c оттуда