Chameleon

Chameleon Commit Details

Date:2010-07-31 22:36:44 (13 years 8 months ago)
Author:Daniel Miranda
Commit:291
Parents: 290
Message:Added disk.h to xcodeproj.\nRandom string length fixes\nOther small changes
Changes:
M/branches/danielkza/i386/boot2/options.c
M/branches/danielkza/i386/libsaio/sys.c
M/branches/danielkza/i386/libsaio/disk.h
M/branches/danielkza/i386/libsaio/xml.c
M/branches/danielkza/Chameleon.xcodeproj/project.pbxproj
M/branches/danielkza/i386/libsa/printf.c
M/branches/danielkza/i386/libsaio/disk.c

File differences

branches/danielkza/Chameleon.xcodeproj/project.pbxproj
1010
1111
1212
13
1314
1415
1516
......
472473
473474
474475
476
475477
476478
477479
0172D0DC11FB66820030222E /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = "<group>"; };
0172D0DD11FB66820030222E /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = "<group>"; };
019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = "<group>"; };
65ED53931204B83200B22507 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = "<group>"; };
B0056CD611F3868000754B65 /* boot */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot; sourceTree = "<group>"; };
B0056CD711F3868000754B65 /* boot.sys */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.preload"; path = boot.sys; sourceTree = "<group>"; };
B0056CD811F3868000754B65 /* boot0 */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot0; sourceTree = "<group>"; };
B0056D2411F3868000754B65 /* libsaio */ = {
isa = PBXGroup;
children = (
65ED53931204B83200B22507 /* disk.h */,
B0056D2511F3868000754B65 /* acpi.h */,
B0056D2611F3868000754B65 /* acpi_patcher.c */,
B0056D2711F3868000754B65 /* acpi_patcher.h */,
branches/danielkza/i386/libsaio/xml.c
110110
111111
112112
113
113
114114
115115
116116
117117
118118
119
119
120120
121121
122122
......
143143
144144
145145
146
147
146
148147
149148
150
149
151150
152
151
153152
154153
155154
......
157156
158157
159158
160
161
159
160
162161
163162
164163
return 0;
}
/* Function for basic XML entity replacement. It *does not* handle unicode escapes */
/* Function for basic XML character entities parsing */
char*
XMLDecode(const char* src)
{
typedef const struct XMLEntity {
char* name;
const char* name;
size_t nameLen;
char value;
} XMLEntity;
if ( *s == '&' )
{
bool entFound = false;
XMLEntity* ent;
int i = 0;
int i;
s++;
for ( ent=&ents[0]; i < sizeof(ents); ent = &ents[i++] )
for ( i = 0; i < sizeof(ents); i++)
{
if ( strncmp(s, ent->name, ent->nameLen) == 0 )
if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 )
{
entFound = true;
break;
}
if ( entFound )
{
*o++ = ent->value;
s += ent->nameLen;
*o++ = ents[i].value;
s += ents[i].nameLen;
continue;
}
}
branches/danielkza/i386/libsaio/sys.c
813813
814814
815815
816
817816
818817
819818
bool filteredChain = false;
bool foundPrimary = false;
BVRef bvr, bvr1 = 0, bvr2 = 0;
extern bool matchVolumeToString(BVRRef, const char *, bool);
if (chain->filtered) filteredChain = true;
branches/danielkza/i386/libsaio/disk.c
6868
6969
7070
71
7172
7273
7374
......
18241825
18251826
18261827
1827
1828
18281829
18291830
18301831
......
18341835
18351836
18361837
1837
1838
1838
1839
1840
1841
1842
1843
18391844
18401845
18411846
#include "ext2fs.h"
#include "xml.h"
#include "disk.h"
#include <limits.h>
#include <IOKit/storage/IOApplePartitionScheme.h>
void getBootVolumeDescription( BVRef bvr, char *str, long strMaxLen, bool verbose )
{
unsigned char type;
char*p = str;
char *p = str;
if(!bvr || !p || strMaxLen <= 0)
return;
if (verbose)
{
int len = getDeviceDescription(bvr, str);
strcat(str, " ");
for (; strMaxLen > 0 && *p != '\0'; p++, strMaxLen--);
if(len >= strMaxLen)
return;
strcpy(str[len++], " ");
strMaxLen -= len;
p += len;
}
/* See if a partition rename is preferred */
branches/danielkza/i386/libsaio/disk.h
1111
1212
1313
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
14
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
#endif /* __LIBSAIO_DISK_H */
/*
* disk.h
* Chameleon
*
* Created by Daniel Miranda on 27/07/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#ifndef __LIBSAIO_DISK_H
#define __LIBSAIO_DISK_H
char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial);
#endif /* __LIBSAIO_DISK_H */
#endif /* __LIBSAIO_DISK_H */
branches/danielkza/i386/boot2/options.c
111111
112112
113113
114
114
115115
116116
117117
......
777777
778778
779779
780
780
781781
782782
783783
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, 79, true );
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy)-1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, false );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
strlcpy(prompt, val, cnt);
} else {
name = malloc(80);
getBootVolumeDescription(gBootVolume, name, 79, false);
getBootVolumeDescription(gBootVolume, name, sizeof(name)-1, false);
prompt = malloc(256);
sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name);
free(name);
branches/danielkza/i386/libsa/printf.c
6060
6161
6262
63
64
65
66
67
68
69
70
71
72
73
74
75
76
6377
6478
6579
return (pi.str - str);
}
int snprintf(char *str, long len, const char * fmt, ...)
{
va_list ap;
struct putc_info pi;
va_start(ap, fmt);
pi.str = str;
pi.last_str = str + len - 1;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
return (pi.str - str);
}
/*VARARGS1*/
int slvprintf(char * str, int len, const char * fmt, va_list ap)
{

Archive Download the corresponding diff file

Revision: 291