-
+50.1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
...
double total, free;
GetCensoredServer()->GetCensoredMemory(total, free);
if (free<0.) // <-- чудесная проверка
{
MessageBox(AfxGetMainWnd()->m_hWnd, censored("Please check censored for enough memory!")), _T(""), MB_OK|MB_ICONWARNING);
return false;
}
...
Найдено в рабочем коде. Некоторые идентификаторы изменены.
Xentrax,
01 Сентября 2009
-
+47
- 1
- 2
- 3
- 4
- 5
- 6
- 7
#if defined(_WIN32_WCE_PSPC)
if(SHSipInfo(SPI_GETSIPINFO, 0, &si, 0))
#else if (_WIN32_WCE >= 400) // <-- "хитрое" место
if(SipGetInfo(&si))
#endif
{
// bla bla
Найдено в рабочем коде.
Удивительно, но это работает, как задумывалось.
Xentrax,
01 Сентября 2009
-
+56.6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
class inTm: public ioTm
{ public: inTm(){ startInTm(); buffer=temp; };
int readTm (tmData&);
virtual void message(const structMessage&){};
void inputArray (int);
void setNonBlock(int);
void startInTm();
long readTmPos(tmData&);
protected:
unsigned char temp[lengthBuffer];
virtual unsigned char* readBuffer(int&)=0;
int inputBuffer();
void convertTm(unsigned char*, tmData&);
virtual long getPos(){ return current-count-countTemp; };
private:
void cnvTmPC (unsigned char*, tmData&);
void cnvTmNet (unsigned char*, tmData&);
friend inTmBl;
friend finTm;
int count;
int lengthIn;
unsigned char* tempBuf;
int countTemp;
};
Программист Мудрецов (фамилия у человека такая) был большим затейником. Например, код на С++ в хидерах он формативровал по центру - как стихи.
P. S. Надеюсь, на сайте форматирование сохранится.
Dimarius,
01 Сентября 2009
-
+58.1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 53)
{
Level_BeginThread(0, 500);
}
break;
}
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 54)
{
Level_BeginThread(1, 500);
}
break;
}
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 57)
{
Level_BeginThread(2, 500);
}
break;
}
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 58)
{
Level_BeginThread(3, 500);
}
break;
}
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 58)
{
Level_BeginThread(3, 500);
}
break;
}
switch (_Event)
{
case LEVEL_EVENT_Stomp:
if (_Param1 == 59)
{
Level_BeginThread(4, 500);
}
break;
}
Кусочек скрипта уровня одной игрушки. Вот что значит, если дизайнер не знает языка... Копипаст форева!!!АдинАдинАдин
JohnnyIpcom,
28 Августа 2009
-
+51.9
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
CSocket* CServer::GetSocket (const int& fd) { // Find socket by FD
if (m_mapSocket[fd]) return m_mapSocket[fd];
else return NULL;
}
// another one piece of crap...
void CServer::CloseSocket(const int& fd) { // Close Socket.
delete m_mapSocket[fd];
if (m_mapSocket[fd]) m_mapSocket.erase(fd);
FD_CLR(fd,&FFd_set);
if (fd == FMax_fd) FMax_fd--;
}
zaufi,
28 Августа 2009
-
+49.2
- 1
- 2
- 3
- 4
if (strlen(tmpStr) > 250)
strncpy(fields[i].info.fieldName, tmpStr, 250);
else
strcpy(fields[i].info.fieldName, tmpStr);
А пох - все равно скопируем. =)
rockerzz,
27 Августа 2009
-
+48
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
while( !InputFileStream.atEnd() )
{
QString Qstrtmp;
InputFileStream >> Qstrtmp;
ReadButton.bTag = QString(QObject::tr( (Qstrtmp.toStdString()).c_str() ));
InputFileStream >> Qstrtmp;
ReadButton.iTag = QString(QObject::tr( (Qstrtmp.toStdString()).c_str() ));
InputFileStream >> Qstrtmp;
ReadButton.Popup = QString(QObject::tr( (Qstrtmp.toStdString()).c_str() ));
ReadButton.PartitionId = *iVar;
this->Buttons.push_back( ReadButton );
}
Код взят из совместного проекта 5-ти студентов.
Это был начальный период нашего изучения Qt.
k06a,
26 Августа 2009
-
+50
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
int i, j;
for (i = j = 0; i < 4; i++)
if (frame & (0x8 >> i))
{
if (i < 2 && p.value < double(frames1[j]) && !(i && j) ||
i > 1 && p.value > double(frames1[j]))
p.value.attr = 1 + i;
j++;
}
Как вам цикл до 4 с тремя проверками на значение счётчика? :)
Dimarius,
25 Августа 2009
-
+47.9
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
IsSimpleAssign = ( !isIfWhileForReturn&&
( _currString->ecoString )->IsAtOncePresent( equalsSign )&&
( _currString->ecoString )->IsAtOncePresent( star ) &&
( _currString->ecoString )->IsAtOncePresent( amper ) &&
( ( ( _currString->ecoString )->GetCharPos( amper ) <
( _currString->ecoString )->GetCharPos( star ) ) ||
( ( _currString->ecoString )->GetCharPos( amper ) >
( _currString->ecoString )->GetCharPos( star ) ) ) &&
( ( ( _currString->ecoString )->GetCharPos( equalsSign ) <
( _currString->ecoString )->GetCharPos( star ) ) &&
( ( _currString->ecoString )->GetCharPos( amper ) <
( _currString->ecoString )->GetCharPos( equalsSign ) )
||
( ( _currString->ecoString )->GetCharPos( equalsSign ) >
( _currString->ecoString )->GetCharPos( star ) ) &&
( ( _currString->ecoString )->GetCharPos( amper ) >
( _currString->ecoString )->GetCharPos( equalsSign ) ) )
);
где-то в недрах рукописного парсера
gilya,
25 Августа 2009
-
+32.9
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
#include <stdlib.h>
...
class CAbstractControl
{
...
};
class CWindow
{
...
};
class CButton: public CAbstractControl
{
...
};
class CLabel: public CAbstractControl
{
...
};
...
bool operator+(CWindow& win, CAbstractControl& Control)
{
return win.AddControl(Control);
};
...
void main()
{
CWindow& w=new CWindow(10,10,300,300,"Mail Messanger v11.0");
CAbstractControl& b1=new CButton(270,280,300,300,"OK");
...
CAbstractControl& l1=new CLabel(10,10,"Mail:");
...
if(!(w+b1))abort();
if(!(w+b2))abort();
...
};
Программа делает аборт();
:D
Говногость,
19 Августа 2009