Check-in [0fb3b3b582]
Overview
SHA1:0fb3b3b582bce90b77b493576b32e7fff4b1c02a
Date: 2016-11-10 21:14:04
User: rkeene
Comment:Updated to use Tcl allocation routines for memory allocating/releasing
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-12-09
04:18
[a400fc4409] Updated to support partial decryption of data (user: rkeene, tags: trunk)
2016-11-10
21:14
[0fb3b3b582] Updated to use Tcl allocation routines for memory allocating/releasing (user: rkeene, tags: trunk)
20:40
[fa78eca529] Updated to enable use of stubs with dir2c C-VFS builder (user: rkeene, tags: trunk)
Changes

Modified kitsh/buildsrc/kitsh-0.0/cvfs_data.c from [010e908a77] to [184ea3e79a].

270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
		Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC);

		return(TCL_ERROR);
	}

	Tcl_IncrRefCount(ret_list);

	children = malloc(sizeof(*children) * num_children);

	num_children = cmd_getChildren(file, children, num_children);

	for (idx = 0; idx < num_children; idx++) {
		finfo = cmd_getData(NULL, children[idx]);

		if (finfo == NULL || finfo->name == NULL) {
................................................................................
		Tcl_IncrRefCount(ret_curr_obj);

		Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj);

		Tcl_DecrRefCount(ret_curr_obj);
	}

	free(children);

	Tcl_SetObjResult(interp, ret_list);

	Tcl_DecrRefCount(ret_list);

	return(TCL_OK);
}







|







 







|







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
		Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC);

		return(TCL_ERROR);
	}

	Tcl_IncrRefCount(ret_list);

	children = (void *) Tcl_Alloc(sizeof(*children) * num_children);

	num_children = cmd_getChildren(file, children, num_children);

	for (idx = 0; idx < num_children; idx++) {
		finfo = cmd_getData(NULL, children[idx]);

		if (finfo == NULL || finfo->name == NULL) {
................................................................................
		Tcl_IncrRefCount(ret_curr_obj);

		Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj);

		Tcl_DecrRefCount(ret_curr_obj);
	}

	Tcl_Free((void *) children);

	Tcl_SetObjResult(interp, ret_list);

	Tcl_DecrRefCount(ret_list);

	return(TCL_OK);
}

Modified kitsh/buildsrc/kitsh-0.0/dir2c.tcl from [dff14cac78] to [74a40bc096].

233
234
235
236
237
238
239

240
241
242
243
244
245
246
...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
#  endif
#  ifdef HAVE_STRING_H
#    include <string.h>
#  endif
#  ifdef HAVE_STDLIB_H
#    include <stdlib.h>
#  endif


#  ifndef LOADED_CVFS_COMMON
#    define LOADED_CVFS_COMMON 1

typedef enum {
	CVFS_FILETYPE_FILE            = 0,
	CVFS_FILETYPE_DIR             = 1,
................................................................................

if {$obsfucate} {
	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
	puts "\tunsigned char *new_data, *old_data;"
	puts "\tint decrypt_ret, free_old_data;"
	puts ""
	puts "\tnew_data = malloc(finfo->size);"
	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
	puts "\tif (decrypt_ret != 0) {"
	puts "\t\tfree(new_data);"
	puts ""
	puts "\t\treturn;"
	puts "\t}"
	puts ""
	puts "\tfree_old_data = finfo->free;"
	puts "\told_data = (void *) finfo->data;"
	puts ""
	puts "\tfinfo->data = new_data;"
	puts "\tfinfo->free = 1;"
	puts "\tfinfo->type = CVFS_FILETYPE_FILE;"
	puts ""
	puts "\tif (free_old_data) {"
	puts "\t\tfree(old_data);"
	puts "\t}"
	puts "\treturn;"
	puts "}"
	puts ""
}

puts "#  ifdef CVFS_MAKE_LOADABLE"







>







 







|


|












|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
#  endif
#  ifdef HAVE_STRING_H
#    include <string.h>
#  endif
#  ifdef HAVE_STDLIB_H
#    include <stdlib.h>
#  endif
#  include <tcl.h>

#  ifndef LOADED_CVFS_COMMON
#    define LOADED_CVFS_COMMON 1

typedef enum {
	CVFS_FILETYPE_FILE            = 0,
	CVFS_FILETYPE_DIR             = 1,
................................................................................

if {$obsfucate} {
	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
	puts "\tunsigned char *new_data, *old_data;"
	puts "\tint decrypt_ret, free_old_data;"
	puts ""
	puts "\tnew_data = (void *) Tcl_Alloc(finfo->size);"
	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
	puts "\tif (decrypt_ret != 0) {"
	puts "\t\tTcl_Free((void *) new_data);"
	puts ""
	puts "\t\treturn;"
	puts "\t}"
	puts ""
	puts "\tfree_old_data = finfo->free;"
	puts "\told_data = (void *) finfo->data;"
	puts ""
	puts "\tfinfo->data = new_data;"
	puts "\tfinfo->free = 1;"
	puts "\tfinfo->type = CVFS_FILETYPE_FILE;"
	puts ""
	puts "\tif (free_old_data) {"
	puts "\t\tTcl_Free((void *) old_data);"
	puts "\t}"
	puts "\treturn;"
	puts "}"
	puts ""
}

puts "#  ifdef CVFS_MAKE_LOADABLE"