8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:03:04 +01:00

Fixed inconsistent alignment beetween 32-bit and 64-bit replication sides

This commit is contained in:
Dmitry Yemanov 2019-04-01 17:35:14 +03:00
parent 1c96880660
commit 545d6b3fc8
2 changed files with 9 additions and 7 deletions

View File

@ -22,6 +22,7 @@
#include "firebird.h"
#include "ids.h"
#include "../jrd/align.h"
#include "../jrd/jrd.h"
#include "../jrd/blb.h"
#include "../jrd/req.h"
@ -103,7 +104,7 @@ namespace
SLONG getInt()
{
m_data = FB_ALIGN(m_data, FB_ALIGNMENT);
m_data = FB_ALIGN(m_data, type_alignments[dtype_long]);
const auto ptr = (const SLONG*) m_data;
m_data += sizeof(SLONG);
return *ptr;
@ -111,7 +112,7 @@ namespace
SINT64 getBigInt()
{
m_data = FB_ALIGN(m_data, FB_ALIGNMENT);
m_data = FB_ALIGN(m_data, type_alignments[dtype_int64]);
const auto ptr = (const SINT64*) m_data;
m_data += sizeof(SINT64);
return *ptr;

View File

@ -24,9 +24,10 @@
#ifndef JRD_REPLICATION_REPLICATOR_H
#define JRD_REPLICATION_REPLICATOR_H
#include "../../common/classes/timestamp.h"
#include "../../common/os/guid.h"
#include "../../jrd/status.h"
#include "../common/classes/timestamp.h"
#include "../common/os/guid.h"
#include "../jrd/align.h"
#include "../jrd/status.h"
#include "Protocol.h"
#include "Manager.h"
@ -67,7 +68,7 @@ namespace Replication
void putInt(SLONG value)
{
const auto newSize = FB_ALIGN(getSize(), FB_ALIGNMENT);
const auto newSize = FB_ALIGN(getSize(), type_alignments[dtype_long]);
buffer->resize(newSize);
const auto ptr = (const UCHAR*) &value;
buffer->add(ptr, sizeof(SLONG));
@ -75,7 +76,7 @@ namespace Replication
void putBigInt(SINT64 value)
{
const auto newSize = FB_ALIGN(getSize(), FB_ALIGNMENT);
const auto newSize = FB_ALIGN(getSize(), type_alignments[dtype_int64]);
buffer->resize(newSize);
const auto ptr = (const UCHAR*) &value;
buffer->add(ptr, sizeof(SINT64));