Remove unused js_DateSetXXX API. Bug 524179, r=brendan.
authorSaint Wesonga <wesongathedeveloper@yahoo.com>
Tue, 07 Dec 2010 12:46:19 -0600
changeset 58982 1eceb7866d063acefe8ff1c8ef2c5ac348506985
parent 58981 83858adedebcbdd7bc36d3ec526cb01aad496e38
child 58983 3525f819579259736440a653ece333b463afd50b
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbrendan
bugs524179
milestone2.0b8pre
Remove unused js_DateSetXXX API. Bug 524179, r=brendan.
js/src/jsdate.cpp
js/src/jsdate.h
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -2650,145 +2650,16 @@ js_DateGetSeconds(JSContext *cx, JSObjec
     jsdouble utctime;
 
     if (!GetUTCTime(cx, obj, NULL, &utctime) || JSDOUBLE_IS_NaN(utctime))
         return 0;
 
     return (int) SecFromTime(utctime);
 }
 
-JS_FRIEND_API(void)
-js_DateSetYear(JSContext *cx, JSObject *obj, int year)
-{
-    jsdouble local;
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    /* reset date if it was NaN */
-    if (JSDOUBLE_IS_NaN(local))
-        local = 0;
-
-    local = date_msecFromDate(year,
-                              MonthFromTime(local),
-                              DateFromTime(local),
-                              HourFromTime(local),
-                              MinFromTime(local),
-                              SecFromTime(local),
-                              msFromTime(local));
-
-    /* SetUTCTime also invalidates local time cache. */
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
-JS_FRIEND_API(void)
-js_DateSetMonth(JSContext *cx, JSObject *obj, int month)
-{
-    jsdouble local;
-
-    JS_ASSERT(month < 12);
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    /* bail if date was NaN */
-    if (JSDOUBLE_IS_NaN(local))
-        return;
-
-    local = date_msecFromDate(YearFromTime(local),
-                              month,
-                              DateFromTime(local),
-                              HourFromTime(local),
-                              MinFromTime(local),
-                              SecFromTime(local),
-                              msFromTime(local));
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
-JS_FRIEND_API(void)
-js_DateSetDate(JSContext *cx, JSObject *obj, int date)
-{
-    jsdouble local;
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    if (JSDOUBLE_IS_NaN(local))
-        return;
-
-    local = date_msecFromDate(YearFromTime(local),
-                              MonthFromTime(local),
-                              date,
-                              HourFromTime(local),
-                              MinFromTime(local),
-                              SecFromTime(local),
-                              msFromTime(local));
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
-JS_FRIEND_API(void)
-js_DateSetHours(JSContext *cx, JSObject *obj, int hours)
-{
-    jsdouble local;
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    if (JSDOUBLE_IS_NaN(local))
-        return;
-    local = date_msecFromDate(YearFromTime(local),
-                              MonthFromTime(local),
-                              DateFromTime(local),
-                              hours,
-                              MinFromTime(local),
-                              SecFromTime(local),
-                              msFromTime(local));
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
-JS_FRIEND_API(void)
-js_DateSetMinutes(JSContext *cx, JSObject *obj, int minutes)
-{
-    jsdouble local;
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    if (JSDOUBLE_IS_NaN(local))
-        return;
-    local = date_msecFromDate(YearFromTime(local),
-                              MonthFromTime(local),
-                              DateFromTime(local),
-                              HourFromTime(local),
-                              minutes,
-                              SecFromTime(local),
-                              msFromTime(local));
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
-JS_FRIEND_API(void)
-js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds)
-{
-    jsdouble local;
-
-    if (!GetAndCacheLocalTime(cx, obj, NULL, &local))
-        return;
-
-    if (JSDOUBLE_IS_NaN(local))
-        return;
-    local = date_msecFromDate(YearFromTime(local),
-                              MonthFromTime(local),
-                              DateFromTime(local),
-                              HourFromTime(local),
-                              MinFromTime(local),
-                              seconds,
-                              msFromTime(local));
-    SetUTCTime(cx, obj, UTC(local, cx));
-}
-
 JS_FRIEND_API(jsdouble)
 js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj)
 {
     jsdouble utctime;
     if (!GetUTCTime(cx, obj, NULL, &utctime))
         return 0;
     return utctime;
 }
--- a/js/src/jsdate.h
+++ b/js/src/jsdate.h
@@ -74,17 +74,17 @@ js_InitDateClass(JSContext *cx, JSObject
 extern JS_FRIEND_API(JSObject*)
 js_NewDateObjectMsec(JSContext* cx, jsdouble msec_time);
 
 /*
  * Construct a new Date Object from an exploded local time value.
  *
  * Assert that mon < 12 to help catch off-by-one user errors, which are common
  * due to the 0-based month numbering copied into JS from Java (java.util.Date
- * in 1995). js_DateSetMonth (below) likewise asserts month < 12.
+ * in 1995).
  */
 extern JS_FRIEND_API(JSObject*)
 js_NewDateObject(JSContext* cx, int year, int mon, int mday,
                  int hour, int min, int sec);
 
 /*
  * Detect whether the internal date value is NaN.  (Because failure is
  * out-of-band for js_DateGet*)
@@ -105,34 +105,16 @@ extern JS_FRIEND_API(int)
 js_DateGetHours(JSContext *cx, JSObject* obj);
 
 extern JS_FRIEND_API(int)
 js_DateGetMinutes(JSContext *cx, JSObject* obj);
 
 extern JS_FRIEND_API(int)
 js_DateGetSeconds(JSContext *cx, JSObject* obj);
 
-extern JS_FRIEND_API(void)
-js_DateSetYear(JSContext *cx, JSObject *obj, int year);
-
-extern JS_FRIEND_API(void)
-js_DateSetMonth(JSContext *cx, JSObject *obj, int month);
-
-extern JS_FRIEND_API(void)
-js_DateSetDate(JSContext *cx, JSObject *obj, int date);
-
-extern JS_FRIEND_API(void)
-js_DateSetHours(JSContext *cx, JSObject *obj, int hours);
-
-extern JS_FRIEND_API(void)
-js_DateSetMinutes(JSContext *cx, JSObject *obj, int minutes);
-
-extern JS_FRIEND_API(void)
-js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds);
-
 extern JS_FRIEND_API(jsdouble)
 js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj);
 
 typedef uint32 JSIntervalTime;
 
 extern JS_FRIEND_API(JSIntervalTime)
 js_IntervalNow();