Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
7b886daf
Commit
7b886daf
authored
Apr 14, 2014
by
Thomas Jahns
🤸
Browse files
Change grid unpack to force resource IDs.
parent
657bca99
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/grid.c
View file @
7b886daf
...
...
@@ -157,15 +157,18 @@ void grid_free(grid_t *gridptr)
grid_init
(
gridptr
);
}
static
grid_t
*
gridNewEntry
(
void
)
static
grid_t
*
gridNewEntry
(
cdiResH
resH
)
{
grid_t
*
gridptr
;
gridptr
=
(
grid_t
*
)
xmalloc
(
sizeof
(
grid_t
));
grid_init
(
gridptr
);
gridptr
->
self
=
reshPut
((
void
*
)
gridptr
,
&
gridOps
);
grid_t
*
gridptr
=
xmalloc
(
sizeof
(
grid_t
));
grid_init
(
gridptr
);
if
(
resH
==
CDI_UNDEFID
)
gridptr
->
self
=
reshPut
(
gridptr
,
&
gridOps
);
else
{
gridptr
->
self
=
resH
;
reshReplace
(
resH
,
gridptr
,
&
gridOps
);
}
return
gridptr
;
}
...
...
@@ -395,7 +398,7 @@ int gridCreate(int gridtype, int size)
gridInit
();
gridptr
=
gridNewEntry
();
gridptr
=
gridNewEntry
(
CDI_UNDEFID
);
if
(
!
gridptr
)
Error
(
"No memory"
);
gridID
=
gridptr
->
self
;
...
...
@@ -4525,7 +4528,8 @@ gridGetPackSize(void * voidP, void *context)
void
gridUnpack
(
char
*
unpackBuffer
,
int
unpackBufferSize
,
int
*
unpackBufferPos
,
int
nspTarget
,
void
*
context
)
int
*
unpackBufferPos
,
int
nspTarget
,
void
*
context
,
int
force_id
)
{
grid_t
*
gridP
;
uint32_t
d
;
...
...
@@ -4534,8 +4538,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridInit
();
gridP
=
gridNewEntry
();
xassert
(
gridP
);
{
int
intBuffer
[
gridNint
];
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
...
...
@@ -4544,7 +4546,10 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
&
d
,
1
,
DATATYPE_UINT32
,
context
);
xassert
(
cdiCheckSum
(
DATATYPE_INT
,
gridNint
,
intBuffer
)
==
d
);
xassert
(
namespaceAdaptKey
(
intBuffer
[
0
],
nspTarget
)
==
gridP
->
self
);
int
targetID
=
namespaceAdaptKey
(
intBuffer
[
0
],
nspTarget
);
gridP
=
gridNewEntry
(
force_id
?
targetID
:
CDI_UNDEFID
);
xassert
(
!
force_id
||
targetID
==
gridP
->
self
);
gridP
->
type
=
intBuffer
[
1
];
gridP
->
prec
=
intBuffer
[
2
];
...
...
src/grid.h
View file @
7b886daf
...
...
@@ -87,6 +87,11 @@ int gridGenerate(grid_t grid);
void
gridGetIndexList
(
int
,
int
*
);
void
gridUnpack
(
char
*
unpackBuffer
,
int
unpackBufferSize
,
int
*
unpackBufferPos
,
int
nspTarget
,
void
*
context
,
int
force_id
);
#endif
/*
* Local Variables:
...
...
src/resource_unpack.c
View file @
7b886daf
...
...
@@ -4,6 +4,7 @@
#include
"cdi.h"
#include
"dmemory.h"
#include
"grid.h"
#include
"institution.h"
#include
"model.h"
#include
"cdi_int.h"
...
...
@@ -14,12 +15,8 @@
#include
"taxis.h"
#include
"zaxis.h"
extern
void
gridUnpack
(
char
*
,
int
,
int
*
,
int
,
void
*
context
);
/*****************************************************************************/
void
reshUnpackResources
(
char
*
unpackBuffer
,
int
unpackBufferSize
,
void
*
context
)
{
...
...
@@ -44,7 +41,7 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
break
;
case
GRID
:
gridUnpack
(
unpackBuffer
,
unpackBufferSize
,
&
unpackBufferPos
,
nspTarget
,
context
);
nspTarget
,
context
,
1
);
break
;
case
ZAXIS
:
zaxisUnpack
(
unpackBuffer
,
unpackBufferSize
,
&
unpackBufferPos
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment