From 6263179e32282998844165becb5c4a6a83cf92dc Mon Sep 17 00:00:00 2001 From: iovar Date: Tue, 16 Sep 2008 23:00:23 +0000 Subject: src/rmd_cache.c , src/rmd_init_encoder.c , src/rmd_jack.c : replaced calls to the redudant I16TOA macro, with calls to snprintf and as a result, the above files no longer depend on src/rmd_macro.h. src/rmd_macro.h : Removed the redudant and now unneeded I16TOA macro. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@556 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/rmd_cache.c | 6 +++--- recordmydesktop/src/rmd_init_encoder.c | 3 +-- recordmydesktop/src/rmd_jack.c | 5 ++--- recordmydesktop/src/rmd_macro.h | 19 +------------------ 4 files changed, 7 insertions(+), 26 deletions(-) (limited to 'recordmydesktop') diff --git a/recordmydesktop/src/rmd_cache.c b/recordmydesktop/src/rmd_cache.c index 18e7bf3..5fe5207 100644 --- a/recordmydesktop/src/rmd_cache.c +++ b/recordmydesktop/src/rmd_cache.c @@ -31,7 +31,7 @@ #include "rmd_types.h" #include "rmd_cache.h" -#include "rmd_macro.h" + #include "rmd_specsfile.h" @@ -49,7 +49,7 @@ static void CacheFileN(char *name, char **newname, int n) { // Nth cache file char numbuf[8]; strcpy(*newname,name); strcat(*newname,"."); - I16TOA((n),numbuf) + snprintf( numbuf, 8, "%d", n ); strcat(*newname,numbuf); } @@ -159,7 +159,7 @@ void InitCacheData(ProgData *pdata, cache_data_t->workdir=(pdata->args).workdir; pid=getpid(); - I16TOA(pid,pidbuf) + snprintf( pidbuf, 8, "%d", pid ); //names are stored relatively to current dir(i.e. no chdir) cache_data_t->projname=malloc(strlen(cache_data_t->workdir)+ 12+strlen(pidbuf)+3); diff --git a/recordmydesktop/src/rmd_init_encoder.c b/recordmydesktop/src/rmd_init_encoder.c index 4fb2538..c6d5576 100644 --- a/recordmydesktop/src/rmd_init_encoder.c +++ b/recordmydesktop/src/rmd_init_encoder.c @@ -35,7 +35,6 @@ #include "rmd_types.h" #include "rmd_init_encoder.h" -#include "rmd_macro.h" static void m_add_fishead_packet(ogg_stream_state *m_ogg_state) { @@ -73,7 +72,7 @@ static int IncrementalNaming(char **name) { strcpy(tname,base_name__); strcat(tname,"-"); i++; - I16TOA((i),numbuf) + snprintf( numbuf, 8, "%d", i ); strcat(tname,numbuf); strcat(tname,".ogv"); //save new name diff --git a/recordmydesktop/src/rmd_jack.c b/recordmydesktop/src/rmd_jack.c index 25ae297..7ace370 100644 --- a/recordmydesktop/src/rmd_jack.c +++ b/recordmydesktop/src/rmd_jack.c @@ -31,7 +31,6 @@ #include "rmd_types.h" #include "rmd_jack.h" -#include "rmd_macro.h" #ifdef HAVE_JACK_H @@ -147,7 +146,7 @@ static int SetupPorts(JackData *jdata) { char name[64];//recordMyDesktop:input_n<64 is enough for full name char num[8]; strcpy(name,"input_"); - I16TOA((i+1),num); + snprintf( num, 8, "%d", i+1 ); strcat(name,num); if((jdata->ports[i]=jack_port_register_p(jdata->client, name, @@ -234,7 +233,7 @@ int StartJackClient(JackData *jdata){ //to connetc to a Jack Server strcpy(rmd_client_name,"recordMyDesktop-"); pid=getpid(); - I16TOA(pid,pidbuf) + snprintf( pidbuf, 8, "%d", pid ); strcat(rmd_client_name,pidbuf); if(LoadJackLib(jdata->jack_lib_handle)){ diff --git a/recordmydesktop/src/rmd_macro.h b/recordmydesktop/src/rmd_macro.h index 93ae9e3..262c91c 100644 --- a/recordmydesktop/src/rmd_macro.h +++ b/recordmydesktop/src/rmd_macro.h @@ -76,22 +76,5 @@ #define Y_UNIT_WIDTH 0x0010 #define UV_UNIT_WIDTH 0x0008 -#define I16TOA(number,buffer){\ - int t_num=(number),__k=0,__i=0;\ - char *t_buf=malloc(8);\ - t_num=t_num&((2<<15)-1);\ - while(t_num>0){\ - int digit=t_num%10;\ - t_buf[__k]=digit+48;\ - t_num-=digit;\ - t_num/=10;\ - __k++;\ - }\ - while(__k>0)\ - (buffer)[__i++]=t_buf[--__k];\ - (buffer)[__i]='\0';\ - free(t_buf);\ -};\ - - #endif + -- cgit v1.2.3