亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? utils.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 5 頁
字號:

    wcscpy(filename, p+1);
}

/*
* The method converts the path separator "\" with "@".
* Used for favorites items to permit to sync files and directory with a filesystem sync source.
* "\" char is not permitted in file name on windows machine
* This conversion happens on send items to server
*
* @param filename : the file name retrieved to be modified
*/

void convertAtSlash(wchar_t* filename) {

    int position = 0;
    std::wstring s;
    s.append(filename);

    position = s.find(_T("@"));
    while (position != std::string::npos) {
        s.replace(position,1,_T(""));
        s.insert(position, _T("\\"));
        position = s.find(_T("@"));
    }

    wsprintf(filename, s.data());
}

/*
* The method converts the separator "@" with "\".
* Used for favorites items to permit to sync files and directory with a filesystem sync source.
* "\" char is not permitted in file name on windows machine
* This conversion happens on returned items from server
*
* @param filename : the file name retrieved to be modified
*/

void convertSlashAt(wchar_t* filename) {

    int position = 0;
    std::wstring s;
    s.append((wchar_t*)filename);

    // search for \;
    position = s.find(_T("\\"));
    while (position != std::string::npos) {
        s.replace(position,1,_T(""));
        s.insert(position, _T("@"));
        position = s.find(_T("\\"));
    }
    wsprintf(filename, s.data());
}

/*
* The method get the complete directory name starting from path.
*
* @param path     : the path and filename
* @param dirname  : the returned dir name
*/
void getDirName(const wchar_t* path, wchar_t* dirname) {

    std::wstring s;
    int position = 0;

    s.append((wchar_t*) path);
    position = s.rfind(_T('\\'));

    if (position == std::wstring::npos) {
        wsprintf(dirname, path);
        return;
    }

    //del(s, position, length(s) - position);
    s.replace(position, s.length() - position, _T(""));
    getFileName(s.data(), dirname);

}

/*
* return the length for the base64 array starting from length of the original array
*/
int lengthForB64(int len) {

    int modules = 0;
    int ret     = 0;

    modules = len % 3;
    if (modules == 0) {
        ret = 4 * (len / 3);

    } else {
        ret = 4 * ((len/3) + 1);

    }
    return ret;


}

/*
* encode in base 64 starting from char* that was trasnformed into utf8
*/
wchar_t* encodeBase64UTF8(wchar_t* toEncode) {

    if (toEncode == NULL)
        return NULL;

    char*    b64 = NULL;
    TransformationInfo info;
    char* tmp = toMultibyte(toEncode);

    DataTransformer* dtb64 = DataTransformerFactory::getEncoder("b64");

    if (dtb64 == NULL) {
        return NULL;
    }
    info.size = strlen(tmp);

    b64 = dtb64->transform((char*)tmp, info);

    wchar_t* ret = toWideChar(b64);

    /*
    char* tmp = toMultibyte(toEncode);
    int len = (wcslen(toEncode)/3+1)<<2;
    char* b64tmp = new char[len];
        memset(b64tmp, 0, len);
    int retLen = b64_encode(b64tmp, tmp, len);

    wchar_t* ret = toWideChar(b64tmp);
    */
    if (tmp)
        delete [] tmp;

    if (b64)
        delete [] b64;

    if (dtb64)
        delete dtb64;

    return ret;
}

/*
* decoding from b64 and trasforming decoding from UTF8.
* used for contact, calendar, task
*/
wchar_t* decodeBase64WUTF8(wchar_t* toDecode) {

    wchar_t* ret = NULL;
    char*    tmp = NULL;
    int      len = 0;
    char* decodedData = NULL;

    if (toDecode == NULL)
        return NULL;

    tmp = toMultibyte(toDecode);
    TransformationInfo info;
    DataTransformer* dt = DataTransformerFactory::getDecoder("b64");

    if (dt == NULL) {
        return NULL;
    }

    decodedData = dt->transform(tmp, info);

    if (decodedData) {
        tmp[info.size] = 0;
    }

    ret = toWideChar(tmp);

    if (tmp) {
        delete [] tmp;
    }

    return ret;

}


char* decodeBase64WUTF8(wchar_t* toDecode, int* myLen) {

    wchar_t* ret = NULL;
    char*    tmp = NULL;
    int      len = 0;

    if (toDecode == NULL)
        return NULL;

    tmp = toMultibyte(toDecode);

    len = b64_decode(tmp, tmp);
    *myLen = len;
    tmp[len] = 0;
    return tmp;
}


/*
* This function gets a unique file name in the current directory based on the parameter filename.
* It checks in the specified dir if fileName exists. If none it return the same file name.
* If one already exists it return a file name like - file (1) - according to the
* rules applied by windows for PPC
*
* @param fileName : the file name that can be modified if the same file already exists
*/

void getUniqueFileName(wchar_t* fileName) {

    LOG.debug("uniqueFileBegin");
    BOOL exists = FALSE;
    FILE* f = NULL;
    int i = 1;

    f = _wfopen(fileName, TEXT("r"));

    if (f == NULL) {
        return;
    }

    fflush(f);
    fclose(f);

    wchar_t path [DIM_LOCAL_TEMP];
    wchar_t file [DIM_LOCAL_TEMP];
    wsprintf(path, fileName);

    getFileName(fileName, file); // file contains file name

    getDirName(fileName, path); // path

    wchar_t* p = NULL;

    std::wstring s;
    int position = 0;
    s.append((wchar_t*)file);
    position = s.find(PWI_EXTENSION);
    if (position != std::wstring::npos) {
        file[position] = 0;
    }

    do {
        wchar_t localFile[DIM_LOCAL_TEMP];
        wsprintf(localFile, TEXT("%s%s%s (%i)%s") , path, TEXT("\\"), file, i, PWI_EXTENSION);

        f = _wfopen(localFile, TEXT("r"));

        if (f == NULL) {
            wsprintf(fileName, localFile);
            break;
        }
        fflush(f);
        fclose(f);

        i++;
    } while(1);
    LOG.debug("uniqueFileEnd");
}



void UTCToLocalTime(SYSTEMTIME &sysTime)
{
     FILETIME LocalFileTime, SystemFileTime;
     SystemTimeToFileTime(&sysTime, &SystemFileTime);
     FileTimeToLocalFileTime(&SystemFileTime, &LocalFileTime);
     FileTimeToSystemTime(&LocalFileTime, &sysTime);
}

void localTimeToUTC(SYSTEMTIME &sysTime)
{
     FILETIME LocalFileTime, SystemFileTime;
     SystemTimeToFileTime(&sysTime, &LocalFileTime);
     LocalFileTimeToFileTime(&LocalFileTime, &SystemFileTime);
     FileTimeToSystemTime(&SystemFileTime, &sysTime);

     /*LPTIME_ZONE_INFORMATION lpTimeZoneInformation;
     GetTimeZoneInformation(lpTimeZoneInformation);*/

}

void SafeGetTimeZoneInformation(TIME_ZONE_INFORMATION *ptzi) {

   ZeroMemory(ptzi, sizeof(TIME_ZONE_INFORMATION));

   // Ask the OS for the standard/daylight rules for the current time zone.
   if ((GetTimeZoneInformation(ptzi) == 0xFFFFFFFF) ||
       (ptzi->StandardDate.wMonth > 12) || (ptzi->DaylightDate.wMonth > 12))
   {
      // If the OS fails us, we default to the United States' rules.
      ZeroMemory(ptzi, sizeof(TIME_ZONE_INFORMATION));
      ptzi->StandardDate.wMonth =  10;  // October
      ptzi->StandardDate.wDay   =   5;  // Last Sunday (DOW == 0)
      ptzi->StandardDate.wHour  =   2;  // At 2:00 AM
      ptzi->DaylightBias        = -60;  // One hour difference
      ptzi->DaylightDate.wMonth =   4;  // April
      ptzi->DaylightDate.wDay   =   1;  // First Sunday (DOW == 0)
      ptzi->DaylightDate.wHour  =   2;  // At 2:00 AM
   }
}


time_t GetTransitionTimeT(TIME_ZONE_INFORMATION *ptzi, int year, BOOL fStartDST) {

   // We only handle years within the range that time_t supports.  We need to
   // handle the very end of 1969 since the local time could be up to 13 hours
   // into the previous year.  In this case, our code will actually return a
   // negative value, but it will be compared to another negative value and is
   // handled correctly.  The same goes for the 13 hours past a the max time_t
   // value of 0x7FFFFFFF (in the year 2038).  Again, these values are handled
   // correctly as well.

   if ((year < 1969) || (year > 2038)) {
      return (time_t)0;
   }

   SYSTEMTIME *pst = fStartDST ? &ptzi->DaylightDate : &ptzi->StandardDate;

   // WORD wYear          Year (0000 == 0)
   // WORD wMonth         Month (January == 1)
   // WORD wDayOfWeek     Day of week (Sunday == 0)
   // WORD wDay           Month day (1 - 31)
   // WORD wHour          Hour (0 - 23)
   // WORD wMinute        Minute (0 - 59)
   // WORD wSecond        Second (0 - 59)
   // WORD wMilliseconds  Milliseconds (0 - 999)

   // Compute the number of days since 1/1/1970 to the beginning of this year.
   long daysToYear = ((year - 1970) * 365) // Tally up previous years.
                   + ((year - 1969) >> 2); // Add few extra for the leap years.

   // Compute the number of days since the beginning of this year to the
   // beginning of the month.  We will add to this value to get the actual
   // year day.
   long yearDay = IS_LEAP_YEAR(year) ? M2LYD[pst->wMonth - 1] :
                                       M2YD [pst->wMonth - 1];

   // Check for day-in-month format.
   if (pst->wYear == 0) {

      // Compute the week day for the first day of the month (Sunday == 0).
      long monthDOW = (daysToYear + yearDay + BASE_DOW) % 7;

      // Add the day offset of the transition day to the year day.
      if (monthDOW < pst->wDayOfWeek) {
         yearDay += (pst->wDayOfWeek - monthDOW) + (pst->wDay - 1) * 7;
      } else {
         yearDay += (pst->wDayOfWeek - monthDOW) + pst->wDay * 7;
      }

      // It is possible that we overshot the month, especially if pst->wDay
      // is 5 (which means the last instance of the day in the month). Check
      // if the year-day has exceeded the month and adjust accordingly.
      if ((pst->wDay == 5) &&
          (yearDay >= (IS_LEAP_YEAR(year) ? M2LYD[pst->wMonth] :
                                            M2YD [pst->wMonth])))
      {
         yearDay -= 7;
      }

   // If not day-in-month format, then we assume an absolute date.
   } else {

      // Simply add the month day to the current year day.
      yearDay += pst->wDay - 1;
   }

   // Tally up all our days, hours, minutes, and seconds since 1970.
   long seconds = ((SECONDS_IN_A_DAY * (daysToYear + yearDay)) +
                   (3600L * (long)pst->wHour) +
                   (60L * (long)pst->wMinute) +
                   (long)pst->wSecond);

   // If we are checking for the end of DST, then we need to add the DST bias
   // since we are in DST when we chack this time stamp.
   if (!fStartDST) {
      seconds += ptzi->DaylightBias * 60L;
   }

   return (time_t)seconds;
}


BOOL IsDST(TIME_ZONE_INFORMATION *ptzi, time_t localTime) {

   // If either of the months is 0, then this usually means that the time zone
   // does not use DST.
   if ((ptzi->StandardDate.wMonth == 0) || (ptzi->DaylightDate.wMonth == 0)) {
      return FALSE;
   }

   // time_t   is a 32-bit value for the seconds since January 1, 1970
   // FILETIME is a 64-bit value for the number of 100-nanosecond intervals
   //          since January 1, 1601

   // Compute the FILETIME for the given local time.
   DWORDLONG dwl = ((DWORDLONG)116444736000000000 +
                   ((DWORDLONG)localTime * (DWORDLONG)10000000));
   FILETIME ft = *(FILETIME*)&dwl;

   // Convert the FILETIME to a SYSTEMTIME.
   SYSTEMTIME st;
   ZeroMemory(&st, sizeof(st));
   FileTimeToSystemTime(&ft, &st);

   // Get our start and end daylight savings times.
   time_t timeStart = GetTransitionTimeT(ptzi, (int)st.wYear, TRUE);
   time_t timeEnd   = GetTransitionTimeT(ptzi, (int)st.wYear, FALSE);

   // Check what hemisphere we are in.
   if (timeStart < timeEnd) {

      // Northern hemisphere ordering.
      return ((localTime >= timeStart) && (localTime < timeEnd));

   } else if (timeStart > timeEnd) {

      // Southern hemisphere ordering.
      return ((localTime < timeEnd) || (localTime >= timeStart));
   }

   // If timeStart equals timeEnd then this time zone does not support DST.
   return FALSE;
}

BOOL IsTzInDstChangingList(WCHAR* dstName)
{
    if (wcsicmp(dstName, TZ_ALASKA) == 0)
       return TRUE;
    if (wcsicmp(dstName, TZ_CENTRAL_US) == 0)
       return TRUE;
    if (wcsicmp(dstName, TZ_EASTERN_US) == 0)
       return TRUE;
    if (wcsicmp(dstName, TZ_MOUNTAIN) == 0)
       return TRUE;
    if (wcsicmp(dstName, TZ_PACIFIC_US) == 0)
       return TRUE;

    return FALSE;
}

BOOL IsDateAfterDstChanging(SYSTEMTIME& date)
{
    if (date.wYear >= 2007)
        return TRUE;
    else
        return FALSE;
}

time_t GetLocalTimeT()
{
    SYSTEMTIME currentSysTime;
    FILETIME currentFileTime;
    GetLocalTime(&currentSysTime);
    SystemTimeToFileTime(&currentSysTime, &currentFileTime);
    FILETIME currentFt= currentFileTime;
    __int64 llCurrent = 0;
    memcpy (&llCurrent, &currentFt, sizeof (__int64));
    llCurrent = (llCurrent - 116444736000000000) / 10000000;
    time_t currentT = (time_t) llCurrent;
    return currentT;
}


void UTCToLocalTime2(SYSTEMTIME &sysTime) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
5566中文字幕一区二区电影| 欧美精三区欧美精三区| 亚洲国产综合91精品麻豆| 884aa四虎影成人精品一区| 成人污污视频在线观看| 免费日韩伦理电影| 一区二区三区蜜桃网| 久久久99免费| 欧美一级片在线看| 色综合色综合色综合| 国产麻豆精品在线| 日韩高清在线不卡| 亚洲美女偷拍久久| 国产精品久久夜| 欧美sm美女调教| 欧美挠脚心视频网站| 91最新地址在线播放| 盗摄精品av一区二区三区| 免费欧美在线视频| 日韩专区中文字幕一区二区| 亚洲女人****多毛耸耸8| 国产女主播视频一区二区| 欧美tickle裸体挠脚心vk| 91精品国产入口| 欧美自拍偷拍一区| 91丨九色丨尤物| 成人av综合在线| 国产精品一级二级三级| 国产一区日韩二区欧美三区| 九九视频精品免费| 裸体健美xxxx欧美裸体表演| 日韩国产精品久久久| 亚洲成人一区二区在线观看| 一区二区三区四区在线免费观看 | 中文字幕一区二区三区不卡在线 | 欧美综合天天夜夜久久| 91蝌蚪porny成人天涯| 菠萝蜜视频在线观看一区| jlzzjlzz亚洲日本少妇| 不卡区在线中文字幕| 国产suv一区二区三区88区| 国产高清精品久久久久| 国产寡妇亲子伦一区二区| 国产精品一区三区| 国产91色综合久久免费分享| 国产乱淫av一区二区三区 | 欧美日韩国产影片| 欧美日韩久久一区| 日韩视频在线你懂得| 欧美成人综合网站| 久久这里只有精品6| 久久久夜色精品亚洲| 国产精品网站在线| 亚洲欧美国产三级| 亚洲午夜在线视频| 蜜桃久久久久久| 激情综合五月婷婷| 懂色一区二区三区免费观看| 国产成人免费高清| 色综合久久综合网97色综合| 欧美最猛性xxxxx直播| 91精品国产aⅴ一区二区| 精品日韩av一区二区| 国产欧美日韩激情| 一区二区三区在线高清| 免费一区二区视频| 福利一区二区在线| 色狠狠色狠狠综合| 欧美成人免费网站| 一区免费观看视频| 日韩精品久久理论片| 国产一区福利在线| 色激情天天射综合网| 日韩欧美一区二区视频| 国产精品久久久久婷婷| 亚洲一区二区四区蜜桃| 狠狠色丁香久久婷婷综合丁香| 国产91丝袜在线观看| 欧美探花视频资源| 精品国产一区二区精华| 亚洲丝袜自拍清纯另类| 午夜国产不卡在线观看视频| 国产精品综合一区二区三区| 色偷偷成人一区二区三区91| 日韩一区二区免费视频| 国产精品免费网站在线观看| 亚洲午夜在线视频| 粉嫩av亚洲一区二区图片| 欧美日韩一二三| 国产精品免费人成网站| 丝袜美腿一区二区三区| 波多野结衣在线一区| 日韩小视频在线观看专区| 亚洲婷婷综合久久一本伊一区 | 国产在线精品免费| 欧洲在线/亚洲| 国产视频一区不卡| 日日夜夜免费精品| 成人国产精品视频| 精品久久人人做人人爱| 亚洲高清一区二区三区| 成人污视频在线观看| 精品日韩av一区二区| 天天色天天爱天天射综合| 97久久精品人人做人人爽50路| www久久精品| 日韩av一区二区在线影视| 欧美综合欧美视频| 亚洲三级久久久| 成人综合激情网| 精品久久久久久亚洲综合网 | 日韩不卡免费视频| 在线观看日产精品| 欧美经典三级视频一区二区三区| 免费看欧美女人艹b| 欧美日韩免费视频| 一区二区三区四区乱视频| 不卡的av电影在线观看| 国产亚洲一区二区三区四区| 久草在线在线精品观看| 欧美一区二区三区在线| 亚洲国产精品一区二区尤物区| 91亚洲资源网| 1000精品久久久久久久久| 国产不卡一区视频| 久久久亚洲国产美女国产盗摄 | 99这里只有精品| 国产精品乱码妇女bbbb| 国产成人精品综合在线观看| 久久免费美女视频| 激情综合色综合久久| 欧美一区二区黄| 日本欧美久久久久免费播放网| 欧美日韩高清一区二区| 亚洲午夜精品网| 欧美精品aⅴ在线视频| 五月天亚洲精品| 日韩无一区二区| 激情久久五月天| 久久久久久久综合色一本| 国产成人精品1024| 国产精品乱人伦| 一本一本大道香蕉久在线精品| 亚洲欧美成人一区二区三区| 欧美专区亚洲专区| 视频一区二区国产| 精品国产乱码久久久久久久久| 国内精品久久久久影院色| 国产欧美精品在线观看| av色综合久久天堂av综合| 亚洲欧美国产77777| 欧美人体做爰大胆视频| 另类小说图片综合网| 久久精品人人做| 99视频超级精品| 夜夜嗨av一区二区三区四季av| 欧美私模裸体表演在线观看| 青青草国产成人av片免费| 久久综合九色综合欧美就去吻| 国产麻豆精品theporn| 国产精品剧情在线亚洲| 在线观看一区二区视频| 美日韩黄色大片| 欧美国产精品v| 91国在线观看| 奇米一区二区三区| 国产精品网站在线播放| 欧美日韩在线三区| 国产一区美女在线| 亚洲色图欧洲色图婷婷| 911精品国产一区二区在线| 国产一区二区三区日韩| 亚洲日穴在线视频| 日韩一区二区三区四区| 成人免费视频播放| 亚洲高清免费观看| 久久久不卡影院| 欧美在线免费观看视频| 精品综合免费视频观看| 亚洲美女视频在线| 精品剧情在线观看| 色一区在线观看| 激情五月婷婷综合| 亚洲国产精品视频| 久久久99久久| 欧美日韩二区三区| 不卡的av在线播放| 久久av老司机精品网站导航| 亚洲欧洲制服丝袜| 久久综合九色综合97婷婷女人| 91美女蜜桃在线| 国内精品伊人久久久久影院对白| 亚洲男人的天堂网| 久久精品视频免费观看| 欧美日韩中文精品| av亚洲精华国产精华精| 麻豆91精品91久久久的内涵| 亚洲综合色噜噜狠狠| 国产精品毛片a∨一区二区三区| 日韩午夜av一区|