Exemple #1
0
NS_IMETHODIMP
otPr0nObserver::FrameChanged(imgIContainer *aContainer,
                             gfxIImageFrame1_9 *imageFrame,
                             nsIntRect *aDirtyRect)
{
  DEBUG_DUMP("otPr0nObserver::FrameChanged1.9 (entered)");
  nsresult rv;
  PRUint8 *rgbData;
  PRUint32 rgbLen, alphaBits;
  PRUint32 rgbStride;
  PRInt32 width, height;
  gfx_format format;

  if (!mImgRequest)
    return NS_OK;

  DEBUG_DUMP("otPr0nObserver::FrameChanged (1)");

  imageFrame->GetWidth(&width);
  imageFrame->GetHeight(&height);
  imageFrame->GetFormat(&format);

  alphaBits = format > 3 ? 8 : format > 1 ? 1 : 0;

  DEBUG_DUMP_N(("otPr0nObserver::FrameChanged width=%x, height=%x, format=%x",
               width,height,format));
  rv = imageFrame->LockImageData();
  if (NS_FAILED(rv))
    return rv;

  rv = imageFrame->GetImageBytesPerRow(&rgbStride);
  rv |= imageFrame->GetImageData(&rgbData, &rgbLen);
  if (NS_SUCCEEDED(rv)) {
    DEBUG_DUMP("otPr0nObserver::FrameChanged (6)");
    rv = mListener->ProcessImageData(width, height, rgbData, rgbStride, rgbLen,
                                     NULL, 0, alphaBits,
#ifdef OT_HAS_SYSTRAY_WIN
                                     PR_TRUE
#else
                                     PR_FALSE
#endif
                                    );
  }

  imageFrame->UnlockImageData();

  return rv;
}
Exemple #2
0
NS_IMETHODIMP
otPr0nObserver::OnDataAvailable(imgIRequest *aRequest, gfxIImageFrame1_9 *aFrame,
                                  const nsIntRect * aRect)
{
  DEBUG_DUMP("otPr0nObserver::OnDataAvailable1.9 (entered)");
  return NS_OK;
}
Exemple #3
0
void
rd_prefs_set_show_linenos(int v)
{
    g_prefs.show_linenos = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #4
0
void
rd_prefs_set_color_change(unsigned long v)
{
    g_prefs.color_change = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #5
0
void
rd_prefs_set_color_del(unsigned long v)
{
    g_prefs.color_del = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #6
0
NS_IMETHODIMP
otPr0nObserver::OnStopDecode(imgIRequest *aRequest, nsresult status,
                               const PRUnichar *statusArg)
{
  DEBUG_DUMP("otPr0nObserver::OnStopDecode (entered)");
  return NS_OK;
}
Exemple #7
0
void
rd_prefs_set_color_background(unsigned long v)
{
    g_prefs.color_background = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #8
0
void
rd_prefs_set_ignore_whitespace_changes(int v)
{
    g_prefs.ignore_space_changes = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #9
0
void
rd_prefs_set_ignore_case(int v)
{
    g_prefs.ignore_case = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #10
0
NS_IMETHODIMP
otPr0nObserver::OnDataAvailable(imgIRequest *aRequest, PRBool aCurrentFrame,
                                const nsIntRect *aRect)
{
  DEBUG_DUMP("otPr0nObserver::OnDataAvailable (entered)");
  return NS_OK;
}
Exemple #11
0
void
rd_prefs_set_ignore_all_whitespace(int v)
{
    g_prefs.ignore_all_space = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #12
0
void
rd_prefs_set_ignore_blank_lines(int v)
{
    g_prefs.ignore_blank_lines = v;
    DEBUG_DUMP();
    rd_prefs_save(&g_prefs);
}
Exemple #13
0
NS_IMETHODIMP
otPr0nObserver::FrameChanged(imgIContainer *aContainer,
                             nsIntRect *aDirtyRect)
{
  DEBUG_DUMP("otPr0nObserver::FrameChanged (entered)");
  nsresult rv;

  nsCOMPtr<imgIContainer1_9_2> container1_9_2 = do_QueryInterface(aContainer);
  if (container1_9_2) {
    gfxImageSurface1_9_2 *surface;
    rv = container1_9_2->CopyCurrentFrame(&surface);
    NS_ENSURE_SUCCESS(rv, rv);
    rv = mListener->ProcessImageData(surface->Width(), surface->Height(),
                                     surface->Data(), surface->Stride(),
                                     surface->GetDataSize(), NULL, 0, 8,
                                     PR_FALSE);
    ((gfxImageSurface*)surface)->Release();
  } else {
#if GECKO_VERSION >= 200
    nsRefPtr<gfxImageSurface> surface;
    rv = aContainer->CopyFrame(1, 0, getter_AddRefs(surface));
    NS_ENSURE_SUCCESS(rv, rv);
    rv = mListener->ProcessImageData(surface->Width(), surface->Height(),
                                     surface->Data(), surface->Stride(),
                                     surface->GetDataSize(), NULL, 0, 8,
                                     PR_FALSE);
#endif
  }

  return rv;
}
Exemple #14
0
int main()
{
  init();
  {
    char *ptr = 0, *ptr1 = 0, *ptr2 = 0, *ptr4 = 0, *ptr5 = 0, *ptr6 = 0, *ptr7 = 0;

    // Test MALLOC
    ptr = (char*)DEBUG_MALLOC(256);
    strcpy(ptr, "ptr");

    // Test MALLOC
    ptr1 = (char*)DEBUG_MALLOC(256);
    strcpy(ptr1, "ptr1");

    // Test malloc
    ptr2 = (char*)malloc(256);
    strcpy(ptr2, "ptr2");

    // Test new
    int* ptr3 = DEBUG_NEW int(65);

    {
      // checkpoint_charlie takes care of the checkpoint, giving it a name, 
      // and dumping out any memory leaks detected after scope drop
      leaks::checkpoint_charlie checkpoint1("CHECKPOINT 1");

      // Test new[]
      ptr4 = DEBUG_NEW char[256];
      strcpy(ptr4, "ptr4");

      ptr5 = DEBUG_NEW char[256];
      strcpy(ptr5, "ptr5");
    //}
    //{
      leaks::checkpoint_charlie checkpoint2("CHECKPOINT 2");
      ptr6 = new char[256];
      strcpy(ptr6, "ptr6");

      ptr7 = (char*)DEBUG_MALLOC(256);
      strcpy(ptr7, "ptr7");
      ptr7 = (char*)DEBUG_REALLOC(ptr7, 256);
    }

    // Housekeeping
    LOG_PRINTF(("Housekeeping"));
    DEBUG_FREE(ptr);
    DEBUG_FREE(ptr1);
    free(ptr2);
    delete ptr3;
    delete [] ptr4;
    delete [] ptr5;
    delete [] ptr6;

    // Dump the current leaks
    DEBUG_DUMP();
  }
  while(true) SVC_WAIT(1000); // Stay here
}
Exemple #15
0
CMom::~CMom(){
	int	iTemp = 0;

	if (pList){
		if (iType == MASTER){
			char *szTemp;
			DWORD	dCount;
			DEBUG_DUMP("CMom::~CMom: Entering Critical Section gCS")
szTemp = "\n\n====================================\nCMom::~CMom: WE ARE DELETING CMom! OH MY GOD! NO!!! DON'T DO IT!!!\n\n\n";
WriteConsole(ghDebug, szTemp, strlen(szTemp), &dCount, 0);


			EnterCriticalSection(&gCS);
		#ifdef _DEBUG
			DebugConnection("CMom Mother structure destroying.\n", 0);
		#endif
		}else{
/*
	DELETE THIS BLOCK:
				If this is not a MASTER then it is a DAUGHTER and a Daughter
				is only controlled by one thread so we should not need a CS
				since a thread can not preempt itself.		
			EnterCriticalSection(&gCSMom);
*/
		#ifdef _DEBUG
			DebugConnection("CMom Daughter structure destroying.\n", 0);
		#endif
		}

		while(iTemp < iNumOfEntries){	
			if(pList[iTemp]){
				switch(iType){
					case MASTER:
						delete (CMom *) pList[iTemp];
						pItems[iTemp] = FREE_ITEM;
						pList[iTemp] = 0;
						break;
					case DAUGHTER:
							//	Next line will be used once ODBC_TYPE is an
							//	object class
						//	delete (ODBC_TYPE *) pList[iTemp];
							//	In the meantime...
					#ifdef _DEBUG
						DebugConnection("CMom daughter deleting connetion...", 0);
					#endif
						DeleteConn(((ODBC_TYPE *)pList[iTemp])->conn);
						break;
				}
			}
			iTemp++;
		}
		delete [] pList;

		if (iType == MASTER){
			DeleteCriticalSection(&gCSMom);
			LeaveCriticalSection(&gCS);
			DEBUG_DUMP("CMom::~CMom: Left Critical Section gCS    ")
		}else{
Exemple #16
0
NS_IMETHODIMP
otPr0nObserver::OnStopFrame(imgIRequest *aRequest, PRUint32 aFrame)
{
  DEBUG_DUMP("otPr0nObserver::OnStopFrame (entered)");
  nsCOMPtr<imgIContainer> container;
  aRequest->GetImage(getter_AddRefs(container));
  FrameChanged(container, (nsIntRect*)nsnull);
  return NS_OK;
}
Exemple #17
0
void
rd_prefs_set_font_size(int v)
{
    // XXX: Enforce these limits at the UI
    if (v >= 4 && v <= 36) {
        g_prefs.font_size = v;
        DEBUG_DUMP();
        rd_prefs_save(&g_prefs);
    }
}
Exemple #18
0
void
rd_prefs_set_tab_width(int v)
{
    // XXX: Enforce these limits at the UI
    if (v > 0 && v <= 16) {
        g_prefs.tab_width = v;
        DEBUG_DUMP();
        rd_prefs_save(&g_prefs);
    }
}
Exemple #19
0
OSStatus
otMacAudioInputStream::InputReadyCb(void *userdata, AudioUnitRenderActionFlags *actionFlags,
                                    const AudioTimeStamp *timeStamp, UInt32 busNumber,
                                    UInt32 numberFrames, AudioBufferList *data)
{
  otMacAudioInputStream *_this = (otMacAudioInputStream*)userdata;
  OSStatus err;
  DEBUG_DUMP2("InputReadyCb numberFrames = %d, frameEnd = %d", numberFrames, _this->mFrameEnd);

  err = AudioUnitRender(_this->mAudioUnit, actionFlags, timeStamp, busNumber,
                        numberFrames, _this->mBuffer);
  if (err == noErr) {
    UInt32 bytes = _this->mBuffer->mBuffers[0].mDataByteSize;
    char *data = (char*) _this->mBuffer->mBuffers[0].mData;

    while (bytes > 0) {
      PRUint32 len = PR_MIN(_this->mInputFrameSize - _this->mFrameEnd, bytes);
      memcpy(_this->mFrame + _this->mFrameEnd, data, len);

  DEBUG_DUMP_N(("InputReadyCbInt bytes = %d frameEnd = %d, inputFrameSize = %d, frameSize = %d", bytes, _this->mFrameEnd, _this->mInputFrameSize, _this->mFrameSize));

      data += len;
      bytes -= len;
      _this->mFrameEnd += len;

      if (_this->mFrameEnd < _this->mInputFrameSize)
        break;

      UInt32 frameSize = _this->mFrameSize/2;

      err = AudioConverterFillComplexBuffer(_this->mConverter,
                                            &ConverterCb, _this, &frameSize,
                                            _this->mConvertBuffer, NULL);
      if (err != noErr) {
        printErrCode(err);
        return err;
      }

      DEBUG_DUMP("SendFrame");

      char *data2 = (char*)_this->mConvertBuffer->mBuffers[0].mData;

      _this->mFilter->InputData(data2, _this->mFrameSize);
      if (_this->mTarget)
        _this->mTarget->AcceptData(data2, _this->mFrameSize);

      //_this->mFrameEnd = 0;
    }
  } else {
    printErrCode(err);
  }

  return noErr;
}
struct IPSelectorDbEntry *
ip_selector_db_entry_remove(
        struct IPSelectorDb *db,
        int part,
        uint32_t id)
{
  struct IPSelectorDbEntry *removed = NULL;
  struct IPSelectorDbEntry **loc;

  loc = &db->heads[part];

  while (*loc != NULL)
    {
      struct IPSelectorDbEntry *tmp = *loc;
      if (tmp->id == id)
        {
          removed = tmp;
          *loc = tmp->next;
          break;
        }

      loc = &tmp->next;
    }


  if (removed != NULL)
    {
      DEBUG_DUMP(
              db,
              debug_dump_ip_selector_group,
              (struct IPSelectorGroup *)(removed + 1),
              ((struct IPSelectorGroup *)(removed + 1))->bytecount,
              "Removed from db %p part %d; Entry %d "
              "action %d priority %d:",
              db,
              part,
              removed->id,
              removed->action,
              removed->priority);
    }
  else
    {
      DEBUG_FAIL(
              db,
              "Remove failed for db part %d id %d.",
              part,
              id);
    }

  return removed;
}
Exemple #21
0
int eval(eval_scalar *r, const char *str, eval_func_handler func_handler, eval_symbol_handler symbol_handler, void *context)
{
	void *oldbuffer = lex_current_buffer();
	void *strbuffer;
	eval_scalar result;
/*     if (get_helpmode()) {
		eval_scalar *hs = get_helpstring();
		scalar_create_str_c(hs, "");
		strbuffer = lex_scan_string_buffer("NaF()");
	} else {*/
		strbuffer = lex_scan_string_buffer(str);
/*     }*/

	DEBUG_DUMP("evaluating \"%s\":", str);
	DEBUG_DUMP_INDENT_IN;
	
	clear_eval_error();
	
	eval_set_context(context);
	eval_set_func_handler(func_handler);
	eval_set_symbol_handler(symbol_handler);

	result.type=SCALAR_NULL;
	yyparse(&result);
	
	lex_delete_buffer(strbuffer);
	if (oldbuffer) lex_switch_buffer(oldbuffer);
	
/*     if (get_helpmode()) {
		eval_scalar *hs = get_helpstring();
		*r = *hs;
		hs->type = SCALAR_NULL;
		clear_eval_error();
	} else {*/
		if (result.type == SCALAR_NULL) return 0;
		*r = result;
		if (get_eval_error(0, 0)) return 0;
/*	}*/
	
	DEBUG_DUMP_INDENT_OUT;
	DEBUG_DUMP_SCALAR(r, "eval result:");

	return 1;
}
void
ip_selector_db_entry_add(
        struct IPSelectorDb *db,
        int part,
        struct IPSelectorDbEntry *entry,
        int precedence)
{
  struct IPSelectorDbEntry **loc;
  const int insertion_priority =
      entry->priority + (precedence != 0 ? 0 : 1);

  loc = &db->heads[part];
  while (*loc != NULL)
    {
      struct IPSelectorDbEntry *tmp = *loc;

      if (tmp->priority >= insertion_priority)
        {
          break;
        }

      loc = &tmp->next;
    }

  entry->next = *loc;
  *loc = entry;

  DEBUG_DUMP(
          db,
          debug_dump_ip_selector_group,
          (struct IPSelectorGroup *)(entry + 1),
          ((struct IPSelectorGroup *)(entry + 1))->bytecount,
          "Inserted to db %p part %d; Entry %d "
          "action %d priority %d precedence %d:",
          db,
          part,
          entry->id,
          entry->action,
          entry->priority,
          precedence);
}
int
process_command(
        struct KernelSpdCommand *cmd,
        const char __user *cmd_data,
        size_t cmd_data_bytecount)

{
    int status = 0;

    DEBUG_LOW(proc, "Processing command id %d.", cmd->command_id);

    switch (cmd->command_id)
    {
    case KERNEL_SPD_ACTIVATE:
        {
            int ipsec_boundary_bytecount = cmd_data_bytecount;

            if (active != 0)
            {
                DEBUG_FAIL(def, "Kernel SPD already active.");
                status = -EFAULT;
            }
            else
            {
                status =
                    update_ipsec_boundary(
                            cmd_data,
                            ipsec_boundary_bytecount);

                if (status != 0)
                {
                    break;
                }

                if (spd_hooks_init() != 0)
                {
                    DEBUG_FAIL(proc, "Kernel SPD Failed activating NF Hooks.");
                    status = -EFAULT;
                }

                active = 1;

                DEBUG_HIGH(
                        kernel,
                        "Kernel SPD activated. IPsec boundary: '%s'.",
                        ipsec_boundary);
            }
        }
        break;

    case KERNEL_SPD_DEACTIVATE:
        {
            if (active == 0)
            {
                DEBUG_FAIL(proc, "Kernel SPD not active.");
            }
            else
            {
                DEBUG_HIGH(proc, "Kernel SPD deactivated.");
                spd_hooks_uninit();
                bypass_kuid = INVALID_UID;
            }

            active = 0;
        }
        break;

    case KERNEL_SPD_INSERT_ENTRY:
        {
            struct IPSelectorDbEntry *entry;
            const int payload_bytecount = cmd_data_bytecount;

            if (!KERNEL_SPD_ID_VALID(cmd->spd_id))
            {
                DEBUG_FAIL(
                        proc,
                        "Invalid SPD id %d.",
                        cmd->spd_id);

                status = -EFAULT;
                break;
            }

            entry = vmalloc(sizeof *entry + payload_bytecount);
            if (entry == NULL)
            {
                DEBUG_FAIL(
                        proc,
                        "vmalloc(%d) failed.",
                        (int) (sizeof *entry + payload_bytecount));

                status = -EFAULT;
                break;
            }

            status = copy_from_user(entry + 1, cmd_data, payload_bytecount);
            if (status != 0)
            {
                DEBUG_FAIL(proc, "Copy from user failed.");

                vfree(entry);
                status = -EFAULT;
                break;
            }

            entry->action = cmd->action_id;
            entry->id = cmd->entry_id;
            entry->priority = cmd->priority;

            if (ip_selector_db_entry_check(
                        entry,
                        sizeof *entry + payload_bytecount)
                < 0)
            {
                DEBUG_FAIL(proc, "Selector check failed.");

                vfree(entry);
                status = -EFAULT;
                break;
            }

            DEBUG_DUMP(
                    proc,
                    debug_dump_ip_selector_group,
                    entry + 1,
                    payload_bytecount,
                    "Insert entry %d to spd "
                    "id %d action %d priority %d precedence %d:",
                    entry->id,
                    cmd->spd_id,
                    entry->action,
                    entry->priority,
                    cmd->precedence);

            write_lock_bh(&spd_lock);
            ip_selector_db_entry_add(
                    &spd,
                    cmd->spd_id,
                    entry,
                    cmd->precedence);
            write_unlock_bh(&spd_lock);
        }
        break;

    case KERNEL_SPD_REMOVE_ENTRY:

        if (!KERNEL_SPD_ID_VALID(cmd->spd_id))
        {
            DEBUG_FAIL(
                    proc,
                    "Invalid SPD id %d.",
                    cmd->spd_id);

            status = -EFAULT;
            break;
        }

        {
            struct IPSelectorDbEntry *removed;

            write_lock_bh(&spd_lock);
            removed =
                ip_selector_db_entry_remove(
                        &spd,
                        cmd->spd_id,
                        cmd->entry_id);

            write_unlock_bh(&spd_lock);

            if (removed != NULL)
            {
                DEBUG_DUMP(
                        proc,
                        debug_dump_ip_selector_group,
                        removed + 1,
                        -1,
                        "Removed entry %d to spd id %d action %d "
                        "priority %d:",
                        removed->id,
                        cmd->spd_id,
                        removed->action,
                        removed->priority);

                vfree(removed);
            }
            else
            {
                DEBUG_FAIL(
                        proc,
                        "Remove failed: Entry %d not found from spd id %d.",
                        cmd->entry_id,
                        cmd->spd_id);
            }
        }

        break;

    case KERNEL_SPD_UPDATE_IPSEC_BOUNDARY:
        {
            int new_ipsec_boundary_bytecount = cmd_data_bytecount;

            if (active == 0)
            {
                DEBUG_FAIL(def, "Kernel SPD is not active.");
                return -EFAULT;
            }

            status =
                update_ipsec_boundary(
                        cmd_data,
                        new_ipsec_boundary_bytecount);

            if (status != 0)
            {
                break;
            }

            DEBUG_HIGH(
                    kernel,
                    "IPsec boundary updated: '%s'.",
                    ipsec_boundary);
        }
        break;

    case KERNEL_SPD_VERSION_SYNC:
        {
            int version_bytecount = cmd_data_bytecount;
            uint32_t version;

            if (version_bytecount != sizeof version)
            {
                DEBUG_FAIL(
                        def,
                        "Invalid version size %d; should be %d.",
                        version_bytecount,
                        (int) sizeof version);
                return -EFAULT;
            }

            status =
                copy_from_user(
                        &version,
                        cmd_data,
                        sizeof version);
            if (status != 0)
            {
                DEBUG_FAIL(def, "Copy from user failed.");
                return -EFAULT;
            }

            if (version != KERNEL_SPD_VERSION)
            {
                DEBUG_FAIL(
                        def,
                        "Invalid version %d; should be %d.",
                        version,
                        KERNEL_SPD_VERSION);

                return -EINVAL;
            }

            DEBUG_HIGH(
                    kernel,
                    "Versions in sync: %d.",
                    version);
        }
        break;

    case KERNEL_SPD_ADD_BYPASS_UID:
        {
            uint32_t uid;

            if (active == 0)
            {
                DEBUG_FAIL(def, "Kernel SPD is not active.");
                return -EFAULT;
            }

            status =
                copy_from_user(
                        &uid,
                        cmd_data,
                        sizeof uid);
            if (status != 0)
            {
                DEBUG_FAIL(def, "Copy from user failed.");
                return -EFAULT;
            }

            write_lock_bh(&spd_lock);
            bypass_kuid = make_kuid(current_user_ns(), (uid_t) uid);
            write_unlock_bh(&spd_lock);

            DEBUG_HIGH(
                    kernel,
                    "Set bypass uid to %u.",
                    uid);
        }
        break;



    default:
        DEBUG_FAIL(proc, "Unknown command id %d.", cmd->command_id);
        break;
    }

    DEBUG_LOW(proc, "Returning %d", status);

    return status;
}
Exemple #24
0
NS_IMETHODIMP
otPr0nObserver::OnStartDecode(imgIRequest *aRequest)
{
  DEBUG_DUMP("otPr0nObserver::OnStartDecode (entered)");
  return NS_OK;
}
Exemple #25
0
NS_IMETHODIMP
otPr0nObserver::OnStartFrame(imgIRequest *aRequest, PRUint32 aFrame)
{
  DEBUG_DUMP("otPr0nObserver::OnStartFrame (entered)");
  return NS_OK;
}
Exemple #26
0
NS_IMETHODIMP
otPr0nObserver::OnStopContainer(imgIRequest *aRequest, imgIContainer *aContainer)
{
  DEBUG_DUMP("otPr0nObserver::OnStopContainer (entered)");
  return NS_OK;
}
Exemple #27
0
NS_IMETHODIMP
otPr0nObserver::OnStopRequest(imgIRequest* aRequest, PRBool finish)
{
  DEBUG_DUMP("otPr0nObserver::OnStopRequest (entered)");
  return NS_OK;
}
Exemple #28
0
NS_IMETHODIMP
otPr0nObserver::OnDiscard(imgIRequest *aRequest)
{
  DEBUG_DUMP("otPr0nObserver::OnDiscard (entered)");
  return NS_OK;
}
Exemple #29
0
NS_IMETHODIMP
otPr0nObserver::OnStartFrame(imgIRequest *aRequest, gfxIImageFrame1_9 *aFrame)
{
  DEBUG_DUMP("otPr0nObserver::OnStartFrame1.9 (entered)");
  return NS_OK;
}
Exemple #30
0
NS_IMETHODIMP
otPr0nObserver::OnStopFrame(imgIRequest *aRequest, gfxIImageFrame1_9 *aFrame)
{
  DEBUG_DUMP("otPr0nObserver::OnStopFrame1.9 (entered)");
  return FrameChanged(nsnull, aFrame, nsnull);
}