diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-10-09 12:07:49 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:18:09 +0200 |
commit | ffb69180bb9a0ff4edc6abb6ce29d37a775453b2 (patch) | |
tree | b2d644818a53f4a1663b549f977d8037ca11e53b | |
parent | 8fe2291c53b4c2fb35f66e447daf66ad85f394ad (diff) |
vidix: Simplify code for writing to /proc/mtrr
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32462 b3059339-0415-0410-9bf9-f77b7e298cf2
Add a missing const to declaration.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32463 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | vidix/mtrr.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/vidix/mtrr.c b/vidix/mtrr.c index 3230bd25b3..372d6ffb26 100644 --- a/vidix/mtrr.c +++ b/vidix/mtrr.c @@ -41,7 +41,7 @@ int mtrr_set_type(unsigned base,unsigned size,int type) { #ifdef __linux__ FILE * mtrr_fd; - char * stype; + const char *stype; switch(type) { case MTRR_TYPE_UNCACHABLE: stype = "uncachable"; break; @@ -54,13 +54,9 @@ int mtrr_set_type(unsigned base,unsigned size,int type) mtrr_fd = fopen("/proc/mtrr","wt"); if(mtrr_fd) { - char sout[256]; - unsigned wr_len; - sprintf(sout,"base=0x%08X size=0x%08X type=%s\n",base,size,stype); - wr_len = fprintf(mtrr_fd,sout); - /*printf("MTRR: %s\n",sout);*/ + int wr_len = fprintf(mtrr_fd, "base=0x%08X size=0x%08X type=%s\n", base, size, stype); fclose(mtrr_fd); - return wr_len == strlen(sout) ? 0 : EPERM; + return wr_len > 0 ? 0 : EPERM; } return ENOSYS; #elif defined (__i386__ ) && defined (__NetBSD__) && __NetBSD_Version__ > 105240000 |