chromium/third_party/pdfium/core/fxcrt/fx_system.cpp

// Copyright 2017 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "core/fxcrt/fx_system.h"

#include <math.h>

#include <limits>

#include "build/build_config.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_extension.h"

namespace {

#if !BUILDFLAG(IS_WIN)
uint32_t g_last_error =;
#endif

template <typename IntType, typename CharType>
IntType FXSYS_StrToInt(const CharType* str) {}

template <typename T, typename UT, typename STR_T>
STR_T FXSYS_IntToStr(T value, STR_T str, int radix) {}

}  // namespace

int FXSYS_roundf(float f) {}

int FXSYS_round(double d) {}

int32_t FXSYS_atoi(const char* str) {}
uint32_t FXSYS_atoui(const char* str) {}
int32_t FXSYS_wtoi(const wchar_t* str) {}
int64_t FXSYS_atoi64(const char* str) {}
const char* FXSYS_i64toa(int64_t value, char* str, int radix) {}

#if BUILDFLAG(IS_WIN)

size_t FXSYS_wcsftime(wchar_t* strDest,
                      size_t maxsize,
                      const wchar_t* format,
                      const struct tm* timeptr) {
  // Avoid tripping an invalid parameter handler and crashing process.
  // Note: leap seconds may cause tm_sec == 60.
  if (timeptr->tm_year < -1900 || timeptr->tm_year > 8099 ||
      timeptr->tm_mon < 0 || timeptr->tm_mon > 11 || timeptr->tm_mday < 1 ||
      timeptr->tm_mday > 31 || timeptr->tm_hour < 0 || timeptr->tm_hour > 23 ||
      timeptr->tm_min < 0 || timeptr->tm_min > 59 || timeptr->tm_sec < 0 ||
      timeptr->tm_sec > 60 || timeptr->tm_wday < 0 || timeptr->tm_wday > 6 ||
      timeptr->tm_yday < 0 || timeptr->tm_yday > 365) {
    strDest[0] = L'\0';
    return 0;
  }
  return wcsftime(strDest, maxsize, format, timeptr);
}

int FXSYS_stricmp(const char* str1, const char* str2) {
  return _stricmp(str1, str2);
}

int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2) {
  return _wcsicmp(str1, str2);
}

#else   // BUILDFLAG(IS_WIN)

char* FXSYS_strlwr(char* str) {}

char* FXSYS_strupr(char* str) {}

wchar_t* FXSYS_wcslwr(wchar_t* str) {}

wchar_t* FXSYS_wcsupr(wchar_t* str) {}

int FXSYS_stricmp(const char* str1, const char* str2) {}

int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2) {}

char* FXSYS_itoa(int value, char* str, int radix) {}

void FXSYS_SetLastError(uint32_t err) {}

uint32_t FXSYS_GetLastError() {}
#endif  // BUILDFLAG(IS_WIN)

float FXSYS_sqrt2(float a, float b) {}