- 1
adsfasdf
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
adsfasdf
fdas
+139
for( i=0; i<MAX_CHANNELS; i++ )
{
ht->ht_Voices[i].vc_Delta=1;
ht->ht_Voices[i].vc_OverrideTranspose=1000; // 1.5
ht->ht_Voices[i].vc_SamplePos=ht->ht_Voices[i].vc_Track=ht->ht_Voices[i].vc_Transpose=ht->ht_Voices[i].vc_NextTrack = ht->ht_Voices[i].vc_NextTranspose = 0;
ht->ht_Voices[i].vc_ADSRVolume=ht->ht_Voices[i].vc_InstrPeriod=ht->ht_Voices[i].vc_TrackPeriod=ht->ht_Voices[i].vc_VibratoPeriod=ht->ht_Voices[i].vc_NoteMaxVolume=ht->ht_Voices[i].vc_PerfSubVolume=ht->ht_Voices[i].vc_TrackMasterVolume=0;
ht->ht_Voices[i].vc_NewWaveform=ht->ht_Voices[i].vc_Waveform=ht->ht_Voices[i].vc_PlantSquare=ht->ht_Voices[i].vc_PlantPeriod=ht->ht_Voices[i].vc_IgnoreSquare=0;
ht->ht_Voices[i].vc_TrackOn=ht->ht_Voices[i].vc_FixedNote=ht->ht_Voices[i].vc_VolumeSlideUp=ht->ht_Voices[i].vc_VolumeSlideDown=ht->ht_Voices[i].vc_HardCut=ht->ht_Voices[i].vc_HardCutRelease=ht->ht_Voices[i].vc_HardCutReleaseF=0;
ht->ht_Voices[i].vc_PeriodSlideSpeed=ht->ht_Voices[i].vc_PeriodSlidePeriod=ht->ht_Voices[i].vc_PeriodSlideLimit=ht->ht_Voices[i].vc_PeriodSlideOn=ht->ht_Voices[i].vc_PeriodSlideWithLimit=0;
ht->ht_Voices[i].vc_PeriodPerfSlideSpeed=ht->ht_Voices[i].vc_PeriodPerfSlidePeriod=ht->ht_Voices[i].vc_PeriodPerfSlideOn=ht->ht_Voices[i].vc_VibratoDelay=ht->ht_Voices[i].vc_VibratoCurrent=ht->ht_Voices[i].vc_VibratoDepth=ht->ht_Voices[i].vc_VibratoSpeed=0;
ht->ht_Voices[i].vc_SquareOn=ht->ht_Voices[i].vc_SquareInit=ht->ht_Voices[i].vc_SquareLowerLimit=ht->ht_Voices[i].vc_SquareUpperLimit=ht->ht_Voices[i].vc_SquarePos=ht->ht_Voices[i].vc_SquareSign=ht->ht_Voices[i].vc_SquareSlidingIn=ht->ht_Voices[i].vc_SquareReverse=0;
ht->ht_Voices[i].vc_FilterOn=ht->ht_Voices[i].vc_FilterInit=ht->ht_Voices[i].vc_FilterLowerLimit=ht->ht_Voices[i].vc_FilterUpperLimit=ht->ht_Voices[i].vc_FilterPos=ht->ht_Voices[i].vc_FilterSign=ht->ht_Voices[i].vc_FilterSpeed=ht->ht_Voices[i].vc_FilterSlidingIn=ht->ht_Voices[i].vc_IgnoreFilter=0;
ht->ht_Voices[i].vc_PerfCurrent=ht->ht_Voices[i].vc_PerfSpeed=ht->ht_Voices[i].vc_WaveLength=ht->ht_Voices[i].vc_NoteDelayOn=ht->ht_Voices[i].vc_NoteCutOn=0;
ht->ht_Voices[i].vc_AudioPeriod=ht->ht_Voices[i].vc_AudioVolume=ht->ht_Voices[i].vc_VoiceVolume=ht->ht_Voices[i].vc_VoicePeriod=ht->ht_Voices[i].vc_VoiceNum=ht->ht_Voices[i].vc_WNRandom=0;
ht->ht_Voices[i].vc_SquareWait=ht->ht_Voices[i].vc_FilterWait=ht->ht_Voices[i].vc_PerfWait=ht->ht_Voices[i].vc_NoteDelayWait=ht->ht_Voices[i].vc_NoteCutWait=0;
ht->ht_Voices[i].vc_PerfList=0;
ht->ht_Voices[i].vc_RingSamplePos=ht->ht_Voices[i].vc_RingDelta=ht->ht_Voices[i].vc_RingPlantPeriod=ht->ht_Voices[i].vc_RingAudioPeriod=ht->ht_Voices[i].vc_RingNewWaveform=ht->ht_Voices[i].vc_RingWaveform=ht->ht_Voices[i].vc_RingFixedPeriod=ht->ht_Voices[i].vc_RingBasePeriod=0;
ht->ht_Voices[i].vc_RingMixSource = NULL;
ht->ht_Voices[i].vc_RingAudioSource = NULL;
memset(&ht->ht_Voices[i].vc_SquareTempBuffer,0,0x80);
memset(&ht->ht_Voices[i].vc_ADSR,0,sizeof(struct hvl_envelope));
memset(&ht->ht_Voices[i].vc_VoiceBuffer,0,0x281);
memset(&ht->ht_Voices[i].vc_RingVoiceBuffer,0,0x281);
}
Щито оно делает?
−102
static PyNumberMethods __pyx_tp_as_number_DMetaphone = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
+46
if (substr($sql,0,6)=='INSERT')
{
$type = 'INSERT';
if ($is_mysql)
$O=mysql_insert_id($connection);
if ($is_ibase)
$O=false;
}
if (substr($sql,0,6)=='UPDATE')
{
$type = 'UPDATE';
if ($is_mysql)
$O = mysql_affected_rows($connection);
if ($is_ibase)
$O = ibase_affected_rows($connection);
}
if (substr($sql,0,7)=='REPLACE')
{
$type = 'REPLACE';
if ($is_mysql)
$O = mysql_affected_rows($connection);
if ($is_ibase)
$O = ibase_affected_rows($connection);
}
if (substr($sql,0,11)=='DELETE FROM')
{
$type = 'DELETE';
if ($is_mysql)
$O = mysql_affected_rows($connection);
if ($is_ibase)
$O = ibase_affected_rows($connection);
}
Как определить возвращаемый результат? Пропарсить строку запроса ($sql)!
+56
function utf8_to_cp1251 ($txt) {
$out_arr = array (
chr(208), chr(192), chr(193), chr(194),chr(195), chr(196), chr(197), chr(168),
chr(198), chr(199), chr(200), chr(201),chr(202), chr(203), chr(204), chr(205),
chr(206), chr(207), chr(209), chr(210),chr(211), chr(212), chr(213), chr(214),
chr(215), chr(216), chr(217), chr(218),chr(219), chr(220), chr(221), chr(222),
chr(223), chr(224), chr(225), chr(226),chr(227), chr(228), chr(229), chr(184),
chr(230), chr(231), chr(232), chr(233),chr(234), chr(235), chr(236), chr(237),
chr(238), chr(239), chr(240), chr(241),chr(242), chr(243), chr(244), chr(245),
chr(246), chr(247), chr(248), chr(249),chr(250), chr(251), chr(252), chr(253),
chr(254), chr(255)
);
$in_arr = array (
chr(208).chr(160), chr(208).chr(144), chr(208).chr(145),chr(208).chr(146), chr(208).chr(147), chr(208).chr(148),
chr(208).chr(149), chr(208).chr(129), chr(208).chr(150),chr(208).chr(151), chr(208).chr(152), chr(208).chr(153),
chr(208).chr(154), chr(208).chr(155), chr(208).chr(156),chr(208).chr(157), chr(208).chr(158), chr(208).chr(159),
chr(208).chr(161), chr(208).chr(162), chr(208).chr(163),chr(208).chr(164), chr(208).chr(165), chr(208).chr(166),
chr(208).chr(167), chr(208).chr(168), chr(208).chr(169),chr(208).chr(170), chr(208).chr(171), chr(208).chr(172),
chr(208).chr(173), chr(208).chr(174), chr(208).chr(175),chr(208).chr(176), chr(208).chr(177), chr(208).chr(178),
chr(208).chr(179), chr(208).chr(180), chr(208).chr(181),chr(209).chr(145), chr(208).chr(182), chr(208).chr(183),
chr(208).chr(184), chr(208).chr(185), chr(208).chr(186),chr(208).chr(187), chr(208).chr(188), chr(208).chr(189),
chr(208).chr(190), chr(208).chr(191), chr(209).chr(128),chr(209).chr(129), chr(209).chr(130), chr(209).chr(131),
chr(209).chr(132), chr(209).chr(133), chr(209).chr(134),chr(209).chr(135), chr(209).chr(136), chr(209).chr(137),
chr(209).chr(138), chr(209).chr(139), chr(209).chr(140),chr(209).chr(141), chr(209).chr(142), chr(209).chr(143)
);
$txt = str_replace($in_arr,$out_arr,$txt);
return $txt;
}
Ещё один случай лютой ненависти к iconv().
+66
@$maxday=mysql_result(mysql_query("
select max(`day`) from `hours`
where `login` in (
select `login` from people
where `type`='1' and `show`='yes')
and `begin`='10:00'
and `end`='18:00'
and `login`!='roma'"),0);
Рома, мы от тебя устали.
+148
$("#ORDER_PROP_5 option[value='7361']").attr("selected", "selected");
Установка значения в селекте.
+132
Было:
typedef struct {
int range; /*enabled flag*/
union {
struct {
unsigned str_length;
};
struct {
long i_min;
long i_max;
};
struct {
double d_min;
double d_max;
};
/* ... */
};
} wlp_range_t;
#define WLP_NO_RANGE() { .range = FALSE }
#define WLP_STRING_LENGTH(length) { .range = TRUE, .str_length = length}
#define WLP_INT_RANGE(min, max) { .range = TRUE, .i_min = min, .i_max = max }
#define WLP_FLOAT_RANGE(min, max) { .range = TRUE, .d_min = min, .d_max = max }
Стало:
typedef struct {
int range; /*enabled flag*/
struct {
struct {
unsigned str_length;
};
struct {
long i_min;
long i_max;
};
struct {
double d_min;
double d_max;
};
/* ... */
};
} wlp_range_t;
#define WLP_NO_RANGE() { B_FALSE, { {0} } }
#define WLP_STRING_LENGTH(length) { B_TRUE, { {length} } }
#define WLP_INT_RANGE(min, max) { B_TRUE, { {0}, {min, max} } }
#define WLP_FLOAT_RANGE(min, max) { B_TRUE, { {0}, {0, 0}, {min, max} } }
#define WLP_SIZE_RANGE(min, max) { B_TRUE, { {0}, {0, 0}, {0.0, 0.0}, {min, max} } }
/* ... */
Такая вот бяка получилась при портировании проекта с GCC на Visual C. А все потому, что:
1. ISO C++03 8.5.1[dcl.init.aggr]/15:
| When a union is initialized with a brace-enclosed initializer,
| the braces shall only contain an initializer for the first member of the union.
2. Visual C не поддерживает designated initializers
+54
function bezpezdu_num($num)
{
if(isset($num) && !empty($num) && is_numeric($num))
return true;
else
return false;
}
function pizdec($text)
{
$showtext = htmlspecialchars($text);
exit($showtext);
}
$app->run_epta();
+61
if(!$del){
throw new Exception("При добавлении .......... возникла ошибка, обратитесь к администрации");
return false;
}
return true;