Bug 584580: Delete some unused code imported from chromium. r=bent

This commit is contained in:
Chris Jones 2010-08-05 17:11:23 -05:00
Родитель e14520565f
Коммит 74f1ca4d2c
7 изменённых файлов: 8 добавлений и 4481 удалений

Просмотреть файл

@ -64,7 +64,6 @@ endif # }
vpath %.cc \
$(srcdir)/src/base \
$(srcdir)/src/base/third_party/dmg_fp \
$(srcdir)/src/base/third_party/nspr \
$(srcdir)/src/base/third_party/nss \
$(srcdir)/src/chrome/common \
@ -79,8 +78,6 @@ include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
CPPSRCS += \
dtoa.cc \
g_fmt.cc \
prtime.cc \
at_exit.cc \
base_paths.cc \

Просмотреть файл

@ -23,7 +23,9 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/singleton.h"
#ifndef CHROMIUM_MOZILLA_BUILD
#include "base/third_party/dmg_fp/dmg_fp.h"
#endif
namespace {
@ -247,6 +249,7 @@ class HexString16ToLongTraits {
}
};
#ifndef CHROMIUM_MOZILLA_BUILD
class StringToDoubleTraits {
public:
typedef std::string string_type;
@ -285,6 +288,7 @@ class String16ToDoubleTraits {
return !str.empty() && !iswspace(str[0]);
}
};
#endif
} // namespace
@ -1105,6 +1109,7 @@ std::wstring Uint64ToWString(uint64 value) {
IntToString(value);
}
#ifndef CHROMIUM_MOZILLA_BUILD
std::string DoubleToString(double value) {
// According to g_fmt.cc, it is sufficient to declare a buffer of size 32.
char buffer[32];
@ -1115,6 +1120,7 @@ std::string DoubleToString(double value) {
std::wstring DoubleToWString(double value) {
return ASCIIToWide(DoubleToString(value));
}
#endif
void StringAppendV(std::string* dst, const char* format, va_list ap) {
StringAppendVT(dst, format, ap);
@ -1644,6 +1650,7 @@ int HexStringToInt(const string16& value) {
return result;
}
#ifndef CHROMIUM_MOZILLA_BUILD
bool StringToDouble(const std::string& input, double* output) {
return StringToNumber<StringToDoubleTraits>(input, output);
}
@ -1663,6 +1670,7 @@ double StringToDouble(const string16& value) {
StringToDouble(value, &result);
return result;
}
#endif
// The following code is compatible with the OpenBSD lcpy interface. See:
// http://www.gratisoft.us/todd/papers/strlcpy.html

Просмотреть файл

@ -1,15 +0,0 @@
This directory contains David M. Gay's floating point routines.
License can be found in individual .cc files.
Original dtoa.c file can be found at <http://www.netlib.org/fp/dtoa.c>.
Original g_fmt.c file can be found at <http://www.netlib.org/fp/g_fmt.c>.
You may be also interested in <http://www.netlib.org/fp/>.
List of changes made to original code:
- wrapped functions in dmg_fp namespace
- renamed .c files to .cc
- added dmg_fp.h header
- added #define IEEE_8087 to dtoa.cc
- added #define NO_HEX_FP to dtoa.cc
- made some minor changes to allow clean compilation under g++ -Wall, see
gcc_warnings.patch.

Просмотреть файл

@ -1,30 +0,0 @@
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_DMG_FP_H_
#define THIRD_PARTY_DMG_FP_H_
namespace dmg_fp {
// Return a nearest machine number to the input decimal
// string (or set errno to ERANGE). With IEEE arithmetic, ties are
// broken by the IEEE round-even rule. Otherwise ties are broken by
// biased rounding (add half and chop).
double strtod(const char* s00, char** se);
// Convert double to ASCII string. For meaning of parameters
// see dtoa.cc file.
char* dtoa(double d, int mode, int ndigits,
int* decpt, int* sign, char** rve);
// Must be used to free values returned by dtoa.
void freedtoa(char* s);
// Store the closest decimal approximation to x in b (null terminated).
// Returns a pointer to b. It is sufficient for |b| to be 32 characters.
char* g_fmt(char* b, double x);
} // namespace dmg_fp
#endif // THIRD_PARTY_DMG_FP_H_

4205
ipc/chromium/src/base/third_party/dmg_fp/dtoa.cc поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,102 +0,0 @@
/****************************************************************
*
* The author of this software is David M. Gay.
*
* Copyright (c) 1991, 1996 by Lucent Technologies.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
***************************************************************/
/* g_fmt(buf,x) stores the closest decimal approximation to x in buf;
* it suffices to declare buf
* char buf[32];
*/
#include "dmg_fp.h"
namespace dmg_fp {
char *
g_fmt(register char *b, double x)
{
register int i, k;
register char *s;
int decpt, j, sign;
char *b0, *s0, *se;
b0 = b;
#ifdef IGNORE_ZERO_SIGN
if (!x) {
*b++ = '0';
*b = 0;
goto done;
}
#endif
s = s0 = dtoa(x, 0, 0, &decpt, &sign, &se);
if (sign)
*b++ = '-';
if (decpt == 9999) /* Infinity or Nan */ {
while((*b++ = *s++));
goto done0;
}
if (decpt <= -4 || decpt > se - s + 5) {
*b++ = *s++;
if (*s) {
*b++ = '.';
while((*b = *s++))
b++;
}
*b++ = 'e';
/* sprintf(b, "%+.2d", decpt - 1); */
if (--decpt < 0) {
*b++ = '-';
decpt = -decpt;
}
else
*b++ = '+';
for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10);
for(;;) {
i = decpt / k;
*b++ = i + '0';
if (--j <= 0)
break;
decpt -= i*k;
decpt *= 10;
}
*b = 0;
}
else if (decpt <= 0) {
*b++ = '.';
for(; decpt < 0; decpt++)
*b++ = '0';
while((*b++ = *s++));
}
else {
while((*b = *s++)) {
b++;
if (--decpt == 0 && *s)
*b++ = '.';
}
for(; decpt > 0; decpt--)
*b++ = '0';
*b = 0;
}
done0:
freedtoa(s0);
#ifdef IGNORE_ZERO_SIGN
done:
#endif
return b0;
}
} // namespace dmg_fp

Просмотреть файл

@ -1,126 +0,0 @@
Index: dtoa.cc
--- dtoa.cc (old copy)
+++ dtoa.cc (working copy)
@@ -179,6 +179,9 @@
* used for input more than STRTOD_DIGLIM digits long (default 40).
*/
+#define IEEE_8087
+#define NO_HEX_FP
+
#ifndef Long
#define Long long
#endif
@@ -280,9 +283,7 @@
#include "math.h"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+namespace dmg_fp {
#ifndef CONST
#ifdef KR_headers
@@ -511,11 +512,9 @@
#define Kmax 7
-#ifdef __cplusplus
-extern "C" double strtod(const char *s00, char **se);
-extern "C" char *dtoa(double d, int mode, int ndigits,
+double strtod(const char *s00, char **se);
+char *dtoa(double d, int mode, int ndigits,
int *decpt, int *sign, char **rve);
-#endif
struct
Bigint {
@@ -1527,7 +1526,7 @@
#ifdef KR_headers
(sp, t) char **sp, *t;
#else
- (CONST char **sp, char *t)
+ (CONST char **sp, CONST char *t)
#endif
{
int c, d;
@@ -2234,7 +2234,7 @@ bigcomp
nd = bc->nd;
nd0 = bc->nd0;
p5 = nd + bc->e0 - 1;
- speccase = 0;
+ dd = speccase = 0;
#ifndef Sudden_Underflow
if (rv->d == 0.) { /* special case: value near underflow-to-zero */
/* threshold was rounded to zero */
@@ -3431,7 +3430,7 @@
j = sizeof(ULong);
for(k = 0;
- sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
+ sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
j <<= 1)
k++;
r = (int*)Balloc(k);
@@ -3447,7 +3446,7 @@
#ifdef KR_headers
nrv_alloc(s, rve, n) char *s, **rve; int n;
#else
-nrv_alloc(char *s, char **rve, int n)
+nrv_alloc(CONST char *s, char **rve, int n)
#endif
{
char *rv, *t;
@@ -4202,6 +4201,5 @@
*rve = s;
return s0;
}
-#ifdef __cplusplus
-}
-#endif
+
+} // namespace dmg_fp
Index: g_fmt.cc
--- g_fmt.cc (old copy)
+++ g_fmt.cc (new copy)
@@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
if (sign)
*b++ = '-';
if (decpt == 9999) /* Infinity or Nan */ {
- while(*b++ = *s++);
+ while((*b++ = *s++));
goto done0;
}
if (decpt <= -4 || decpt > se - s + 5) {
*b++ = *s++;
if (*s) {
*b++ = '.';
- while(*b = *s++)
+ while((*b = *s++))
b++;
}
*b++ = 'e';
@@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
*b++ = '.';
for(; decpt < 0; decpt++)
*b++ = '0';
- while(*b++ = *s++);
+ while((*b++ = *s++));
}
else {
- while(*b = *s++) {
+ while((*b = *s++)) {
b++;
if (--decpt == 0 && *s)
*b++ = '.';
@@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
}
done0:
freedtoa(s0);
+#ifdef IGNORE_ZERO_SIGN
done:
+#endif
return b0;
}