View gist:1945197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ALWAYS_INLINE uint64_t endian_fix64( uint64_t x ) | |
{ | |
return endian_fix32(x>>32) + ((uint64_t)endian_fix32(x)<<32); | |
} | |
1>c:\dev\x264-devel\common\osdep.h(242): warning C4244: 'argument' : conversion from 'uint64_t' to 'uint32_t', possible loss of data | |
1>c:\dev\x264-devel\common\osdep.h(247): warning C4244: 'return' : conversion from 'uint64_t' to 'intptr_t', possible loss of data |
View gist:2024374
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
The values are the same, see: | |
SPEAKER_FRONT_LEFT 0x1 | |
SPEAKER_FRONT_RIGHT 0x2 | |
SPEAKER_FRONT_CENTER 0x4 | |
SPEAKER_LOW_FREQUENCY 0x8 | |
SPEAKER_BACK_LEFT 0x10 | |
SPEAKER_BACK_RIGHT 0x20 |
View gist:4488235
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (message) | |
{ | |
case WM_CREATE: | |
hChannelMembers = CreateWindow(_T("LISTBOX"), _T(""), | |
WS_CHILD | WS_VISIBLE | LBS_STANDARD, | |
0, 0, 0,0, hWnd, IDC_MEMBERS, hInst, NULL); | |
hMessages = CreateWindow(_T("LISTBOX"), _T(""), | |
WS_CHILD | WS_VISIBLE | LBS_STANDARD, | |
0, 0, 0,0, hWnd, IDC_MESSAGES, hInst, NULL); |
View LoginView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline std::vector<std::pair<std::wstring, std::wstring>> GetURLTokens(std::wstring input) | |
{ | |
std::vector<std::pair<std::wstring, std::wstring>> result; | |
auto tokenStartPos = input.find_first_of(L"?#"); | |
while (tokenStartPos != std::string::npos) | |
{ | |
tokenStartPos++; | |
auto tokenEndPos = input.find(L"=", tokenStartPos); | |
if (tokenEndPos != std::string::npos) | |
{ |
View LoginView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef std::map<std::wstring, std::wstring> tokenMap_t; | |
inline tokenMap_t GetURLTokens(std::wstring input) | |
{ | |
tokenMap_t result; | |
auto tokenStartPos = input.find_first_of(L"?#"); | |
while (tokenStartPos != std::string::npos) | |
{ | |
tokenStartPos++; | |
auto tokenEndPos = input.find_first_of(L"=&", tokenStartPos); |
View streamstats.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class values_t> | |
class DurationBasedStatsContainer | |
{ | |
public: | |
typedef std::list<std::pair<std::chrono::high_resolution_clock::time_point, typename values_t>> valueList_t; | |
typedef std::chrono::milliseconds freq_t; | |
DurationBasedStatsContainer(freq_t maxDuration); | |
void push(values_t&& value); |
View socket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TTV_ErrorCode ttv::Socket::Recv(uint8_t* buffer, size_t length, size_t& received, bool fillBuffer/*=false*/) | |
{ | |
auto state = mAsyncOpComplete->SuspendFor (0); | |
if (TTV_FAILED(state)) | |
{ | |
return state; | |
} | |
if ( state == TTV_EC_SUCCESS) |
View main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace std; | |
#include <thread> | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <windows.h> | |
#include <conio.h> | |
enum class TypeOfSleep | |
{ |
View Easier FourCC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is a define I see all the time | |
#define MAKE_FOURCC( ch0, ch1, ch2, ch3 ) \ | |
( (unsigned int)(unsigned char)(ch0) | ( (unsigned int)(unsigned char)(ch1) << 8 ) | \ | |
( (unsigned int)(unsigned char)(ch2) << 16 ) | ( (unsigned int)(unsigned char)(ch3) << 24 ) ) | |
// and I just don't get it, why prefer | |
uint32_t myFourCC = MAKE_FOURCC('a', 'b', 'c', 'd'); | |
// over | |
uint32_t myFourceCC = 'abcd'; |
View socket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Why does this work: | |
int addrInfoRet = getaddrinfo(host.c_str(), port.c_str(), &hints, &remoteHost); | |
auto deleter = [](addrinfo* p){ if (p) {freeaddrinfo (p);} }; | |
std::unique_ptr<addrinfo, decltype(deleter)> remoteHostContainer(remoteHost, deleter); | |
// But this doesn't: | |
int addrInfoRet = getaddrinfo(host.c_str(), port.c_str(), &hints, &remoteHost); | |
std::unique_ptr<addrinfo, decltype(freeaddrinfo)> remoteHostContainer(remoteHost, freeaddrinfo); |
OlderNewer