Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

some fixes for bug#54254

  • Loading branch information...
commit 0826d393703fa20aea2321d19a74532f52fe7117 1 parent dedc8f2
Stanislav Malyshev authored
4  ext/calendar/calendar.c
@@ -204,8 +204,8 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
204 204
 	 FrenchMonthName, FrenchMonthName}
205 205
 };
206 206
 
207  
-#define JEWISH_MONTH_NAME(year) 	((monthsPerYear[(year) % 19] == 13)?JewishMonthNameLeap:JewishMonthName)
208  
-#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName)
  207
+#define JEWISH_MONTH_NAME(year) 	((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthNameLeap:JewishMonthName)
  208
+#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName)
209 209
 
210 210
 /* For jddayofweek */
211 211
 enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
4  ext/calendar/jewish.c
@@ -86,7 +86,7 @@
86 86
  *          4 Tevet     29   29   29         29   29   29
87 87
  *          5 Shevat    30   30   30         30   30   30
88 88
  *          6 Adar I    --   --   --         30   30   30 (optional)
89  
- *          7 Adar II   29   29   29         29   29   29
  89
+ *          7 Adar (II) 29   29   29         29   29   29
90 90
  *          8 Nisan     30   30   30         30   30   30
91 91
  *          9 Iyyar     29   29   29         29   29   29
92 92
  *         10 Sivan     30   30   30         30   30   30
@@ -286,7 +286,7 @@
286 286
 #define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204)
287 287
 #define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589)
288 288
 
289  
-static int monthsPerYear[19] =
  289
+int monthsPerYear[19] =
290 290
 {
291 291
 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13
292 292
 };
3  ext/calendar/sdncal.h
@@ -79,7 +79,10 @@ long int JulianToSdn(int year, int month, int day);
79 79
 void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay);
80 80
 long int JewishToSdn(int year, int month, int day);
81 81
 extern char *JewishMonthName[14];
  82
+extern char *JewishMonthNameLeap[14];
82 83
 extern char *JewishMonthHebName[14];
  84
+extern char *JewishMonthHebNameLeap[14];
  85
+extern int monthsPerYear[19];
83 86
 
84 87
 /* French republic calendar conversions. */
85 88
 void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay);
4  ext/calendar/tests/jdmonthname.phpt
@@ -178,7 +178,7 @@ Heshvan
178 178
 Kislev
179 179
 Tevet
180 180
 Shevat
181  
-AdarI
  181
+Adar
182 182
 Nisan
183 183
 Iyyar
184 184
 Sivan
@@ -279,7 +279,7 @@ Heshvan
279 279
 Kislev
280 280
 Tevet
281 281
 Shevat
282  
-AdarI
  282
+Adar
283 283
 Nisan
284 284
 Iyyar
285 285
 Sivan
8  ext/calendar/tests/jdtojewish.phpt
@@ -14,10 +14,11 @@ var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n".
14 14
 	jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
15 15
 	jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
16 16
 	jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n".
17  
-	jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n");
  17
+	jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
  18
+	jdtojewish(gregoriantojd(3,10,2007))."\r\n");
18 19
 ?>
19  
---EXPECT--
20  
-string(184) "2/22/5763
  20
+--EXPECTF--
  21
+string(%d) "2/22/5763
21 22
 ëá çùåï äúùñâ
22 23
 ëá çùåï ä'úùñâ
23 24
 ëá çùåï ä àìôéí úùñâ
@@ -27,4 +28,5 @@ string(184) "2/22/5763
27 28
 á' çùåï ä'úùñ"â
28 29
 á' çùåï ä àìôéí úùñ"â
29 30
 á' çùåï ä' àìôéí úùñ"â
  31
+7/20/5767
30 32
 "

0 notes on commit 0826d39

Please sign in to comment.
Something went wrong with that request. Please try again.