misc/liblua/llex.c
branchhedgeroid
changeset 6039 d75329716a02
parent 2812 0a24853de796
child 10017 de822cd3df3a
equal deleted inserted replaced
6037:8cdc7bc3e38c 6039:d75329716a02
   174 }
   174 }
   175 
   175 
   176 
   176 
   177 static void trydecpoint (LexState *ls, SemInfo *seminfo) {
   177 static void trydecpoint (LexState *ls, SemInfo *seminfo) {
   178   /* format error: try to update decimal point separator */
   178   /* format error: try to update decimal point separator */
       
   179 #ifndef ANDROID
   179   struct lconv *cv = localeconv();
   180   struct lconv *cv = localeconv();
       
   181 #endif
   180   char old = ls->decpoint;
   182   char old = ls->decpoint;
       
   183 #ifdef ANDROID
       
   184   ls->decpoint = '.';
       
   185 #else
   181   ls->decpoint = (cv ? cv->decimal_point[0] : '.');
   186   ls->decpoint = (cv ? cv->decimal_point[0] : '.');
       
   187 #endif
   182   buffreplace(ls, old, ls->decpoint);  /* try updated decimal separator */
   188   buffreplace(ls, old, ls->decpoint);  /* try updated decimal separator */
   183   if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
   189   if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
   184     /* format error with correct decimal point: no more options */
   190     /* format error with correct decimal point: no more options */
   185     buffreplace(ls, ls->decpoint, '.');  /* undo change (for error message) */
   191     buffreplace(ls, ls->decpoint, '.');  /* undo change (for error message) */
   186     luaX_lexerror(ls, "malformed number", TK_NUMBER);
   192     luaX_lexerror(ls, "malformed number", TK_NUMBER);