Unnamed Fossil Project

Check-in [282111e83e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:282111e83ea38148376e611fa5472792b6910fa6
User & Date: monster 2012-08-10 08:43:10
Context
2012-08-11
02:42
xddb inser/update fixes check-in: eb40275c3f user: monster tags: trunk
2012-08-10
08:43
fixes check-in: 282111e83e user: monster tags: trunk
2012-08-09
02:55
updated check-in: 0f4ad7934f user: monster tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bigint.hc.

1271
1272
1273
1274
1275
1276
1277




















1278
1279
1280
1281
1282

1283
1284
1285
1286
1287
1288
1289
....
1293
1294
1295
1296
1297
1298
1299




1300

1301
1302
1303
1304
1305
1306
1307
....
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
      return Bigint_Init(prime);
    
    return 0;      
  }
#endif
  ;





















void Bigint_Generate_Rsa_Key_Pair(
  YO_BIGINT /*out*/ **rsa_pub, 
  YO_BIGINT /*out*/ **rsa_priv, 
  YO_BIGINT /*out*/ **rsa_mod,
  int bits)

#ifdef _YO_BINGINT_BUILTIN
  {
    __Auto_Ptr(*rsa_mod)
      {
        YO_BIGINT *p, *q, *n, *phi;
        int pBits = Get_Random(bits/5,bits/2);
        int qBits = (bits+1)-pBits;
................................................................................

        n = 0;
        while ( !n ) __Auto_Ptr(n)
          {
            Bigint_Generate_Rsa_PQ(&p,pBits,&q,qBits,&n);

            phi = Bigint_Mul(Bigint_Sub_Short(p,1),Bigint_Sub_Short(q,1));




            *rsa_pub = Bigint_Mutal_Prime(phi,bits/3);

            if ( !*rsa_pub ) n = 0;
            else
              {
                *rsa_priv  = Bigint_Invmod(*rsa_pub,phi);
                __Retain(*rsa_pub);
                __Retain(*rsa_priv);
                *rsa_mod = n;
................................................................................
    if ( len*8 > mbits )
      __Raise_Format(YO_ERROR_OUT_OF_RANGE,
                      (__yoTa("data length is %d bytes, maximum %bytes alowed to sign with %d bits keys",0),
                       len,mbits/8,mbits));
    
    __Auto_Ptr(tmp)
      {
        void *Q = __Zero_Malloc((mbits+1)/8);
        //Soft_Random(Q,(mbits+1)/8);
        memcpy(Q,data,len);
        ((byte_t*)Q)[mbits/8] &= ~(1<<(mbits%8)); 
        tmp = Bigint_From_Bytes(0,Q,mbits/8);
        tmp = Bigint_Expmod(tmp,K,N);
      }
      







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|



|
>







 







>
>
>
>
|
>







 







|







1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
....
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
....
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
      return Bigint_Init(prime);
    
    return 0;      
  }
#endif
  ;

YO_BIGINT *Bigint_From_Int(YO_BIGINT *bint, long val)
#ifdef _YO_BINGINT_BUILTIN
  {
    int i;
    int digits = Bigint_Digits_Of_Bytes((sizeof(val)*8+YO_BIGINT_DIGIT_SHIFT-1)/YO_BIGINT_DIGIT_SHIFT);
    bint = Bigint_Expand_If_Small(bint,digits);
    bint->sign = val < 0 ? -1 : 1;
    val = val < 0 ? -val : val;
    for ( i = 0; i < digits; ++i )
      {
        bint->value[i] = val&YO_BIGINT_DIGIT_MASK;
        val >>= YO_BIGINT_DIGIT_SHIFT;
      }
    return bint;
  }
#endif
  ;


#define Bigint_Generate_Rsa_Key_Pair(Pub,Priv,Mod,Bits) Bigint_Generate_Rsa_Key_Pair_(Pub,Priv,Mod,Bits,0)
void Bigint_Generate_Rsa_Key_Pair_(
  YO_BIGINT /*out*/ **rsa_pub, 
  YO_BIGINT /*out*/ **rsa_priv, 
  YO_BIGINT /*out*/ **rsa_mod,
  int bits,
  long prime)
#ifdef _YO_BINGINT_BUILTIN
  {
    __Auto_Ptr(*rsa_mod)
      {
        YO_BIGINT *p, *q, *n, *phi;
        int pBits = Get_Random(bits/5,bits/2);
        int qBits = (bits+1)-pBits;
................................................................................

        n = 0;
        while ( !n ) __Auto_Ptr(n)
          {
            Bigint_Generate_Rsa_PQ(&p,pBits,&q,qBits,&n);

            phi = Bigint_Mul(Bigint_Sub_Short(p,1),Bigint_Sub_Short(q,1));
            
            if ( prime )
              *rsa_pub = Bigint_From_Int(0,prime);
            else
              *rsa_pub = Bigint_Mutal_Prime(phi,bits/3);
            
            if ( !*rsa_pub ) n = 0;
            else
              {
                *rsa_priv  = Bigint_Invmod(*rsa_pub,phi);
                __Retain(*rsa_pub);
                __Retain(*rsa_priv);
                *rsa_mod = n;
................................................................................
    if ( len*8 > mbits )
      __Raise_Format(YO_ERROR_OUT_OF_RANGE,
                      (__yoTa("data length is %d bytes, maximum %bytes alowed to sign with %d bits keys",0),
                       len,mbits/8,mbits));
    
    __Auto_Ptr(tmp)
      {
        void *Q = __Zero_Malloc((mbits+7)/8);
        //Soft_Random(Q,(mbits+1)/8);
        memcpy(Q,data,len);
        ((byte_t*)Q)[mbits/8] &= ~(1<<(mbits%8)); 
        tmp = Bigint_From_Bytes(0,Q,mbits/8);
        tmp = Bigint_Expmod(tmp,K,N);
      }
      

Changes to datetime.hc.

212
213
214
215
216
217
218















219
220
    STRICT_REQUIRE(L <= 19);
    S[L] = 0;
    return S;
  }
#endif
  ;
    















#endif /* C_once_A998DD5F_3579_4977_B115_DCCE42423C49 */








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
    STRICT_REQUIRE(L <= 19);
    S[L] = 0;
    return S;
  }
#endif
  ;
    
#define Ymd_Curr_Date(Sep) Ymd_Date(Current_Gmt_Datetime(),Sep) 
#define Ymd_Curr_Local_Date(Sep) Ymd_Date(Current_Local_Datetime(),Sep) 
char *Ymd_Date(quad_t dt,char dt_sep)
#ifdef _YO_DATETIME_BUILTIN
  {
    char sp[2] = {dt_sep,0};
    char *S = __Malloc(11);
    int L = sprintf(S,"%04d%s%02d%s%02d",Dt_Year(dt),sp,Dt_Mon(dt),sp,Dt_Mday(dt));
    STRICT_REQUIRE(L <= 10);
    S[L] = 0;
    return S;
  }
#endif
  ;

#endif /* C_once_A998DD5F_3579_4977_B115_DCCE42423C49 */

Changes to httpd.hc.

349
350
351
352
353
354
355



356
357
358
359
360
361
362
363
364
365
366
367

368
369
370
371
372
373
374
      }
    else
      {
        //if ( rqst->cache_control )
        //  Buffer_Printf(bf,);
        if ( rqst->cookie->count ) for ( i=0; i<rqst->cookie->count; ++i )
          Buffer_Printf(bf,"Set-Cookie: %s\r\n",rqst->cookie->at[i]);



        if ( rqst->outstrm_charset && rqst->outstrm_type )
          Buffer_Printf(bf,"Content-Type: %s; charset=%s\n\r\n",rqst->outstrm_type,rqst->outstrm_charset);
        else if ( !rqst->outstrm_type || !strncmp_I(rqst->outstrm_type,"text/",5) )
          Buffer_Printf(bf,"Content-Type: %s; charset=utf-8\r\n",rqst->outstrm_type?rqst->outstrm_type:"text/plain");
        //else if ( !rqst->outstrm_type )
        //  Buffer_Printf(bf,"Content-Type: %s\r\n","text/plain");
        else
          Buffer_Printf(bf,"Content-Type: %s\r\n",rqst->outstrm_type);
        if ( rqst->outstrm_length )
          Buffer_Printf(bf,"Content-Length: %d\r\n",rqst->outstrm_length);
        else
          Buffer_Append(bf,"Transfer-Encoding: chunked\r\n",-1);

      }
      
    for ( i = 0; i < rqst->hlns->count; ++i )
      {
        Buffer_Append(bf,rqst->hlns->at[i],-1);
        Buffer_Append(bf,"\r\n",2);
      }







>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
>







349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
      }
    else
      {
        //if ( rqst->cache_control )
        //  Buffer_Printf(bf,);
        if ( rqst->cookie->count ) for ( i=0; i<rqst->cookie->count; ++i )
          Buffer_Printf(bf,"Set-Cookie: %s\r\n",rqst->cookie->at[i]);
          
        if ( rqst->outstrm )
          {
            if ( rqst->outstrm_charset && rqst->outstrm_type )
              Buffer_Printf(bf,"Content-Type: %s; charset=%s\n\r\n",rqst->outstrm_type,rqst->outstrm_charset);
            else if ( !rqst->outstrm_type || !strncmp_I(rqst->outstrm_type,"text/",5) )
              Buffer_Printf(bf,"Content-Type: %s; charset=utf-8\r\n",rqst->outstrm_type?rqst->outstrm_type:"text/plain");
            //else if ( !rqst->outstrm_type )
            //  Buffer_Printf(bf,"Content-Type: %s\r\n","text/plain");
            else
              Buffer_Printf(bf,"Content-Type: %s\r\n",rqst->outstrm_type);
            if ( rqst->outstrm_length )
              Buffer_Printf(bf,"Content-Length: %d\r\n",rqst->outstrm_length);
            else
              Buffer_Append(bf,"Transfer-Encoding: chunked\r\n",-1);
          }
      }
      
    for ( i = 0; i < rqst->hlns->count; ++i )
      {
        Buffer_Append(bf,rqst->hlns->at[i],-1);
        Buffer_Append(bf,"\r\n",2);
      }

Changes to webhost.hc.

678
679
680
681
682
683
684

685

686
687
688
689
690
691
692
693
        if ( host->services )
          {
            YO_WEBHOST_SERVICE *svc = 0;
            svc = Webhost_Find_Service(host->services,url->query,&script,&pathinfo);
            if ( svc )
              {
                YO_WEBHOST_CGIST *st = Webhost_CGI_State(host, rqst, __Retain(path), script, pathinfo, url);

                st->svc = __Refe(svc);

                Webhost_Execute_Service(st,host->doc_roots->at[0]);
                return 0;
              }
          }
        
        #ifdef __windoze
        if ( host->exec_root )
          {







>

>
|







678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
        if ( host->services )
          {
            YO_WEBHOST_SERVICE *svc = 0;
            svc = Webhost_Find_Service(host->services,url->query,&script,&pathinfo);
            if ( svc )
              {
                YO_WEBHOST_CGIST *st = Webhost_CGI_State(host, rqst, __Retain(path), script, pathinfo, url);
                char *doc_root = host->doc_roots->count?host->doc_roots->at[0]:0;
                st->svc = __Refe(svc);
                
                Webhost_Execute_Service(st,doc_root);
                return 0;
              }
          }
        
        #ifdef __windoze
        if ( host->exec_root )
          {

Changes to xdatasec.hc.

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  }
#endif
  ;

void Xdata_Rsa_Update(YO_XDATA *xdata,YO_BIGINT *K,YO_BIGINT *N)
#ifdef _YO_XDATASEC_BUILTIN
  {__Auto_Release {
    byte_t dgst[32];
    YO_BUFFER *bf = Buffer_Init(0);
    Xnode_Normal_Print(&xdata->root,bf);
    Sha2_Digest(bf->at,bf->count,dgst);
    Xnode_Value_Set_Str(&xdata->root,"$$rsa",Bigint_Hex_Sign(K,N,dgst,32));      
  }}
#endif
  ;

int Xdata_Rsa_Verify(YO_XDATA *xdata,YO_BIGINT *K,YO_BIGINT *N)
#ifdef _YO_XDATASEC_BUILTIN
  {
    int ok = 0;
    char *hex = Xnode_Value_Get_Str(&xdata->root,"$$rsa",0);
    if ( hex ) __Auto_Release 
      {
        byte_t dgst[32];
        YO_BUFFER *bf = Buffer_Init(0);
        Xnode_Normal_Print(&xdata->root,bf);
        Sha2_Digest(bf->at,bf->count,dgst);
        ok = Bigint_Hex_Verify(K,N,hex,dgst,32);
      }
    return ok;
  }
#endif
  ;

#endif /* C_once_9CC5C44A_A9F9_40B3_85DA_10A2EE2AD4FC */







|


|
|











|


|
|







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  }
#endif
  ;

void Xdata_Rsa_Update(YO_XDATA *xdata,YO_BIGINT *K,YO_BIGINT *N)
#ifdef _YO_XDATASEC_BUILTIN
  {__Auto_Release {
    byte_t dgst[20];
    YO_BUFFER *bf = Buffer_Init(0);
    Xnode_Normal_Print(&xdata->root,bf);
    Sha1_Digest(bf->at,bf->count,dgst);
    Xnode_Value_Set_Str(&xdata->root,"$$rsa",Bigint_Hex_Sign(K,N,dgst,20));      
  }}
#endif
  ;

int Xdata_Rsa_Verify(YO_XDATA *xdata,YO_BIGINT *K,YO_BIGINT *N)
#ifdef _YO_XDATASEC_BUILTIN
  {
    int ok = 0;
    char *hex = Xnode_Value_Get_Str(&xdata->root,"$$rsa",0);
    if ( hex ) __Auto_Release 
      {
        byte_t dgst[20];
        YO_BUFFER *bf = Buffer_Init(0);
        Xnode_Normal_Print(&xdata->root,bf);
        Sha1_Digest(bf->at,bf->count,dgst);
        ok = Bigint_Hex_Verify(K,N,hex,dgst,20);
      }
    return ok;
  }
#endif
  ;

#endif /* C_once_9CC5C44A_A9F9_40B3_85DA_10A2EE2AD4FC */

Changes to xddb.hc.

219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
...
253
254
255
256
257
258
259
260
261
262
263

264
265





266
267
268








269

270
271
272



273
274
275
276
277
278
279
...
293
294
295
296
297
298
299










300
301
302
303
304
305
306
        if ( Crc_8(0,at+16,count-16) != Hex2_To_Unsigned(at+13) )
          __Raise(YO_ERROR_CORRUPTED,__yoTa("document corrupted",0));

        switch ( at[8] )
          {
            case XDDB_FORMAT_TEXT:
              doc = Def_Parse_Str(at+16);

              break;
            case XDDB_FORMAT_ZIPPED_TEXT:
              {
                int zOk;
                long final_size = Hex4_To_Unsigned(at+9);
                bf = Buffer_Init(final_size);
                zOk = Zlib_Uncompress(bf->at,&final_size,at+16,count-16);
                if ( zOk != 0 )
                  __Raise_Format(YO_ERROR_DECOMPRESS_DATA,(__yoTa("failed to decompress document: %s",0),Zlib_Error(zOk)));
                /*doc = Def_Parse_Str(bf->at);
                bf = Buffer_Copy(at+16,count-16);
                Zlib_Buffer_Uncompress(bf,final_size);*/
                doc = Def_Parse_Str(bf->at);

                break;
              }
            case XDDB_FORMAT_BINARY:
            case XDDB_FORMAT_ZIPPED_BINARY:
              //doc = Xdata_Binary_Decode(at+16,count-16);
              break;
            default:
................................................................................
  ;

#define Xddb_Build_Unique_Key() __Pool(Xddb_Build_Unique_Key_Npl())
char *Xddb_Build_Unique_Key_Npl()
#ifdef _YO_XDDB_BUILTIN 
  {
    int pid = getpid();
    time_t tmx = time(0);
    double clo = clock();
    
    byte_t uuid[YO_XDDB_UUID_LENGTH] = {0,0,0,0,0,0,0,0}; /* 8 bytes garanty */

    char   out[(YO_XDDB_UUID_LENGTH*8+5)/6 + 3 ] = {'=','=',0};
    





    Unsigned_To_Two(pid,uuid);
    Unsigned_To_Four((uint_t)tmx,uuid+2);
    Unsigned_To_Two((uint_t)((clo/CLOCKS_PER_SEC)*10000),uuid+6);








    System_Random(uuid+6,sizeof(uuid)-6);

    Str_Xbit_Encode(uuid,sizeof(uuid)*8,6,Str_6bit_Encoding_Table,out+2);
    
    STRICT_REQUIRE( out[sizeof(out)-1] == 0 );



    
    return __Memcopy_Npl(out,sizeof(out));
  }
#endif
  ;

_YO_XDDB_EXTERN char Xddb_Delete_OjMID[] _YO_XDDB_BUILTIN_CODE( = "xddb_delete/@*"); 
................................................................................

_YO_XDDB_EXTERN char Xddb_Store_OjMID[] _YO_XDDB_BUILTIN_CODE( = "xddb_store/@*i"); 
int Xddb_Store(YO_XDDB *xddb, YO_XDATA *doc, int strict_revision) _YO_XDDB_BUILTIN_CODE(
  { return ((int(*)(void*,void*,int))Yo_Find_Method_Of(&xddb,Xddb_Store_OjMID,YO_RAISE_ERROR))
        (xddb,doc,strict_revision); });

#define Xddb_Update(Xddb,Doc) Xddb_Store(Xddb,Doc,1)











int Xddb_Overwrite(YO_XDDB *xddb, YO_XDATA *doc, char *key)
#ifdef _YO_XDDB_BUILTIN 
  {
    if ( key )
      Xnode_Value_Set_Str(&doc->root,YO_XDDB_KEY_PROPERTY,key);
    else if ( !Xnode_Value_Get_Str(&doc->root,YO_XDDB_KEY_PROPERTY,0) )







>













>







 







<
<


>
|

>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
>
|
>
|
|
|
>
>
>







 







>
>
>
>
>
>
>
>
>
>







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
255
256
257
258
259
260
261


262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
...
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
        if ( Crc_8(0,at+16,count-16) != Hex2_To_Unsigned(at+13) )
          __Raise(YO_ERROR_CORRUPTED,__yoTa("document corrupted",0));

        switch ( at[8] )
          {
            case XDDB_FORMAT_TEXT:
              doc = Def_Parse_Str(at+16);
              Xddb_Set_Revision(doc,Hex8_To_Unsigned(at));
              break;
            case XDDB_FORMAT_ZIPPED_TEXT:
              {
                int zOk;
                long final_size = Hex4_To_Unsigned(at+9);
                bf = Buffer_Init(final_size);
                zOk = Zlib_Uncompress(bf->at,&final_size,at+16,count-16);
                if ( zOk != 0 )
                  __Raise_Format(YO_ERROR_DECOMPRESS_DATA,(__yoTa("failed to decompress document: %s",0),Zlib_Error(zOk)));
                /*doc = Def_Parse_Str(bf->at);
                bf = Buffer_Copy(at+16,count-16);
                Zlib_Buffer_Uncompress(bf,final_size);*/
                doc = Def_Parse_Str(bf->at);
                Xddb_Set_Revision(doc,Hex8_To_Unsigned(at));
                break;
              }
            case XDDB_FORMAT_BINARY:
            case XDDB_FORMAT_ZIPPED_BINARY:
              //doc = Xdata_Binary_Decode(at+16,count-16);
              break;
            default:
................................................................................
  ;

#define Xddb_Build_Unique_Key() __Pool(Xddb_Build_Unique_Key_Npl())
char *Xddb_Build_Unique_Key_Npl()
#ifdef _YO_XDDB_BUILTIN 
  {
    int pid = getpid();


    
    byte_t uuid[YO_XDDB_UUID_LENGTH] = {0,0,0,0,0,0,0,0}; /* 8 bytes garanty */
    static byte_t uuid1[YO_XDDB_UUID_LENGTH] = {0,0,0,0,0,0,0,0}; /* 8 bytes garanty */
    char   out[(YO_XDDB_UUID_LENGTH*8+5)/6 + 1] = {0,};
    
    do {
    
      time_t tmx = time(0);
      double clo = clock();
      
      Unsigned_To_Two(pid,uuid);
      Unsigned_To_Four((uint_t)tmx,uuid+2);
      Unsigned_To_Two((uint_t)((clo/CLOCKS_PER_SEC)*10000),uuid+6);

      if ( !memcmp(uuid1,uuid,8) )
        {
          Switch_to_Thread();
          continue;
        }
         
      memcpy(uuid1,uuid,8);
      System_Random(uuid+8,sizeof(uuid)-8);

      Str_Xbit_Encode(uuid,sizeof(uuid)*8,6,Str_6bit_Encoding_Table,out);
      
      STRICT_REQUIRE( out[sizeof(out)-1] == 0 );
      break;
      
    } while ( 1 );
    
    return __Memcopy_Npl(out,sizeof(out));
  }
#endif
  ;

_YO_XDDB_EXTERN char Xddb_Delete_OjMID[] _YO_XDDB_BUILTIN_CODE( = "xddb_delete/@*"); 
................................................................................

_YO_XDDB_EXTERN char Xddb_Store_OjMID[] _YO_XDDB_BUILTIN_CODE( = "xddb_store/@*i"); 
int Xddb_Store(YO_XDDB *xddb, YO_XDATA *doc, int strict_revision) _YO_XDDB_BUILTIN_CODE(
  { return ((int(*)(void*,void*,int))Yo_Find_Method_Of(&xddb,Xddb_Store_OjMID,YO_RAISE_ERROR))
        (xddb,doc,strict_revision); });

#define Xddb_Update(Xddb,Doc) Xddb_Store(Xddb,Doc,1)

int Xddb_Newdoc(YO_XDDB *xddb, YO_XDATA *doc, char *key)
#ifdef _YO_XDDB_BUILTIN 
  {
    Xnode_Value_Set_Str(&doc->root,YO_XDDB_KEY_PROPERTY,key);
    Xnode_Value_Set_Int(&doc->root,YO_XDDB_REV_PROPERTY,1);
    return Xddb_Store(xddb,doc,1);
  }
#endif
  ;

int Xddb_Overwrite(YO_XDDB *xddb, YO_XDATA *doc, char *key)
#ifdef _YO_XDDB_BUILTIN 
  {
    if ( key )
      Xnode_Value_Set_Str(&doc->root,YO_XDDB_KEY_PROPERTY,key);
    else if ( !Xnode_Value_Get_Str(&doc->root,YO_XDDB_KEY_PROPERTY,0) )

Changes to xddbsql_.hc.

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
            inconsist:
              __Raise(YO_ERROR_INCONSISTENT,
                __Format(__yoTa("inconsistent revision of document '%s', store:%d != docu:%d",0),
                         key,
                         stats.revision,
                         Xddb_Get_Revision(doc)));              
        
        new_revision = ++stats.revision;
        bf = Xddb_Encode(&xddb->xddb,doc,new_revision);
        
        if ( stats.f.exists )
          success = Xddbsql_Update_Doc(xddb->sqldb, col_id, doc_id, new_revision, bf->at, bf->count, stats.revision );         
        else
          success = Xddbsql_Insert_Doc(xddb->sqldb, col_id, doc_id, new_revision, bf->at, bf->count );         
      







|







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
            inconsist:
              __Raise(YO_ERROR_INCONSISTENT,
                __Format(__yoTa("inconsistent revision of document '%s', store:%d != docu:%d",0),
                         key,
                         stats.revision,
                         Xddb_Get_Revision(doc)));              
        
        new_revision = stats.revision + 1;
        bf = Xddb_Encode(&xddb->xddb,doc,new_revision);
        
        if ( stats.f.exists )
          success = Xddbsql_Update_Doc(xddb->sqldb, col_id, doc_id, new_revision, bf->at, bf->count, stats.revision );         
        else
          success = Xddbsql_Insert_Doc(xddb->sqldb, col_id, doc_id, new_revision, bf->at, bf->count );         
      

Changes to xjson.hc.

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
char *Json_Format_Into(YO_BUFFER *bf, YO_XNODE *r, int flags)
#ifdef _YO_JSON_BUILTIN
  {
    int indent = (flags&0xff);
    if ( !bf ) bf = Buffer_Init(0);
    Buffer_Append(bf,"{\n",2);
    Def_Format_Node_In_Depth(bf,r,flags|XDEF_FORMAT_JSON,indent+1);
    Buffer_Append(bf,"\n}\n",3);
    return (char*)bf->at;
  }
#endif
  ;
  
char *Json_Format(YO_XNODE *r, int flags)
#ifdef _YO_JSON_BUILTIN







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
char *Json_Format_Into(YO_BUFFER *bf, YO_XNODE *r, int flags)
#ifdef _YO_JSON_BUILTIN
  {
    int indent = (flags&0xff);
    if ( !bf ) bf = Buffer_Init(0);
    Buffer_Append(bf,"{\n",2);
    Def_Format_Node_In_Depth(bf,r,flags|XDEF_FORMAT_JSON,indent+1);
    Buffer_Append(bf,"}\n",3);
    return (char*)bf->at;
  }
#endif
  ;
  
char *Json_Format(YO_XNODE *r, int flags)
#ifdef _YO_JSON_BUILTIN

Changes to yoyo.hc.

381
382
383
384
385
386
387

388
389
390
391
392
393
394
    YO_ERROR_UNSUPPORTED      = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+29),
    YO_ERROR_IO_EOF           = YO_IO_ERROR_GROUP|(YO_ERROR_BASE+30),
    YO_ERROR_DNS              = YO_IO_ERROR_GROUP|(YO_ERROR_BASE+31),
    YO_ERROR_SUBSYSTEM_INIT   = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+32),
    YO_ERROR_SYSTEM           = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+33),
    YO_ERROR_SYNTAX           = YO_ILLFORMED_ERROR_GROUP|(YO_ERROR_BASE+34),
    YO_ERROR_TESUITE_FAIL     = YO_SELFCHECK_ERROR_GROUP|(YO_ERROR_BASE+35),

  };

#define YO_ERROR_IS_USER_ERROR(err) !(err&YO_XXXX_ERROR_GROUP)

enum _YO_FLAGS
  {
    YO_RAISE_ERROR            = 0x70000000,







>







381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
    YO_ERROR_UNSUPPORTED      = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+29),
    YO_ERROR_IO_EOF           = YO_IO_ERROR_GROUP|(YO_ERROR_BASE+30),
    YO_ERROR_DNS              = YO_IO_ERROR_GROUP|(YO_ERROR_BASE+31),
    YO_ERROR_SUBSYSTEM_INIT   = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+32),
    YO_ERROR_SYSTEM           = YO_RUNTIME_ERROR_GROUP|(YO_ERROR_BASE+33),
    YO_ERROR_SYNTAX           = YO_ILLFORMED_ERROR_GROUP|(YO_ERROR_BASE+34),
    YO_ERROR_TESUITE_FAIL     = YO_SELFCHECK_ERROR_GROUP|(YO_ERROR_BASE+35),
    YO_ERROR_ASSERT_FAIL      = YO_SELFCHECK_ERROR_GROUP|(YO_ERROR_BASE+36),
  };

#define YO_ERROR_IS_USER_ERROR(err) !(err&YO_XXXX_ERROR_GROUP)

enum _YO_FLAGS
  {
    YO_RAISE_ERROR            = 0x70000000,