Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "BackwardsList.h"
- #include <iostream>
- long BackwardsList::GetEntry(long index) {
- // TODO: FROG CODE THAT EVALUATES POINTER MORE THAN ONCE (more than one set of
- // brackets)
- long current = this->list_ptr;
- for (long i = 0; i < index; ++i) {
- current = *(long *)current;
- }
- return *(long *)current;
- }
- long BackwardsList::Count() { return ((long *)this->list_ptr)[1]; }
- BackwardsList::BackwardsList() {
- this->list_ptr = (long)malloc(sizeof(long) * 2);
- *((long *)this->list_ptr) = this->list_ptr;
- ((long *)this->list_ptr)[1] = 0;
- }
- void BackwardsList::Add(long object_ptr) {
- long new_entry = (long)malloc(sizeof(long) * 2);
- *(long *)new_entry = *(long *)this->list_ptr;
- ((long *)new_entry)[1] = object_ptr;
- *(long *)this->list_ptr = new_entry;
- ++((long *)this->list_ptr)[1];
- }
- void BackwardsList::Delete() {
- // TODO: FROG CODE DELETE ALL AT SAME TIME (more than one set of bracket )
- long current = *(long*)this->list_ptr;
- for (int i = 0; i < this->Count(); ++i) {
- long old = current;
- current = *(long *)old; // deobfuscated
- free((long *)old);
- }
- free((long *)list_ptr);
- delete this;
- }
- long BackwardsList::Get(long index) {
- return ((long *)this->GetEntry(index))[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement