*/}}
Ver código fonte

Set uid would relink the hyper item now.

Yiming Wu 1 ano atrás
pai
commit
8dc4def9d9
3 arquivos alterados com 11 adições e 5 exclusões
  1. 7 1
      la_data.c
  2. 3 3
      la_util.c
  3. 1 1
      la_util.h

+ 7 - 1
la_data.c

@@ -579,6 +579,7 @@ void* laget_InstanceSelf(void* instace){
     return instace;
 }
 const char* LA_N_A="N/A";
+void *la_GetReadDBInstNUID(char *ReferReadNUID);
 void laget_InstanceUID(void* instance, char* buf, char** ptr){
     int level; laMemNodeHyper* m=memGetHead(instance,&level);
     if(level!=2||!m) return; *ptr=LA_N_A;
@@ -587,7 +588,12 @@ void laget_InstanceUID(void* instance, char* buf, char** ptr){
 void laset_InstanceUID(void* instance, char* buf){
     int level; laMemNodeHyper* m=memGetHead(instance,&level);
     if(level!=2||!m) return;
-    if(!buf[0]) memCreateNUID(m);
+    char _buf[40];
+    if(!buf[0]){ memCreateNUID(_buf,m); buf=_buf; }
+    laListHandle *l = hsh16MDoHashNUID(&MAIN.DBInst2, m->NUID.String);
+    laMemNodeHyper* im=0;
+    for (im = l->pFirst; im; im = m->Item.pNext){ if(im==m) break; }
+    if(im){ lstRemoveItem(l,im); laListHandle *nl = hsh16MDoHashNUID(&MAIN.DBInst2, buf); lstAppendItem(nl,im); }else{ im=m; /* Unlikely */ }
     sprintf(m->NUID.String,"%.30s",buf);
 }
 void* laget_SaverDummy(void* instance, laPropIterator* pi){

+ 3 - 3
la_util.c

@@ -61,8 +61,8 @@ void laSetAuthorInfo(char *Name, char *CopyrightString){
     strSafeSet(&MAIN.Author.CopyrightString, CopyrightString);
 }
 
-void memCreateNUID(laMemNodeHyper* hi){
-    sprintf(hi->NUID.String, "%08X-%hd%02hd%02hd%02hd%02hd%02hd", hi, LA_HYPER_CREATED_TIME(hi));
+void memCreateNUID(char* buf,laMemNodeHyper* hyper){
+    sprintf(buf, "%08X-%hd%02hd%02hd%02hd%02hd%02hd", hyper, LA_HYPER_CREATED_TIME(hyper));
 }
 
 void memHyperInfo(laPropPack* pp, char* buf){
@@ -103,7 +103,7 @@ void memMakeHyperData(laMemNodeHyper* hi){
     hi->TimeCreated.Minute = time->tm_min;
     hi->TimeCreated.Second = time->tm_sec;
     //memcpy(&hi->TimeModified, &hi->TimeCreated, sizeof(laTimeInfo));
-    memCreateNUID(hi);
+    memCreateNUID(hi->NUID.String,hi);
 }
 void memMarkClean(void* HyperUserMem){
     int hyper=0;

+ 1 - 1
la_util.h

@@ -400,7 +400,7 @@ int laTimeElapsedMilliseconds(laTimeRecorder* End, laTimeRecorder* Begin);
 
 void laSetAuthorInfo(char * Name, char * CopyrightString);
 
-void memCreateNUID(laMemNodeHyper* hi);
+void memCreateNUID(char* buf,laMemNodeHyper* hyper);
 
 NEED_STRUCTURE(laPropPack);