void CPlugin::SetFirefoxCookie(const vector<SetFirefoxCookieParams>& vCookies, ULONG_PTR ulWindowId) { CString strEventType = _T("IEBatchSetCookie"); CString strDetail; Json::Value json; Json::Value aCookies; for (size_t i = 0; i < vCookies.size(); i++) { const SetFirefoxCookieParams& param = vCookies[i]; Json::Value cookie; cookie["url"] = (LPCSTR)CT2A(param.strURL, CP_UTF8); cookie["header"] = (LPCSTR)CT2A(param.strCookie, CP_UTF8); aCookies.append(cookie); } json["cookies"] = aCookies; if (ulWindowId) { char szWindowId[32] = { 0 }; _ui64toa_s(ulWindowId, szWindowId, 32, 10); json["windowId"] = szWindowId; } strDetail = CA2T(json.toStyledString().c_str(), CP_UTF8); FireEvent(strEventType, strDetail); }
STDMETHODIMP CKhParser::Init(int cSafeArr, BSTR www, BSTR dictPath, BSTR notfoundPath, long* hRes ) { Terminate( hRes ); dict = std::wstring(dictPath); notfound = std::wstring(notfoundPath); //"http://khakas.altaica.ru" request = www + request; safeArraySize = cSafeArr; *hRes = pIXMLHTTPRequest.CreateInstance("Msxml2.ServerXMLHTTP"); repl.insert(std::pair<short, short>(L'a', 0x0430)); repl.insert(std::pair<short, short>(L'c', 0x0441)); repl.insert(std::pair<short, short>(L'e', 0x0435)); repl.insert(std::pair<short, short>(L'i', 0x0456)); repl.insert(std::pair<short, short>(L'o', 0x043E)); repl.insert(std::pair<short, short>(L'p', 0x0440)); repl.insert(std::pair<short, short>(L'x', 0x0445)); repl.insert(std::pair<short, short>(L'y', 0x0443)); repl.insert(std::pair<short, short>(0xF6, 0x04E7)); repl.insert(std::pair<short, short>(0xFF, 0x04F1)); repl.insert(std::pair<short, short>(0x04B7, 0x04CC)); char locale_name[32] = ""; locale_name[0] = '.'; _ui64toa_s(1251, locale_name + 1, sizeof(locale_name) - 1, 10); locinfo = _create_locale(LC_ALL, locale_name); return *hRes; }
/*---------------------------------------------------------------------------*/ static int tostring_u64(lua_State *L) { char temp[64]; // sprintf_s(temp, "%I64u", *(unsigned long long*)lua_topointer(L, 1)); _ui64toa_s(*(unsigned long long*)lua_topointer(L, 1),temp,sizeof(temp),10); lua_pushstring(L, temp); return 1; }
void CInifile::w_u64 ( LPCSTR S, LPCSTR L, u64 V, LPCSTR comment ) { string128 temp; #ifndef _EDITOR _ui64toa_s (V, temp, sizeof(temp), 10); #else _ui64toa (V, temp, 10); #endif w_string (S,L,temp,comment); }
static std::string IntToStr (unsigned __int64 value) { char buffer[100] = { 0 }; _ui64toa_s (value, buffer, 100, 10); std::string result = buffer; for (size_t i = 3; i < result.length(); i += 4) result.insert (result.length() - i, 1, ','); return result; };
void CPlugin::SetFirefoxCookie(const CString& strURL, const CString& strCookieHeader, ULONG_PTR ulWindowId) { CString strEventType = _T("IESetCookie"); CString strDetail; Json::Value json; json["url"] = (LPCSTR)CT2A(strURL, CP_UTF8); json["header"] = (LPCSTR)CT2A(strCookieHeader, CP_UTF8); if (ulWindowId) { char szWindowId[32] = { 0 }; _ui64toa_s(ulWindowId, szWindowId, 32, 10); json["windowId"] = szWindowId; } strDetail = CA2T(json.toStyledString().c_str(), CP_UTF8); FireEvent(strEventType, strDetail); }
// 将无符号64位整数转换为字符串 // 例如:tostr(100123) = "100123" string tostr(uint64 n) { char buf[64] = {0}; #ifdef WIN32 errno_t err = _ui64toa_s (n, buf, sizeof(buf), 10); if(err){ return ""; } return buf; #else snprintf(buf, sizeof(buf), "%" PRIu64 "", n); // snprintf(buf, sizeof(buf), "%llu", n); return buf; #endif }
static bool ConvertNumber(const TArgInfo &info, int dst, int src){ const TString1D &tmp = info.m_arg; size_t n = tmp.size(); if(n){ char buf[256]; for(size_t i=0 ; i!=n ; ++i){ uint64 x = _strtoi64(tmp[i].c_str(),NULL,src); if(0<i){ printf(" "); } _ui64toa_s(x,buf,sizeof(buf),dst); if(dst==16){ printf("0x"); } printf("%s",buf); } //printf("\n"); } if(n==0){ return false; } return true; }
//----------------------------------------------------------------------------- void MGStrOp::toString( U64 src,std::string& dest ) { Char8 buff[21] = {0}; _ui64toa_s(src,buff,20,10); dest = buff; }
Air::AString Converter::ToString( U64 val ){ AChar str[32]; _ui64toa_s(val,str,32,10); return str; }
Air::AString Converter::ToString( U32 val ){ AChar str[16]; _ui64toa_s(val,str,16,10); return str; }