mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Fix alignment problem with DB reads.
r= davidm@netscape.com, wtc@netscape.com #= 38884
This commit is contained in:
parent
b04ffa4153
commit
7115e67255
4
netwerk/cache/filecache/Makefile.in
vendored
4
netwerk/cache/filecache/Makefile.in
vendored
@ -56,9 +56,5 @@ EXTRA_LIBS = $(NSPR_LIBS)
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
OS_CXXFLAGS += +u1
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
9
netwerk/cache/filecache/nsDBAccessor.cpp
vendored
9
netwerk/cache/filecache/nsDBAccessor.cpp
vendored
@ -113,13 +113,14 @@ nsDBAccessor::Init(nsIFile* dbfile)
|
||||
|
||||
if(status == 0) {
|
||||
// get the last session id
|
||||
PRInt16 *old_ID = NS_STATIC_CAST(PRInt16*, db_data.data) ;
|
||||
if(*old_ID < ini_sessionID) {
|
||||
PRInt16 old_ID;
|
||||
memcpy(&old_ID, db_data.data, sizeof(PRInt16));
|
||||
if(old_ID < ini_sessionID) {
|
||||
NS_ERROR("ERROR: Bad Session ID in database, corrupted db.") ;
|
||||
return NS_ERROR_FAILURE ;
|
||||
}
|
||||
|
||||
mSessionID = *old_ID + 1 ;
|
||||
mSessionID = old_ID + 1 ;
|
||||
}
|
||||
else if(status == 1) {
|
||||
// must be a new db
|
||||
@ -254,7 +255,7 @@ nsDBAccessor::GetID(const char* key, PRUint32 length, PRInt32* aID)
|
||||
int status = (*mDB->get)(mDB, &db_key, &db_data, 0) ;
|
||||
if(status == 0) {
|
||||
// found recordID
|
||||
*aID = *(NS_REINTERPRET_CAST(PRInt32*, db_data.data)) ;
|
||||
memcpy(aID, db_data.data, sizeof(PRInt32));
|
||||
return NS_OK ;
|
||||
}
|
||||
else if(status == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user