Skip to content

Instantly share code, notes, and snippets.

@shanewfx
shanewfx / log.cpp
Created April 26, 2013 02:56
a log tool
#include "log.h"
#include <stdarg.h>
#include <windows.h>
FILE* Logger::m_hLogFile = NULL;
LogLevel Logger::m_LogLevel = LOG_TRACE;
std::string Logger::m_strFileDir = LOG_FILE_DIR;
std::string Logger::m_strFileName = LOG_FILE_NAME;
std::string Logger::m_strFilePath = LOG_FILE_PATH;
@shanewfx
shanewfx / ThreadPool.h
Created January 6, 2013 08:37
[C++] ThreadPool
/******************************************************************
* Thread Pool For Win32
* VC++ 6, BC++ 5.5(Free), GCC(Free)
* Update : 2004.6.9 llBird wushaojian@21cn.com
Use:
1):
void threadfunc(void *p)
{
//...
@shanewfx
shanewfx / FileReader.cpp
Created January 6, 2013 03:05
[C++] FileReader.cpp
#include "FileReader.h"
#ifdef _MAC_
#include <CoreServices/CoreServices.h>
#include <libgen.h>
#endif
#ifndef FILE_MAPPING_READER
#ifdef _MAC_
CFileReader::CFileReader()
@shanewfx
shanewfx / FileReader.h
Created January 6, 2013 03:04
[C++] FileReader.h
#ifndef AVM_FILE_READER_H
#define AVM_FILE_READER_H
#include "DemuxUtil.h"
//#define FILE_MAPPING_READER
#ifndef FILE_MAPPING_READER
class CFileReader
{
@shanewfx
shanewfx / MD5.cpp
Last active December 10, 2015 16:59
[C++] MD5.cpp
#include <Windows.h>
#include "MD5.h"
//////////////////////////////////////////////////////////////////////////////////
//常量定义
//加密常量
#define S11 7 //数据常量
#define S12 12 //数据常量
#define S13 17 //数据常量
@shanewfx
shanewfx / MD5.h
Created January 6, 2013 02:51
[C++] MD5.h
#ifndef AVM_MD5_ENCRYPT_H
#define AVM_MD5_ENCRYPT_H
//MD5 加密
class CMD5Aide
{
//变量定义
private:
ULONG m_lCount[2]; //加密变量
ULONG m_lState[4]; //加密变量
@shanewfx
shanewfx / compile_boost_1_49_0.bat
Created March 17, 2012 13:04
Compile Boost_v1.49.0 Batch
em @echo off
rem 先编译bjam
start bootstrap.bat
rem 等待一分钟待bjam编译完成(如果电脑性能过差,可以设置等待时间更长一些)
SET SLEEP=ping 127.0.0.1 -n
%SLEEP% 60 > nul
rem 利用bjam编译boost库
@shanewfx
shanewfx / Markdown Syntax
Created March 10, 2012 02:14
Markdown Syntax
Markdown Syntax:
1.Phrase Emphasis 斜体与加粗
*italic* **bold**
_italic_ __bold__
2.Links 超链接
@shanewfx
shanewfx / Queue
Created March 10, 2012 00:09
Loop Queue
// CQueue
//
// Implements a simple Queue ADT. The queue contains a finite number of
// objects, access to which is controlled by a semaphore. The semaphore
// is created with an initial count (N). Each time an object is added
// a call to WaitForSingleObject is made on the semaphore's handle. When
// this function returns a slot has been reserved in the queue for the new
// object. If no slots are available the function blocks until one becomes
// available. Each time an object is removed from the queue ReleaseSemaphore
// is called on the semaphore's handle, thus freeing a slot in the queue.
@shanewfx
shanewfx / log
Created March 9, 2012 08:22
simple log tool for debug
//=====================================================
//simple log tool for debug
//=====================================================
#ifndef _LOGTOOL_H_
#define _LOGTOOL_H_
#include <stdio.h>
#include <windows.h>