1 Star 0 Fork 5

xuguangmin/jacorb

forked from src-openEuler/jacorb 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
jacorb-2.3.1-read_boolean.patch 3.13 KB
一键复制 编辑 原始数据 按行查看 历史
王歌 提交于 2020-09-02 18:04 . first commit
# read_boolean() now only adjusts positions if the chunk_end_pos == pos, no longer calling
# handle_chunking(). The problem with handle_chunking() is that it aligns the current position
# and this can cause CDRInputStream to "skip" valid boolean values, as those are not padded.
--- src/org/jacorb/orb/CDRInputStream.java 2009-05-03 18:35:54.000000000 -0300
+++ src/org/jacorb/orb/CDRInputStream.java 2009-07-27 21:43:13.654728303 -0300
@@ -460,51 +460,52 @@
private final void handle_chunking()
{
- int remainder = 4 - (index % 4);
- int aligned_pos = (remainder != 4) ? pos + remainder : pos;
+ int remainder = 4 - (this.index % 4);
+ int aligned_pos = (remainder != 4) ? this.pos + remainder : this.pos;
- if (chunk_end_pos >= pos && chunk_end_pos <= aligned_pos)
+ if (this.chunk_end_pos >= pos && this.chunk_end_pos <= aligned_pos)
{
- chunk_end_pos = -1;
- int saved_pos = pos;
- int saved_index = index;
- int tag = read_long();
+ this.adjust_positions();
+ }
+ }
- if (tag < 0) {
+ private final void adjust_positions()
+ {
+ this.chunk_end_pos = -1;
+ int saved_pos = this.pos;
+ int saved_index = this.index;
+ int tag = this.read_long();
+ if (tag < 0)
+ {
// tag is an end tag
-
- if (-tag > valueNestingLevel)
+ if (-tag > this.valueNestingLevel)
{
throw new INTERNAL
(
"received end tag " + tag +
" with value nesting level " +
- valueNestingLevel
+ this.valueNestingLevel
);
}
- valueNestingLevel = -tag;
- valueNestingLevel--;
-
- if (valueNestingLevel > 0)
+ this.valueNestingLevel = -tag;
+ this.valueNestingLevel--;
+ if (this.valueNestingLevel > 0)
{
- chunk_end_pos = pos;
- handle_chunking();
+ this.chunk_end_pos = pos;
+ this.handle_chunking();
}
}
else if (tag > 0 && tag < 0x7fffff00)
{
// tag is the chunk size tag of another chunk
-
- chunk_end_pos = pos + tag;
+ this.chunk_end_pos = this.pos + tag;
}
else // (tag == 0 || tag >= 0x7fffff00)
{
// tag is the null value tag or the value tag of a nested value
-
- pos = saved_pos; // "unread" the tag
- index = saved_index;
- }
+ this.pos = saved_pos; // "unread" the tag
+ this.index = saved_index;
}
}
@@ -711,7 +712,11 @@
public final boolean read_boolean()
{
- handle_chunking();
+ // handle_chunking();
+ if (this.chunk_end_pos == this.pos)
+ {
+ this.adjust_positions();
+ }
index++;
byte value = buffer[pos++];
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xugmin/jacorb.git
git@gitee.com:xugmin/jacorb.git
xugmin
jacorb
jacorb
master

搜索帮助