PR_ASSERT((amount > 0) && (amount < (int)sizeof(fin))); if (amount >= (int)sizeof(fin)) {  return 0;
if (prec == -1) { prec = 6; } else if (prec > 50) {   prec = 50;
static int cvt_f(SprintfState *ss, double d, const PRUnichar *fmt0, const PRUnichar *fmt1){    char fin[20];    char fout[300];    PRUnichar fout2[300];    int amount = fmt1 - fmt0;    int i;    PR_ASSERT((amount > 0) && (amount < (int)sizeof(fin)));    if (amount >= (int)sizeof(fin)) {	/* Totally bogus % command to sprintf. Just ignore it */	return 0;    }    for(i=0;i<amount;i++)      fin[i] = (char) fmt0[i]; // cast down here    fin[amount] = 0;    /* Convert floating point using the native sprintf code */#ifdef DEBUG    {        const char *p = fin;        while (*p) {            PR_ASSERT(*p != 'L');            p++;        }    }#endif    sprintf(fout, fin, d);    /*    ** This assert will catch overflow's of fout, when building with    ** debugging on. At least this way we can track down the evil piece    ** of calling code and fix it!    */    PR_ASSERT((nsCRT::strlen(fout)*2) < sizeof(fout));    for(i=0; fout[i]; i++)        fout2[i]=fout[i];    fout2[i] = 0;    return (*ss->stuff)(ss, fout2, nsCRT::strlen(fout2));}