- 1
- 2
- 3
- 4
- 5
SDL_Rect sr = {
e->outputRect.x,
e->outputRect.y+e->lineHeight*line,
e->outputRect.w,
sr.y + e->lineHeight };
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+134
SDL_Rect sr = {
e->outputRect.x,
e->outputRect.y+e->lineHeight*line,
e->outputRect.w,
sr.y + e->lineHeight };
+134
public static string GetString(string inpString, string defValue)
{
if (inpString == null)
return defValue;
return inpString;
}
Этот метод заботливо лижит в файле с всякими вспомогательными функциями, мало ли где может понадобиться
+134
if (paramList[i].GetType().Equals(typeof(String)))
...
+134
if ( cg_g2MarksAllModels == NULL )
{
cg_g2MarksAllModels = Cvar_Get( "cg_g2MarksAllModels", "0", 0 );
}
if (cg_g2MarksAllModels == NULL
|| !cg_g2MarksAllModels->integer )
{
firstModelOnly = qtrue;
}
Cvar_Get возвращает ненулевой указатель в любом случае.
+134
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
https://www.imperialviolet.org/2014/02/22/applebug.html
Понятно, что третий if не выполнится. Кстати, это был баг в Apple SSL/TLS, привёдший к уязвимости.
Кстати, GCC с -Wall это не ловит. Ловит только Clang, и то только с -Wunreachable-code. Мораль: заключайте все тела ифов в блоки!
+134
public static class GlobalFunc
{
// bla-bla-bla ...
public static bool isDouble(string input)
{
Double dec;
return Double.TryParse(input, out dec);
}
public static bool isUShort(string input)
{
ushort dec;
return ushort.TryParse(input, out dec);
}
public static bool isShort(string input)
{
short dec;
return short.TryParse(input, out dec);
}
public static bool IsDate(string input)
{
DateTime date;
return DateTime.TryParse(input, out date);
}
}
face palm
+134
String r_count = "";
String r_cat = "";
String r_pansion = "";
for (Int32 ii = 0; ii < rows.Count; ii++)
{
Int32 j = rows[ii].NNight;
DateTime d = rows[ii].DateBeg;
DateTime d_e = rows[ii].DateEnd;
Int32 type = rows[ii].MinLength > 0 ? 3 : 2;
j = (type == 3) ? -1 : j;
Int32 lengthMin = rows[ii].MinLength;
if (((d < date1 || d > date2) && type != 3))
continue;
else
if (!(d <= date1 && d_e >= date1 || d <= date2 && d_e >= date2) && date1 != DateTime.MinValue && date2 != DateTime.MaxValue && type == 3)
continue;
String _r_count = _Rooms[rows[ii].RoomId];
String _r_cat = _RoomCat[rows[ii].RoomCatId];
String _r_pansion = _Pansions[rows[ii].PansionId];
List<String> a = new List<string>();
if (_r_count != r_count || _r_cat != r_cat || _r_pansion != r_pansion)
{
if (!String.IsNullOrEmpty(r_count) && !String.IsNullOrEmpty(r_cat))
{
Pricing.RoomCat cat = new Pricing.RoomCat();
cat.RoomCount = r_count;
cat.RoomName = r_cat;
cat.PansionName = r_pansion;
p.rooms.Add(cat);
}
r_count = _r_count;
r_cat = _r_cat;
r_pansion = _r_pansion;
}
Краху туроператоров способствовали также и собственные инженеры.
+134
class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }
Говно или не говно? Мне кажется первое
+134
for (var i = 0; i < numberPhone.Length; i++)
{
if (numberPhone[i] == ',')
return resultPhone;
if (Char.IsNumber(numberPhone[i]))
{
resultPhone += numberPhone[i];
}
}
return resultPhone;
+134
public virtual bool IsShown
{
get
{
if (obj && show && usePosition)
{
return obj.transform.localPosition == show.localPosition;
}
if (obj && show && useScale)
{
return obj.transform.localScale == show.localScale;
}
if (obj && show && useRotation)
{
return obj.transform.localRotation == show.localRotation;
}
return false;
}
}
public virtual bool IsHided
{
get
{
if (obj && hide && usePosition)
{
return obj.transform.localPosition == hide.localPosition;
}
if (obj && hide && useScale)
{
return obj.transform.localScale == hide.localScale;
}
if (obj && hide && useRotation)
{
return obj.transform.localRotation == hide.localRotation;
}
return false;
}
Чувак с соседнего проекта много интересного рассказывал про хорошие практики кода. А потом он уволился, и коллеги стали изучать его творчество.