mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Fix some minor static buffer overruns detected by Coverity tool, and sync two versions of catttable.h. b=287290 r+sr=brendan
This commit is contained in:
parent
11264fa2a1
commit
cda2b96b0e
@ -40,7 +40,7 @@
|
||||
*/
|
||||
#include "nscore.h"
|
||||
|
||||
static PRUint8 gGenCatIdx1[224] = {
|
||||
static const PRUint8 gGenCatIdx1[224] = {
|
||||
0, // U+0000 - U+0007 : 0x44444444
|
||||
0, // U+0008 - U+000F : 0x44444444
|
||||
0, // U+0010 - U+0017 : 0x44444444
|
||||
@ -267,7 +267,7 @@ static PRUint8 gGenCatIdx1[224] = {
|
||||
62, // U+06F8 - U+06FF : 0x00000022
|
||||
};
|
||||
|
||||
static PRUint8 gGenCatIdx2[288] = {
|
||||
static const PRUint8 gGenCatIdx2[288] = {
|
||||
63, // U+0900 - U+0907 : 0x55501110
|
||||
6, // U+0908 - U+090F : 0x55555555
|
||||
6, // U+0910 - U+0917 : 0x55555555
|
||||
@ -558,7 +558,7 @@ static PRUint8 gGenCatIdx2[288] = {
|
||||
43, // U+11F8 - U+11FF : 0x00000055
|
||||
};
|
||||
|
||||
static PRUint8 gGenCatIdx3[320] = {
|
||||
static const PRUint8 gGenCatIdx3[320] = {
|
||||
6, // U+1E00 - U+1E07 : 0x55555555
|
||||
6, // U+1E08 - U+1E0F : 0x55555555
|
||||
6, // U+1E10 - U+1E17 : 0x55555555
|
||||
@ -881,7 +881,7 @@ static PRUint8 gGenCatIdx3[320] = {
|
||||
17, // U+27F8 - U+27FF : 0x00000000
|
||||
};
|
||||
|
||||
static PRUint8 gGenCatIdx4[128] = {
|
||||
static const PRUint8 gGenCatIdx4[128] = {
|
||||
171, // U+3000 - U+3007 : 0x25576663
|
||||
125, // U+3008 - U+300F : 0x66666666
|
||||
172, // U+3010 - U+3017 : 0x66667766
|
||||
@ -1012,7 +1012,7 @@ static PRUint8 gGenCatIdx4[128] = {
|
||||
22, // U+33F8 - U+33FF : 0x07777777
|
||||
};
|
||||
|
||||
static PRUint8 gGenCatIdx5[224] = {
|
||||
static const PRUint8 gGenCatIdx5[224] = {
|
||||
6, // U+F900 - U+F907 : 0x55555555
|
||||
6, // U+F908 - U+F90F : 0x55555555
|
||||
6, // U+F910 - U+F917 : 0x55555555
|
||||
@ -1451,31 +1451,31 @@ static PRUint8 GetCat(PRUnichar u)
|
||||
//
|
||||
// Handle U+0000 to U+06FF
|
||||
if( (u<=((PRUnichar)0x06FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx1 [( u -(PRUnichar) 0x0000 )/8]];
|
||||
pat = gGenCatPat[gGenCatIdx1 [( u -(PRUnichar) 0x0000 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+0900 to U+11FF
|
||||
if((((PRUnichar)0x0900)<=u)&&(u<=((PRUnichar)0x11FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx2 [( u -(PRUnichar) 0x0900 )/8]];
|
||||
pat = gGenCatPat[gGenCatIdx2 [( u -(PRUnichar) 0x0900 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+1E00 to U+27FF
|
||||
if((((PRUnichar)0x1E00)<=u)&&(u<=((PRUnichar)0x27FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx3 [( u -(PRUnichar) 0x1E00 )/8]];
|
||||
pat = gGenCatPat[gGenCatIdx3 [( u -(PRUnichar) 0x1E00 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+3000 to U+33FF
|
||||
if((((PRUnichar)0x3000)<=u)&&(u<=((PRUnichar)0x33FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx4 [( u -(PRUnichar) 0x3000 )/8]];
|
||||
pat = gGenCatPat[gGenCatIdx4 [( u -(PRUnichar) 0x3000 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+F900 to U+FFFF
|
||||
if((((PRUnichar)0xF900)<=u)&&(u<=((PRUnichar)0xFFFF))) {
|
||||
pat = gGenCatPat[gGenCatIdx5 [( u -(PRUnichar) 0xF900 )/8]];
|
||||
pat = gGenCatPat[gGenCatIdx5 [( u -(PRUnichar) 0xF900 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ void txDecimalCounter::appendNumber(PRInt32 aNumber, nsAString& aDest)
|
||||
|
||||
void txAlphaCounter::appendNumber(PRInt32 aNumber, nsAString& aDest)
|
||||
{
|
||||
PRUnichar buf[11];
|
||||
PRUnichar buf[12];
|
||||
buf[11] = 0;
|
||||
PRInt32 pos = 11;
|
||||
while (aNumber > 0) {
|
||||
|
@ -653,11 +653,11 @@ PRInt32 i, ch;
|
||||
ungetc (ch, mAFMFile);
|
||||
|
||||
// Read to the end of the line.
|
||||
for (i = 0, ch = getc (mAFMFile);((PRUint32)i) < sizeof (mToken) && ch != EOF && ch != '\n';i++, ch = getc (mAFMFile)){
|
||||
for (i = 0, ch = getc (mAFMFile);((PRUint32)i) < sizeof (mToken) - 1 && ch != EOF && ch != '\n';i++, ch = getc (mAFMFile)){
|
||||
mToken[i] = ch;
|
||||
}
|
||||
|
||||
if (((PRUint32)i) >= sizeof (mToken)){
|
||||
if (((PRUint32)i) >= sizeof (mToken) - 1){
|
||||
//parse_error (handle, AFM_ERROR_SYNTAX);
|
||||
}
|
||||
|
||||
|
@ -1603,7 +1603,7 @@ xxlib_rgb_preprocess_dm_565 (XlibRgbHandle *handle)
|
||||
handle->DM_565 = malloc(sizeof(uint32) * DM_WIDTH * DM_HEIGHT);
|
||||
for (i = 0; i < DM_WIDTH * DM_HEIGHT; i++)
|
||||
{
|
||||
dith = DM[0][i] >> 3;
|
||||
dith = DM[i / DM_WIDTH][i % DM_WIDTH] >> 3;
|
||||
handle->DM_565[i] = (dith << 20) | dith | (((7 - dith) >> 1) << 10);
|
||||
#ifdef VERBOSE
|
||||
printf ("%i %x %x\n", i, dith, handle->DM_565[i]);
|
||||
|
@ -22,8 +22,8 @@
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
@ -1451,31 +1451,31 @@ static PRUint8 GetCat(PRUnichar u)
|
||||
//
|
||||
// Handle U+0000 to U+06FF
|
||||
if( (u<=((PRUnichar)0x06FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx1 [( u -(PRUnichar) 0x0000 )]];
|
||||
pat = gGenCatPat[gGenCatIdx1 [( u -(PRUnichar) 0x0000 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+0900 to U+11FF
|
||||
if((((PRUnichar)0x0900)<=u)&&(u<=((PRUnichar)0x11FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx2 [( u -(PRUnichar) 0x0900 )]];
|
||||
pat = gGenCatPat[gGenCatIdx2 [( u -(PRUnichar) 0x0900 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+1E00 to U+27FF
|
||||
if((((PRUnichar)0x1E00)<=u)&&(u<=((PRUnichar)0x27FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx3 [( u -(PRUnichar) 0x1E00 )]];
|
||||
pat = gGenCatPat[gGenCatIdx3 [( u -(PRUnichar) 0x1E00 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+3000 to U+33FF
|
||||
if((((PRUnichar)0x3000)<=u)&&(u<=((PRUnichar)0x33FF))) {
|
||||
pat = gGenCatPat[gGenCatIdx4 [( u -(PRUnichar) 0x3000 )]];
|
||||
pat = gGenCatPat[gGenCatIdx4 [( u -(PRUnichar) 0x3000 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
// Handle U+F900 to U+FFFF
|
||||
if((((PRUnichar)0xF900)<=u)&&(u<=((PRUnichar)0xFFFF))) {
|
||||
pat = gGenCatPat[gGenCatIdx5 [( u -(PRUnichar) 0xF900 )]];
|
||||
pat = gGenCatPat[gGenCatIdx5 [( u -(PRUnichar) 0xF900 ) / 8]];
|
||||
return (pat >> ((u % 8) * 4)) & 0x0F;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ for($t = 1; $t <= $tt; $t++)
|
||||
$th = $range[($t-1) * 2 + 1];
|
||||
printf OUT " // Handle U+%04X to U+%04X\n", $tl, $th;
|
||||
printf OUT " if((((PRUnichar)0x%04X)<=u)&&(u<=((PRUnichar)0x%04X))) {\n", $tl, $th;
|
||||
printf OUT " pat = gGenCatPat[gGenCatIdx%d [( u -(PRUnichar) 0x%04X )]];\n", $t, $tl;
|
||||
printf OUT " pat = gGenCatPat[gGenCatIdx%d [( u -(PRUnichar) 0x%04X ) / 8]];\n", $t, $tl;
|
||||
printf OUT " return (pat >> ((u % 8) * 4)) & 0x0F;\n";
|
||||
printf OUT " }\n\n";
|
||||
}
|
||||
|
@ -1226,6 +1226,7 @@ GdkCursor *nsWindow::GtkCreateCursor(nsCursor aCursorType)
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(aCursorType, "Invalid cursor type");
|
||||
gdkcursor = gdk_cursor_new(GDK_LEFT_PTR);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user